diff --git a/firewall/firewallManager.py b/firewall/firewallManager.py index aa0feb9a4..7099148d0 100644 --- a/firewall/firewallManager.py +++ b/firewall/firewallManager.py @@ -1068,11 +1068,14 @@ class FirewallManager: owaspInstalled = 0 try: - command = 'sudo cat /usr/local/lsws/conf/comodo_litespeed/rules.conf.main' - res = ProcessUtilities.executioner(command) + command = 'sudo ls /usr/local/lsws/conf/comodo_litespeed/' + output = ProcessUtilities.outputExecutioner(command) - if res == 1: + if output.find('No such') > -1: + comodoInstalled = 0 + else: comodoInstalled = 1 + except subprocess.CalledProcessError: pass diff --git a/plogical/cronUtil.py b/plogical/cronUtil.py index fc098bd32..08493833b 100644 --- a/plogical/cronUtil.py +++ b/plogical/cronUtil.py @@ -24,18 +24,18 @@ class CronUtil: output = os.popen(cmd).read() if "Exists" not in output: - print "0,Not Exists" + print "0,CyberPanel,Not Exists" return 1 try: f = subprocess.check_output(["sudo", "crontab", "-u", externalApp, "-l"]) print f except BaseException, msg: - print "0," + str(msg) + print "0,CyberPanel," + str(msg) return 1 except BaseException, msg: - print "0," + str(msg) + print "0,CyberPanel," + str(msg) @staticmethod def saveCronChanges(externalApp, finalCron, line): diff --git a/plogical/modSec.py b/plogical/modSec.py index 7b03fe572..971fb6a6e 100644 --- a/plogical/modSec.py +++ b/plogical/modSec.py @@ -356,7 +356,7 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf except BaseException, msg: logging.CyberCPLogFileWriter.writeToFile( - str(msg) + " [installOWASP]") + str(msg) + " [installComodo]") print "0," + str(msg) @staticmethod @@ -474,6 +474,7 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/owasp/rules/RESPONSE-999-EXCL conf.writelines(items) conf.close() + installUtilities.reStartLiteSpeed() print "1,None" @@ -497,6 +498,7 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/owasp/rules/RESPONSE-999-EXCL conf.writelines(items) conf.close() + installUtilities.reStartLiteSpeed() print "1,None" diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py index a87409c67..40cc41a68 100644 --- a/plogical/processUtilities.py +++ b/plogical/processUtilities.py @@ -135,8 +135,8 @@ class ProcessUtilities(multi.Thread): def containerCheck(): try: command = 'sudo cat /etc/cgrules.conf' - result = subprocess.call(shlex.split(command)) - if result == 1: + output = ProcessUtilities.outputExecutioner(command) + if output.find('No such') > -1: return 0 else: return 1 diff --git a/plogical/website.py b/plogical/website.py index 426901eee..aa3ed0fa2 100644 --- a/plogical/website.py +++ b/plogical/website.py @@ -1005,7 +1005,7 @@ class WebsiteManager: f = ProcessUtilities.outputExecutioner(execPath) - if f.find("0,") > -1: + if f.find("0,CyberPanel,") > -1: data_ret = {'getWebsiteCron': 0, "user": website.externalApp, "crons": {}} final_json = json.dumps(data_ret) return HttpResponse(final_json) @@ -1028,7 +1028,7 @@ class WebsiteManager: final_json = json.dumps(data_ret) return HttpResponse(final_json) except BaseException, msg: - print msg + logging.CyberCPLogFileWriter.writeToFile(str(msg)) dic = {'getWebsiteCron': 0, 'error_message': str(msg)} json_data = json.dumps(dic) return HttpResponse(json_data) diff --git a/s3Backups/s3Backups.py b/s3Backups/s3Backups.py index 564fbe554..2e93a4572 100644 --- a/s3Backups/s3Backups.py +++ b/s3Backups/s3Backups.py @@ -542,6 +542,10 @@ class S3Backups(multi.Thread): key, Config=config, ) + + command = 'rm -f ' + result[1] + ".tar.gz" + ProcessUtilities.normalExecutioner(command) + BackupLogs(owner=plan, level='INFO', timeStamp=time.strftime("%b %d %Y, %H:%M:%S"), msg='Backup successful for ' + items.domain + '.').save() else: @@ -920,8 +924,11 @@ class S3Backups(multi.Thread): key, Config=config, ) + command = 'rm -f ' + result[1] + ".tar.gz" + ProcessUtilities.normalExecutioner(command) BackupLogsDO(owner=plan, level='INFO', timeStamp=time.strftime("%b %d %Y, %H:%M:%S"), msg='Backup successful for ' + items.domain + '.').save() + else: BackupLogsDO(owner=plan, level='ERROR', timeStamp=time.strftime("%b %d %Y, %H:%M:%S"), msg='Backup failed for ' + items.domain + '. Error: ' + result[1]).save() @@ -1187,6 +1194,8 @@ class S3Backups(multi.Thread): key, Config=config, ) + command = 'rm -f ' + result[1] + ".tar.gz" + ProcessUtilities.normalExecutioner(command) BackupLogsMINIO(owner=plan, level='INFO', timeStamp=time.strftime("%b %d %Y, %H:%M:%S"), msg='Backup successful for ' + items.domain + '.').save() else: