Merge branch 'v2.3.3-dev' of https://github.com/usmannasir/cyberpanel into v2.3.3-dev

This commit is contained in:
Hassan Hashmi
2022-08-15 12:31:49 +05:00
7 changed files with 98 additions and 73 deletions

View File

@@ -12,34 +12,35 @@
<div id="page-title">
<h2>{% trans "Rspamd Configurations!" %} -
</h2>
<p>{% trans "On this page you can configure RSPAMD settings." %}</p>
<p>{% trans "On this page you can configure Rspamd settings." %}</p>
</div>
<div ng-controller="Rspamd" class="example-box-wrapper">
<div class="panel panel-body">
<div class="col-lg-12" style="float: left">
<h3 class="content-box-header">
{% trans "Rspamd" %} <img ng-hide="RspamdLoading" src="/static/images/loading.gif">
<div class="col-lg-12" style="float: left">
<h3 class="content-box-header">
{% trans "Rspamd" %} <img ng-hide="RspamdLoading" src="/static/images/loading.gif">
</h3>
</div>
</h3>
</div>
<div style="width: 100%; margin: 0 auto">
<div ng-hide="uninstallbutton" class="col-lg-3" style="float: left">
<button type="button" data-toggle="modal" data-target="#ViewRspamdlog" ng-click="FetchRspamdLog()"
class="btn btn-primaryb btn-lg btn-block">{% trans "View Rsmapd Log" %}</button>
<button type="button" data-toggle="modal" data-target="#ViewRspamdlog"
ng-click="FetchRspamdLog()"
class="btn btn-primaryb btn-lg btn-block">{% trans "View Rspamd Logs" %}</button>
</div>
<div ng-hide="uninstallbutton" class="col-lg-2" style="float: left">
<div ng-hide="uninstallbutton" class="col-lg-3" style="float: left">
<button type="button" data-toggle="modal" data-target="#UninstallRspamdmodal"
class="btn btn-danger btn-lg btn-block">{% trans "uninstall." %}</button>
class="btn btn-danger btn-lg btn-block">{% trans "Un-install Rspamd" %}</button>
</div>
<div ng-hide="uninstallbutton" class="col-lg-2" style="float: left">
<div ng-hide="uninstallbutton" class="col-lg-6" style="float: left">
<button type="button" ng-click="RestartRspamd()"
class="btn btn-gray btn-lg btn-block">{% trans "Restart" %}</button>
class="btn btn-gray btn-lg btn-block">{% trans "Restart Rspamd and CLAMAV" %}</button>
</div>
</div>
@@ -164,8 +165,11 @@
<!-----------------------------------------ClamAv--------------------------->
<div style="padding: 2%" class="col-md-12">
<h3 class="content-box-header">
{% trans "ClamAV" %}
{% trans "ClamAV - This is CLAMV Configurations in Rspamd" %}
</h3>
<p style="margin: 1%">
<strong>Warning</strong> {% trans "this is advanced settings, do not change if you don't know what you are doing" %}.
</p>
<form action="/" id="createPackages" class="form-horizontal bordered-row">
<div ng-hide="phpDetailsBox" class="form-group">
@@ -256,13 +260,17 @@
</form>
</div>
<!-----------------------------------------ClamAv 2--------------------------->
<!-----------------------------------------ClamAv 2--------------------------->
<div style="padding: 2%" class="col-md-12">
<h3 class="content-box-header">
{% trans "ClamAV Configuration" %}
<img ng-hide="CLamAVLoading"
src="/static/images/loading.gif">
src="/static/images/loading.gif">
</h3>
<p style="margin: 1%">
<strong>Warning</strong> {% trans "this is advanced settings, do not change if you don't know what you are doing" %}.
</p>
<form action="/" id="createPackages" class="form-horizontal bordered-row">
<div ng-hide="phpDetailsBox" class="form-group">
<label class="col-sm-4 control-label">TCPSocket</label>
@@ -330,9 +338,13 @@
<!-----------------------------------------postfix--------------------------->
<div style="padding: 2%" class="col-md-12">
<h3 class="content-box-header">
{% trans "Postfix" %}<img ng-hide="postfixLoading"
src="/static/images/loading.gif">
{% trans "Postfix Configurations for Rspamd" %}<img ng-hide="postfixLoading"
src="/static/images/loading.gif">
</h3>
<p style="margin: 1%">
<strong>Warning</strong> {% trans "this is advanced settings, do not change if you don't know what you are doing" %}.
</p>
<form action="/" id="createPackages" class="form-horizontal bordered-row">
<div class="form-group">
@@ -387,6 +399,10 @@
<h3 class="content-box-header">
{% trans "Redis" %}<img ng-hide="RedisLoading" src="/static/images/loading.gif">
</h3>
<p style="margin: 1%">
<strong>Warning</strong> {% trans "this is advanced settings, do not change if you don't know what you are doing" %}.
</p>
<form action="/" id="createPackages" class="form-horizontal bordered-row">
<div class="form-group">
@@ -489,12 +505,13 @@
</h4>
</div>
<div class="modal-body">
<textarea ng-model="RspamdlogsData" class="form-control" rows="30">{{ Rspamdlogs }}</textarea>
<textarea ng-model="RspamdlogsData" class="form-control"
rows="30">{{ Rspamdlogs }}</textarea>
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-primary" data-dismiss="modal" >yes
class="btn btn-primary" data-dismiss="modal">yes
</button>
<button type="button"
class="btn btn-default" data-dismiss="modal">

View File

@@ -1495,29 +1495,28 @@ def fetchRspamdSettings(request):
TCPSocket = ''
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
pass
clamavconfpath = '/etc/clamd.d/scan.conf'
elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20:
clamavconfpath = "/etc/clamav/clamd.conf"
command = "sudo cat " + clamavconfpath
data = ProcessUtilities.outputExecutioner(command).splitlines()
for items in data:
if items.find('TCPSocket') > -1:
tempData = items.split(' ')
TCPSocket = tempData[1]
if items.find('TCPAddr') > -1:
tempData = items.split(' ')
TCPAddr = tempData[1]
if items.find('LogFile') > -1:
tempData = items.split(' ')
LogFile = tempData[1]
if items.find('Debug') > -1:
if items.find('Debug true') < 0:
clamav_Debug = False
continue
else:
clamav_Debug = True
command = "sudo cat " + clamavconfpath
data = ProcessUtilities.outputExecutioner(command).splitlines()
for items in data:
if items.find('TCPSocket') > -1:
tempData = items.split(' ')
TCPSocket = tempData[1]
if items.find('TCPAddr') > -1:
tempData = items.split(' ')
TCPAddr = tempData[1]
if items.find('LogFile') > -1:
tempData = items.split(' ')
LogFile = tempData[1]
if items.find('Debug') > -1:
if items.find('Debug true') < 0:
clamav_Debug = False
continue
else:
clamav_Debug = True
final_dic = {'fetchStatus': 1,
@@ -1662,8 +1661,6 @@ def saveRedisConfigurations(request):
except KeyError:
return redirect(loadLoginPage)
def saveclamavConfigurations(request):
try:
userID = request.session['userID']
@@ -1832,7 +1829,12 @@ def RestartRspamd(request):
try:
command = "systemctl restart rspamd"
ProcessUtilities.executioner(command)
command = "systemctl restart clamav-daemon"
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
command = 'systemctl start clamd@scan'
else:
command = "systemctl restart clamav-daemon"
ProcessUtilities.executioner(command)
dic = {'status': 1, 'error_message': 'None',}
@@ -2011,7 +2013,6 @@ def ReadReport(request):
except KeyError:
return redirect(loadLoginPage)
def debugEmailForSite(request):
try:
userID = request.session['userID']
@@ -2028,7 +2029,6 @@ def debugEmailForSite(request):
except KeyError:
return redirect(loadLoginPage)
def fixMailSSL(request):
try:
userID = request.session['userID']

View File

@@ -1470,7 +1470,7 @@ autocreate_system_folders = On
try:
os.remove("/usr/local/lscp/fcgi-bin/lsphp")
shutil.copy("/usr/local/lsws/lsphp73/bin/lsphp", "/usr/local/lscp/fcgi-bin/lsphp")
shutil.copy("/usr/local/lsws/lsphp74/bin/lsphp", "/usr/local/lscp/fcgi-bin/lsphp")
except:
pass

View File

@@ -251,6 +251,9 @@ class InstallCyberPanel:
if self.distro == cent8:
command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* lsphp80* --exclude lsphp73-pecl-zip --exclude *imagick* -y'
subprocess.call(command, shell=True)
command = 'dnf install lsphp81* --exclude *imagick* -y'
subprocess.call(command, shell=True)
if self.distro == openeuler:
command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* lsphp80* -y'

View File

@@ -907,7 +907,6 @@ Automatic backup failed for %s on %s.
command = 'chattr -R -i /home/%s/incbackup/' % (website.domain)
ProcessUtilities.executioner(command)
else:
command = 'chattr -R -i /home/%s/' % (website.domain)
ProcessUtilities.executioner(command)

View File

@@ -358,9 +358,9 @@ class backupUtilities:
## Saving original vhost conf file
completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{domainName}/vhost.conf'
#completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{domainName}/vhost.conf'
copy(completPathToConf, tempStoragePath + '/vhost.conf')
#copy(completPathToConf, tempStoragePath + '/vhost.conf')
## /home/example.com/backup/backup-example.com-02.13.2018_10-24-52 -- tempStoragePath
## shutil.make_archive
@@ -431,6 +431,12 @@ class backupUtilities:
## Child Domains SSL.
## For master domain copy the conf file to tempStorage path here it was done above, but since it is root operation it should be performed here
completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{domainName}/vhost.conf'
copy(completPathToConf, tempStoragePath + '/vhost.conf')
childDomains = backupMetaData.findall('ChildDomains/domain')
try:

View File

@@ -989,35 +989,35 @@ LogFile /var/log/clamav/clamav.log
clamav_Debug= jsondata['clamav_Debug']
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
pass
clamavconfpath = '/etc/clamd.d/scan.conf'
elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20:
clamavconfpath = "/etc/clamav/clamd.conf"
f = open(clamavconfpath, "r")
dataa = f.read()
f.close()
data = dataa.splitlines()
writeDataToFile = open(clamavconfpath, "w")
for i in data:
if i.find('TCPSocket') > -1:
newitem = 'TCPSocket %s' % TCPSocket
writeDataToFile.writelines(newitem + '\n')
elif i.find('TCPAddr') > -1:
newitem = 'TCPAddr %s' % TCPAddr
writeDataToFile.writelines(newitem + '\n')
elif i.find('LogFile') > -1:
newitem = 'LogFile %s' % LogFile
writeDataToFile.writelines(newitem + '\n')
elif i.find('Debug =') > -1:
if clamav_Debug == True:
newitem = 'Debug true'
writeDataToFile.writelines(newitem + '\n')
elif clamav_Debug == False:
newitem = 'Debug false'
writeDataToFile.writelines(newitem + '\n')
else:
writeDataToFile.writelines(i + '\n')
f = open(clamavconfpath, "r")
dataa = f.read()
f.close()
data = dataa.splitlines()
writeDataToFile = open(clamavconfpath, "w")
for i in data:
if i.find('TCPSocket') > -1:
newitem = 'TCPSocket %s' % TCPSocket
writeDataToFile.writelines(newitem + '\n')
elif i.find('TCPAddr') > -1:
newitem = 'TCPAddr %s' % TCPAddr
writeDataToFile.writelines(newitem + '\n')
elif i.find('LogFile') > -1:
newitem = 'LogFile %s' % LogFile
writeDataToFile.writelines(newitem + '\n')
elif i.find('Debug =') > -1:
if clamav_Debug == True:
newitem = 'Debug true'
writeDataToFile.writelines(newitem + '\n')
elif clamav_Debug == False:
newitem = 'Debug false'
writeDataToFile.writelines(newitem + '\n')
else:
writeDataToFile.writelines(i + '\n')
return 1, 'None'
except BaseException as msg: