mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
This commit is contained in:
@@ -1352,12 +1352,6 @@ Automatic backup failed for %s on %s.
|
||||
|
||||
except BaseException as msg:
|
||||
print("Version ID Error: %s"%str(msg))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
except BaseException as msg:
|
||||
print('%s. [SendToS3Cloud]' % (str(msg)))
|
||||
logging.writeToFile('%s. [SendToS3Cloud]' % (str(msg)))
|
||||
|
||||
@@ -547,21 +547,36 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/owasp-modsecurity-crs-3.0-mas
|
||||
@staticmethod
|
||||
def disableOWASP():
|
||||
try:
|
||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||
confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
confData = open(confFile).readlines()
|
||||
conf = open(confFile, 'w')
|
||||
|
||||
confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
confData = open(confFile).readlines()
|
||||
conf = open(confFile, 'w')
|
||||
for items in confData:
|
||||
if items.find('modsec/owasp') > -1:
|
||||
continue
|
||||
else:
|
||||
conf.writelines(items)
|
||||
|
||||
for items in confData:
|
||||
if items.find('modsec/owasp') > -1:
|
||||
continue
|
||||
else:
|
||||
conf.writelines(items)
|
||||
conf.close()
|
||||
installUtilities.reStartLiteSpeed()
|
||||
|
||||
conf.close()
|
||||
installUtilities.reStartLiteSpeed()
|
||||
print("1,None")
|
||||
else:
|
||||
confFile = os.path.join("/usr/local/lsws/conf/modsec.conf")
|
||||
confData = open(confFile).readlines()
|
||||
conf = open(confFile, 'w')
|
||||
|
||||
print("1,None")
|
||||
for items in confData:
|
||||
if items.find('modsec/owasp') > -1:
|
||||
continue
|
||||
else:
|
||||
conf.writelines(items)
|
||||
|
||||
conf.close()
|
||||
installUtilities.reStartLiteSpeed()
|
||||
|
||||
print("1,None")
|
||||
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
|
||||
@@ -1286,42 +1286,48 @@ class WebsiteManager:
|
||||
|
||||
RemoteBackupConfigobj = RemoteBackupConfig.objects.get(pk=RemoteConfigID)
|
||||
Rconfig = json.loads(RemoteBackupConfigobj.config)
|
||||
provider = Rconfig['Provider']
|
||||
if provider == "Backblaze":
|
||||
EndURl = Rconfig['EndUrl']
|
||||
elif provider == "Amazon":
|
||||
EndURl = "https://s3.us-east-1.amazonaws.com"
|
||||
elif provider == "Wasabi":
|
||||
EndURl = "https://s3.wasabisys.com"
|
||||
|
||||
AccessKey = Rconfig['AccessKey']
|
||||
SecertKey = Rconfig['SecertKey']
|
||||
|
||||
session = boto3.session.Session()
|
||||
|
||||
client = session.client(
|
||||
's3',
|
||||
endpoint_url=EndURl,
|
||||
aws_access_key_id=AccessKey,
|
||||
aws_secret_access_key=SecertKey,
|
||||
verify=False
|
||||
)
|
||||
|
||||
############Creating Bucket
|
||||
BucketName = randomPassword.generate_pass().lower()
|
||||
|
||||
try:
|
||||
client.create_bucket(Bucket=BucketName)
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile("Creating Bucket Error: %s" % str(msg))
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
#This code is only supposed to run if backups are s3, not for SFTP
|
||||
provider = Rconfig['Provider']
|
||||
if provider == "Backblaze":
|
||||
EndURl = Rconfig['EndUrl']
|
||||
elif provider == "Amazon":
|
||||
EndURl = "https://s3.us-east-1.amazonaws.com"
|
||||
elif provider == "Wasabi":
|
||||
EndURl = "https://s3.wasabisys.com"
|
||||
|
||||
config = {
|
||||
'BackupType': BackupType,
|
||||
'BucketName': BucketName
|
||||
}
|
||||
AccessKey = Rconfig['AccessKey']
|
||||
SecertKey = Rconfig['SecertKey']
|
||||
|
||||
session = boto3.session.Session()
|
||||
|
||||
client = session.client(
|
||||
's3',
|
||||
endpoint_url=EndURl,
|
||||
aws_access_key_id=AccessKey,
|
||||
aws_secret_access_key=SecertKey,
|
||||
verify=False
|
||||
)
|
||||
|
||||
############Creating Bucket
|
||||
BucketName = randomPassword.generate_pass().lower()
|
||||
|
||||
try:
|
||||
client.create_bucket(Bucket=BucketName)
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile("Creating Bucket Error: %s" % str(msg))
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
config = {
|
||||
'BackupType': BackupType,
|
||||
'BucketName': BucketName
|
||||
}
|
||||
except BaseException as msg:
|
||||
config = {}
|
||||
pass
|
||||
|
||||
svobj = RemoteBackupSchedule(RemoteBackupConfig=RemoteBackupConfigobj, Name=ScheduleName,
|
||||
timeintervel=Backfrequency, fileretention=FileRetention,
|
||||
|
||||
Reference in New Issue
Block a user