mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-15 17:56:12 +01:00
bug fix to modsecurity, containerization and s3backups
This commit is contained in:
@@ -1068,11 +1068,14 @@ class FirewallManager:
|
|||||||
owaspInstalled = 0
|
owaspInstalled = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command = 'sudo cat /usr/local/lsws/conf/comodo_litespeed/rules.conf.main'
|
command = 'sudo ls /usr/local/lsws/conf/comodo_litespeed/'
|
||||||
res = ProcessUtilities.executioner(command)
|
output = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
if res == 1:
|
if output.find('No such') > -1:
|
||||||
|
comodoInstalled = 0
|
||||||
|
else:
|
||||||
comodoInstalled = 1
|
comodoInstalled = 1
|
||||||
|
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -24,18 +24,18 @@ class CronUtil:
|
|||||||
output = os.popen(cmd).read()
|
output = os.popen(cmd).read()
|
||||||
|
|
||||||
if "Exists" not in output:
|
if "Exists" not in output:
|
||||||
print "0,Not Exists"
|
print "0,CyberPanel,Not Exists"
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = subprocess.check_output(["sudo", "crontab", "-u", externalApp, "-l"])
|
f = subprocess.check_output(["sudo", "crontab", "-u", externalApp, "-l"])
|
||||||
print f
|
print f
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
print "0," + str(msg)
|
print "0,CyberPanel," + str(msg)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
print "0," + str(msg)
|
print "0,CyberPanel," + str(msg)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def saveCronChanges(externalApp, finalCron, line):
|
def saveCronChanges(externalApp, finalCron, line):
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf
|
|||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
str(msg) + " [installOWASP]")
|
str(msg) + " [installComodo]")
|
||||||
print "0," + str(msg)
|
print "0," + str(msg)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -474,6 +474,7 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/owasp/rules/RESPONSE-999-EXCL
|
|||||||
conf.writelines(items)
|
conf.writelines(items)
|
||||||
|
|
||||||
conf.close()
|
conf.close()
|
||||||
|
installUtilities.reStartLiteSpeed()
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
|
|
||||||
@@ -497,6 +498,7 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/owasp/rules/RESPONSE-999-EXCL
|
|||||||
conf.writelines(items)
|
conf.writelines(items)
|
||||||
|
|
||||||
conf.close()
|
conf.close()
|
||||||
|
installUtilities.reStartLiteSpeed()
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
|
|
||||||
|
|||||||
@@ -135,8 +135,8 @@ class ProcessUtilities(multi.Thread):
|
|||||||
def containerCheck():
|
def containerCheck():
|
||||||
try:
|
try:
|
||||||
command = 'sudo cat /etc/cgrules.conf'
|
command = 'sudo cat /etc/cgrules.conf'
|
||||||
result = subprocess.call(shlex.split(command))
|
output = ProcessUtilities.outputExecutioner(command)
|
||||||
if result == 1:
|
if output.find('No such') > -1:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -1005,7 +1005,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
f = ProcessUtilities.outputExecutioner(execPath)
|
f = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
if f.find("0,") > -1:
|
if f.find("0,CyberPanel,") > -1:
|
||||||
data_ret = {'getWebsiteCron': 0, "user": website.externalApp, "crons": {}}
|
data_ret = {'getWebsiteCron': 0, "user": website.externalApp, "crons": {}}
|
||||||
final_json = json.dumps(data_ret)
|
final_json = json.dumps(data_ret)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
@@ -1028,7 +1028,7 @@ class WebsiteManager:
|
|||||||
final_json = json.dumps(data_ret)
|
final_json = json.dumps(data_ret)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
print msg
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
dic = {'getWebsiteCron': 0, 'error_message': str(msg)}
|
dic = {'getWebsiteCron': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(dic)
|
json_data = json.dumps(dic)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|||||||
@@ -542,6 +542,10 @@ class S3Backups(multi.Thread):
|
|||||||
key,
|
key,
|
||||||
Config=config,
|
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"),
|
BackupLogs(owner=plan, level='INFO', timeStamp=time.strftime("%b %d %Y, %H:%M:%S"),
|
||||||
msg='Backup successful for ' + items.domain + '.').save()
|
msg='Backup successful for ' + items.domain + '.').save()
|
||||||
else:
|
else:
|
||||||
@@ -920,8 +924,11 @@ class S3Backups(multi.Thread):
|
|||||||
key,
|
key,
|
||||||
Config=config,
|
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"),
|
BackupLogsDO(owner=plan, level='INFO', timeStamp=time.strftime("%b %d %Y, %H:%M:%S"),
|
||||||
msg='Backup successful for ' + items.domain + '.').save()
|
msg='Backup successful for ' + items.domain + '.').save()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
BackupLogsDO(owner=plan, level='ERROR', timeStamp=time.strftime("%b %d %Y, %H:%M:%S"),
|
BackupLogsDO(owner=plan, level='ERROR', timeStamp=time.strftime("%b %d %Y, %H:%M:%S"),
|
||||||
msg='Backup failed for ' + items.domain + '. Error: ' + result[1]).save()
|
msg='Backup failed for ' + items.domain + '. Error: ' + result[1]).save()
|
||||||
@@ -1187,6 +1194,8 @@ class S3Backups(multi.Thread):
|
|||||||
key,
|
key,
|
||||||
Config=config,
|
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"),
|
BackupLogsMINIO(owner=plan, level='INFO', timeStamp=time.strftime("%b %d %Y, %H:%M:%S"),
|
||||||
msg='Backup successful for ' + items.domain + '.').save()
|
msg='Backup successful for ' + items.domain + '.').save()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user