mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
centralized execution ph1
This commit is contained in:
52
api/views.py
52
api/views.py
@@ -21,6 +21,7 @@ from plogical.acl import ACLManager
|
|||||||
from firewall.models import FirewallRules
|
from firewall.models import FirewallRules
|
||||||
from s3Backups.s3Backups import S3Backups
|
from s3Backups.s3Backups import S3Backups
|
||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
|
from plogical.processUtilities import ProcessUtilities
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
|
||||||
@@ -120,8 +121,6 @@ def changeUserPassAPI(request):
|
|||||||
websiteOwn.password = hashPassword.hash_password(ownerPassword)
|
websiteOwn.password = hashPassword.hash_password(ownerPassword)
|
||||||
websiteOwn.save()
|
websiteOwn.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
data_ret = {'changeStatus': 1, 'error_message': "None"}
|
data_ret = {'changeStatus': 1, 'error_message': "None"}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
@@ -260,7 +259,7 @@ def fetchSSHkey(request):
|
|||||||
|
|
||||||
pubKey = os.path.join("/root",".ssh",'cyberpanel.pub')
|
pubKey = os.path.join("/root",".ssh",'cyberpanel.pub')
|
||||||
execPath = "sudo cat " + pubKey
|
execPath = "sudo cat " + pubKey
|
||||||
data = subprocess.check_output(shlex.split(execPath))
|
data = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
data_ret = {
|
data_ret = {
|
||||||
'status': 1,
|
'status': 1,
|
||||||
@@ -313,7 +312,7 @@ def remoteTransfer(request):
|
|||||||
|
|
||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
||||||
execPath = execPath + " remoteTransfer --ipAddress " + ipAddress + " --dir " + dir + " --accountsToTransfer " + path
|
execPath = execPath + " remoteTransfer --ipAddress " + ipAddress + " --dir " + dir + " --accountsToTransfer " + path
|
||||||
subprocess.Popen(shlex.split(execPath))
|
ProcessUtilities.popenExecutioner(execPath)
|
||||||
|
|
||||||
return HttpResponse(json.dumps({"transferStatus": 1, "dir": dir}))
|
return HttpResponse(json.dumps({"transferStatus": 1, "dir": dir}))
|
||||||
|
|
||||||
@@ -381,8 +380,8 @@ def FetchRemoteTransferStatus(request):
|
|||||||
dir = "/home/backup/transfer-"+str(data['dir'])+"/backup_log"
|
dir = "/home/backup/transfer-"+str(data['dir'])+"/backup_log"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command = "sudo cat "+ dir
|
execPath = "sudo cat "+ dir
|
||||||
status = subprocess.check_output(shlex.split(command))
|
status = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
admin = Administrator.objects.get(userName=username)
|
admin = Administrator.objects.get(userName=username)
|
||||||
if hashPassword.check_password(admin.password, password):
|
if hashPassword.check_password(admin.password, password):
|
||||||
@@ -418,14 +417,14 @@ def cancelRemoteTransfer(request):
|
|||||||
|
|
||||||
path = dir + "/pid"
|
path = dir + "/pid"
|
||||||
|
|
||||||
command = "sudo cat " + path
|
execPath = "sudo cat " + path
|
||||||
pid = subprocess.check_output(shlex.split(command))
|
pid = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
command = "sudo kill -KILL " + pid
|
execPath = "sudo kill -KILL " + pid
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
command = "sudo rm -rf " + dir
|
execPath = "sudo rm -rf " + dir
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
data = {'cancelStatus': 1, 'error_message': "None"}
|
data = {'cancelStatus': 1, 'error_message': "None"}
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
@@ -525,9 +524,8 @@ def putSSHkey(request):
|
|||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "sudo chmod g-w /home/cyberpanel"
|
execPath = "sudo chmod g-w /home/cyberpanel"
|
||||||
cmd = shlex.split(command)
|
ProcessUtilities.executioner(execPath)
|
||||||
res = subprocess.call(cmd)
|
|
||||||
|
|
||||||
os.chmod(keyPath,0700)
|
os.chmod(keyPath,0700)
|
||||||
os.chmod(authorized_keys, 0600)
|
os.chmod(authorized_keys, 0600)
|
||||||
@@ -590,30 +588,6 @@ def changeAdminPassword(request):
|
|||||||
newFWRule = FirewallRules(name="ftp", proto="tcp", port="21")
|
newFWRule = FirewallRules(name="ftp", proto="tcp", port="21")
|
||||||
newFWRule.save()
|
newFWRule.save()
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="smtp", proto="tcp", port="25")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="smtps", proto="tcp", port="587")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="ssmtp", proto="tcp", port="465")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="pop3", proto="tcp", port="110")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="imap", proto="tcp", port="143")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="simap", proto="tcp", port="993")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="dns", proto="udp", port="53")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="dnstcp", proto="tcp", port="53")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="ftptls", proto="tcp", port="40110-40210")
|
newFWRule = FirewallRules(name="ftptls", proto="tcp", port="40110-40210")
|
||||||
newFWRule.save()
|
newFWRule.save()
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ from random import randint
|
|||||||
import time
|
import time
|
||||||
import plogical.backupUtilities as backupUtil
|
import plogical.backupUtilities as backupUtil
|
||||||
import requests
|
import requests
|
||||||
|
from plogical.processUtilities import ProcessUtilities
|
||||||
|
|
||||||
class BackupManager:
|
class BackupManager:
|
||||||
def __init__(self, domain = None, childDomain = None):
|
def __init__(self, domain = None, childDomain = None):
|
||||||
@@ -61,7 +62,7 @@ class BackupManager:
|
|||||||
ext = ".tar.gz"
|
ext = ".tar.gz"
|
||||||
|
|
||||||
command = 'sudo chown -R cyberpanel:cyberpanel ' + path
|
command = 'sudo chown -R cyberpanel:cyberpanel ' + path
|
||||||
ACLManager.executeCall(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
files = os.listdir(path)
|
files = os.listdir(path)
|
||||||
for filename in files:
|
for filename in files:
|
||||||
@@ -144,7 +145,7 @@ class BackupManager:
|
|||||||
execPath = execPath + " submitBackupCreation --tempStoragePath " + tempStoragePath + " --backupName " \
|
execPath = execPath + " submitBackupCreation --tempStoragePath " + tempStoragePath + " --backupName " \
|
||||||
+ backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain
|
+ backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain
|
||||||
|
|
||||||
subprocess.Popen(shlex.split(execPath))
|
ProcessUtilities.popenExecutioner(execPath)
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
@@ -168,16 +169,16 @@ class BackupManager:
|
|||||||
## read file name
|
## read file name
|
||||||
|
|
||||||
try:
|
try:
|
||||||
command = "sudo cat " + backupFileNamePath
|
execPath = "sudo cat " + backupFileNamePath
|
||||||
fileName = subprocess.check_output(shlex.split(command))
|
fileName = ProcessUtilities.outputExecutioner(execPath)
|
||||||
except:
|
except:
|
||||||
fileName = "Fetching.."
|
fileName = "Fetching.."
|
||||||
|
|
||||||
## file name read ends
|
## file name read ends
|
||||||
|
|
||||||
if os.path.exists(status):
|
if os.path.exists(status):
|
||||||
command = "sudo cat " + status
|
execPath = "sudo cat " + status
|
||||||
status = subprocess.check_output(shlex.split(command))
|
status = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
if status.find("Completed") > -1:
|
if status.find("Completed") > -1:
|
||||||
|
|
||||||
@@ -201,14 +202,14 @@ class BackupManager:
|
|||||||
|
|
||||||
### Removing Files
|
### Removing Files
|
||||||
|
|
||||||
command = 'sudo rm -f ' + status
|
execPath = 'sudo rm -f ' + status
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
command = 'sudo rm -f ' + backupFileNamePath
|
execPath = 'sudo rm -f ' + backupFileNamePath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
command = 'sudo rm -f ' + pid
|
execPath = 'sudo rm -f ' + pid
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
final_json = json.dumps(
|
final_json = json.dumps(
|
||||||
{'backupStatus': 1, 'error_message': "None", "status": status, "abort": 1,
|
{'backupStatus': 1, 'error_message': "None", "status": status, "abort": 1,
|
||||||
@@ -218,14 +219,14 @@ class BackupManager:
|
|||||||
elif status.find("[5009]") > -1:
|
elif status.find("[5009]") > -1:
|
||||||
## removing status file, so that backup can re-run
|
## removing status file, so that backup can re-run
|
||||||
try:
|
try:
|
||||||
command = 'sudo rm -f ' + status
|
execPath = 'sudo rm -f ' + status
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
command = 'sudo rm -f ' + backupFileNamePath
|
execPath = 'sudo rm -f ' + backupFileNamePath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
command = 'sudo rm -f ' + pid
|
execPath = 'sudo rm -f ' + pid
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
backupObs = Backups.objects.filter(fileName=fileName)
|
backupObs = Backups.objects.filter(fileName=fileName)
|
||||||
for items in backupObs:
|
for items in backupObs:
|
||||||
@@ -260,10 +261,9 @@ class BackupManager:
|
|||||||
fileName = data['fileName']
|
fileName = data['fileName']
|
||||||
|
|
||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||||
|
|
||||||
execPath = execPath + " cancelBackupCreation --backupCancellationDomain " + backupCancellationDomain + " --fileName " + fileName
|
execPath = execPath + " cancelBackupCreation --backupCancellationDomain " + backupCancellationDomain + " --fileName " + fileName
|
||||||
|
|
||||||
subprocess.call(shlex.split(execPath))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
backupOb = Backups.objects.get(fileName=fileName)
|
backupOb = Backups.objects.get(fileName=fileName)
|
||||||
@@ -287,8 +287,8 @@ class BackupManager:
|
|||||||
domainName = backup.website.domain
|
domainName = backup.website.domain
|
||||||
|
|
||||||
path = "/home/" + domainName + "/backup/" + backup.fileName + ".tar.gz"
|
path = "/home/" + domainName + "/backup/" + backup.fileName + ".tar.gz"
|
||||||
command = 'sudo rm -f ' + path
|
execPath = 'sudo rm -f ' + path
|
||||||
ACLManager.executeCall(command)
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
backup.delete()
|
backup.delete()
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ class BackupManager:
|
|||||||
|
|
||||||
execPath = "sudo nice -n 10 python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
execPath = "sudo nice -n 10 python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||||
execPath = execPath + " submitRestore --backupFile " + backupFile + " --dir " + dir
|
execPath = execPath + " submitRestore --backupFile " + backupFile + " --dir " + dir
|
||||||
subprocess.Popen(shlex.split(execPath))
|
ProcessUtilities.popenExecutioner(execPath)
|
||||||
time.sleep(4)
|
time.sleep(4)
|
||||||
|
|
||||||
final_dic = {'restoreStatus': 1, 'error_message': "None"}
|
final_dic = {'restoreStatus': 1, 'error_message': "None"}
|
||||||
@@ -340,12 +340,12 @@ class BackupManager:
|
|||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
try:
|
try:
|
||||||
execPath = "sudo cat " + path + "/status"
|
execPath = "sudo cat " + path + "/status"
|
||||||
status = subprocess.check_output(shlex.split(execPath))
|
status = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
if status.find("Done") > -1:
|
if status.find("Done") > -1:
|
||||||
|
|
||||||
command = "sudo rm -rf " + path
|
execPath = "sudo rm -rf " + path
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
final_json = json.dumps(
|
final_json = json.dumps(
|
||||||
{'restoreStatus': 1, 'error_message': "None", "status": status, 'abort': 1,
|
{'restoreStatus': 1, 'error_message': "None", "status": status, 'abort': 1,
|
||||||
@@ -353,8 +353,8 @@ class BackupManager:
|
|||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
elif status.find("[5009]") > -1:
|
elif status.find("[5009]") > -1:
|
||||||
## removing temporarily generated files while restoring
|
## removing temporarily generated files while restoring
|
||||||
command = "sudo rm -rf " + path
|
execPath = "sudo rm -rf " + path
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
final_json = json.dumps({'restoreStatus': 1, 'error_message': "None",
|
final_json = json.dumps({'restoreStatus': 1, 'error_message': "None",
|
||||||
"status": status, 'abort': 1, 'alreadyRunning': 0,
|
"status": status, 'abort': 1, 'alreadyRunning': 0,
|
||||||
'running': 'Error'})
|
'running': 'Error'})
|
||||||
@@ -428,7 +428,7 @@ class BackupManager:
|
|||||||
execPath = execPath + " submitDestinationCreation --ipAddress " + ipAddress + " --password " \
|
execPath = execPath + " submitDestinationCreation --ipAddress " + ipAddress + " --password " \
|
||||||
+ password + " --port " + port
|
+ password + " --port " + port
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
if output.find('1,') > -1:
|
if output.find('1,') > -1:
|
||||||
try:
|
try:
|
||||||
@@ -506,7 +506,7 @@ class BackupManager:
|
|||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||||
execPath = execPath + " getConnectionStatus --ipAddress " + ipAddress
|
execPath = execPath + " getConnectionStatus --ipAddress " + ipAddress
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
if output.find('1,') > -1:
|
if output.find('1,') > -1:
|
||||||
final_dic = {'connStatus': 1, 'error_message': "None"}
|
final_dic = {'connStatus': 1, 'error_message': "None"}
|
||||||
@@ -664,9 +664,8 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
ProcessUtilities.executioner(execPath)
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
||||||
@@ -686,9 +685,9 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
||||||
@@ -708,9 +707,9 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
||||||
@@ -730,9 +729,8 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
ProcessUtilities.executioner(execPath)
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
||||||
@@ -752,9 +750,8 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
ProcessUtilities.executioner(execPath)
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
||||||
@@ -774,9 +771,8 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
ProcessUtilities.executioner(execPath)
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
||||||
@@ -796,9 +792,9 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
||||||
@@ -818,9 +814,9 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules(dest=destination, frequency=backupFreq)
|
||||||
@@ -862,9 +858,9 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules.objects.get(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules.objects.get(dest=destination, frequency=backupFreq)
|
||||||
@@ -890,9 +886,9 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules.objects.get(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules.objects.get(dest=destination, frequency=backupFreq)
|
||||||
@@ -918,9 +914,9 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules.objects.get(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules.objects.get(dest=destination, frequency=backupFreq)
|
||||||
@@ -946,9 +942,9 @@ class BackupManager:
|
|||||||
|
|
||||||
virtualHostUtilities.leaveControl(path)
|
virtualHostUtilities.leaveControl(path)
|
||||||
|
|
||||||
command = "sudo systemctl restart crond"
|
execPath = "sudo systemctl restart crond"
|
||||||
|
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
destination = dest.objects.get(destLoc=backupDest)
|
destination = dest.objects.get(destLoc=backupDest)
|
||||||
newSchedule = backupSchedules.objects.get(dest=destination, frequency=backupFreq)
|
newSchedule = backupSchedules.objects.get(dest=destination, frequency=backupFreq)
|
||||||
@@ -1054,7 +1050,7 @@ class BackupManager:
|
|||||||
|
|
||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
||||||
execPath = execPath + " writeAuthKey --pathToKey " + pathToKey
|
execPath = execPath + " writeAuthKey --pathToKey " + pathToKey
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
pass
|
pass
|
||||||
@@ -1129,8 +1125,8 @@ class BackupManager:
|
|||||||
localBackupDir = os.path.join("/home", "backup")
|
localBackupDir = os.path.join("/home", "backup")
|
||||||
|
|
||||||
if not os.path.exists(localBackupDir):
|
if not os.path.exists(localBackupDir):
|
||||||
command = "sudo mkdir " + localBackupDir
|
execPath = "sudo mkdir " + localBackupDir
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
## create local directory that will host backups
|
## create local directory that will host backups
|
||||||
|
|
||||||
@@ -1138,8 +1134,8 @@ class BackupManager:
|
|||||||
|
|
||||||
## making local storage directory for backups
|
## making local storage directory for backups
|
||||||
|
|
||||||
command = "sudo mkdir " + localStoragePath
|
execPath = "sudo mkdir " + localStoragePath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
final_json = json.dumps(
|
final_json = json.dumps(
|
||||||
{'remoteTransferStatus': 1, 'error_message': "None", "dir": data['dir']})
|
{'remoteTransferStatus': 1, 'error_message': "None", "dir": data['dir']})
|
||||||
@@ -1223,7 +1219,7 @@ class BackupManager:
|
|||||||
execPath = execPath + " remoteBackupRestore --backupDirComplete " + backupDirComplete + " --backupDir " + str(
|
execPath = execPath + " remoteBackupRestore --backupDirComplete " + backupDirComplete + " --backupDir " + str(
|
||||||
backupDir)
|
backupDir)
|
||||||
|
|
||||||
subprocess.Popen(shlex.split(execPath))
|
ProcessUtilities.popenExecutioner(execPath)
|
||||||
|
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
@@ -1253,18 +1249,18 @@ class BackupManager:
|
|||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
if os.path.isfile(backupLogPath):
|
if os.path.isfile(backupLogPath):
|
||||||
command = "sudo cat " + backupLogPath
|
execPath = "sudo cat " + backupLogPath
|
||||||
status = subprocess.check_output(shlex.split(command))
|
status = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
if status.find("completed[success]") > -1:
|
if status.find("completed[success]") > -1:
|
||||||
command = "sudo rm -rf " + removalPath
|
command = "sudo rm -rf " + removalPath
|
||||||
# subprocess.call(shlex.split(command))
|
# ProcessUtilities.executioner(shlex.split(command))
|
||||||
data_ret = {'remoteTransferStatus': 1, 'error_message': "None", "status": status, "complete": 1}
|
data_ret = {'remoteTransferStatus': 1, 'error_message': "None", "status": status, "complete": 1}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
elif status.find("[5010]") > -1:
|
elif status.find("[5010]") > -1:
|
||||||
command = "sudo rm -rf " + removalPath
|
command = "sudo rm -rf " + removalPath
|
||||||
# subprocess.call(shlex.split(command))
|
# ProcessUtilities.executioner(shlex.split(command))
|
||||||
data = {'remoteTransferStatus': 0, 'error_message': status,
|
data = {'remoteTransferStatus': 0, 'error_message': status,
|
||||||
"status": "None", "complete": 0}
|
"status": "None", "complete": 0}
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
@@ -1311,14 +1307,14 @@ class BackupManager:
|
|||||||
path = "/home/backup/transfer-" + str(dir)
|
path = "/home/backup/transfer-" + str(dir)
|
||||||
pathpid = path + "/pid"
|
pathpid = path + "/pid"
|
||||||
|
|
||||||
command = "sudo cat " + pathpid
|
execPath = "sudo cat " + pathpid
|
||||||
pid = subprocess.check_output(shlex.split(command))
|
pid = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
command = "sudo kill -KILL " + pid
|
execPath = "sudo kill -KILL " + pid
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
command = "sudo rm -rf " + path
|
execPath = "sudo rm -rf " + path
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
data = {'cancelStatus': 1, 'error_message': "None"}
|
data = {'cancelStatus': 1, 'error_message': "None"}
|
||||||
json_data = json.dumps(data)
|
json_data = json.dumps(data)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import shlex
|
|||||||
import os
|
import os
|
||||||
import plogical.CyberCPLogFileWriter as logging
|
import plogical.CyberCPLogFileWriter as logging
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
|
from plogical.processUtilities import ProcessUtilities
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ def upgrade(request):
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
vers = version.objects.get(pk=1)
|
vers = version.objects.get(pk=1)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
from plogical.processUtilities import ProcessUtilities
|
||||||
class cliLogger:
|
class cliLogger:
|
||||||
fileName = "/home/cyberpanel/error-logs.txt"
|
fileName = "/home/cyberpanel/error-logs.txt"
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ class cliLogger:
|
|||||||
def readLastNFiles(numberOfLines,fileName):
|
def readLastNFiles(numberOfLines,fileName):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
lastFewLines = subprocess.check_output(["tail", "-n",str(numberOfLines),fileName])
|
lastFewLines = ProcessUtilities.outputExecutioner(["tail", "-n",str(numberOfLines),fileName])
|
||||||
|
|
||||||
return lastFewLines
|
return lastFewLines
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class CloudManager:
|
|||||||
'domainName'] + " --bandwidth " + str(
|
'domainName'] + " --bandwidth " + str(
|
||||||
website.package.bandwidth)
|
website.package.bandwidth)
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(execPath)
|
||||||
bwData = output.split(",")
|
bwData = output.split(",")
|
||||||
except BaseException:
|
except BaseException:
|
||||||
bwData = [0, 0]
|
bwData = [0, 0]
|
||||||
@@ -319,8 +319,8 @@ class CloudManager:
|
|||||||
lastLine = statusData[-1]
|
lastLine = statusData[-1]
|
||||||
|
|
||||||
if lastLine.find('[200]') > -1:
|
if lastLine.find('[200]') > -1:
|
||||||
command = 'sudo rm -f ' + statusFile
|
execPath = 'sudo rm -f ' + statusFile
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.outputExecutioner(execPath)
|
||||||
data_ret = {'status': 1, 'abort': 1, 'installationProgress': "100", 'currentStatus': lastLine}
|
data_ret = {'status': 1, 'abort': 1, 'installationProgress': "100", 'currentStatus': lastLine}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
@@ -794,7 +794,7 @@ class CloudManager:
|
|||||||
try:
|
try:
|
||||||
pubKey = os.path.join("/root", ".ssh", 'cyberpanel.pub')
|
pubKey = os.path.join("/root", ".ssh", 'cyberpanel.pub')
|
||||||
execPath = "sudo cat " + pubKey
|
execPath = "sudo cat " + pubKey
|
||||||
data = subprocess.check_output(shlex.split(execPath))
|
data = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
data_ret = {
|
data_ret = {
|
||||||
'status': 1,
|
'status': 1,
|
||||||
@@ -1053,9 +1053,11 @@ class CloudManager:
|
|||||||
|
|
||||||
|
|
||||||
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
finalData['conf'] = subprocess.check_output(shlex.split('sudo cat /etc/my.cnf'))
|
execPath = 'sudo cat /etc/my.cnf'
|
||||||
|
finalData['conf'] = ProcessUtilities.outputExecutioner(execPath)
|
||||||
else:
|
else:
|
||||||
finalData['conf'] = subprocess.check_output(shlex.split('sudo cat /etc/mysql/my.cnf'))
|
execPath = 'sudo cat /etc/mysql/my.cnf'
|
||||||
|
finalData['conf'] = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
finalData['status'] = 1
|
finalData['status'] = 1
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ def saveWebsiteLimits(request):
|
|||||||
cgrules = '/etc/cgrules.conf'
|
cgrules = '/etc/cgrules.conf'
|
||||||
enforceString = '{} cpu,memory,blkio,net_cls {}/\n'.format(website.externalApp, website.externalApp)
|
enforceString = '{} cpu,memory,blkio,net_cls {}/\n'.format(website.externalApp, website.externalApp)
|
||||||
|
|
||||||
cgrulesData = subprocess.check_output(shlex.split('sudo cat /etc/cgrules.conf')).splitlines()
|
cgrulesData = ProcessUtilities.outputExecutioner(shlex.split('sudo cat /etc/cgrules.conf')).splitlines()
|
||||||
|
|
||||||
writeToFile = open(cgrulesTemp, 'w')
|
writeToFile = open(cgrulesTemp, 'w')
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ def saveWebsiteLimits(request):
|
|||||||
cgrulesTemp = "/home/cyberpanel/" + str(randint(1000, 9999))
|
cgrulesTemp = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||||
cgrules = '/etc/cgrules.conf'
|
cgrules = '/etc/cgrules.conf'
|
||||||
|
|
||||||
cgrulesData = subprocess.check_output(shlex.split('sudo cat /etc/cgrules.conf')).splitlines()
|
cgrulesData = ProcessUtilities.outputExecutioner(shlex.split('sudo cat /etc/cgrules.conf')).splitlines()
|
||||||
|
|
||||||
writeToFile = open(cgrulesTemp, 'w')
|
writeToFile = open(cgrulesTemp, 'w')
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ def getUsageData(request):
|
|||||||
if type == 'memory':
|
if type == 'memory':
|
||||||
|
|
||||||
command = 'sudo cat /sys/fs/cgroup/memory/' + website.externalApp + '/memory.usage_in_bytes'
|
command = 'sudo cat /sys/fs/cgroup/memory/' + website.externalApp + '/memory.usage_in_bytes'
|
||||||
output = str(subprocess.check_output(command, shell=True))
|
output = str(ProcessUtilities.outputExecutioner(command, shell=True))
|
||||||
finalData['memory'] = int(float(output)/float(1024 * 1024))
|
finalData['memory'] = int(float(output)/float(1024 * 1024))
|
||||||
|
|
||||||
elif type == 'io':
|
elif type == 'io':
|
||||||
@@ -305,7 +305,7 @@ def getUsageData(request):
|
|||||||
os.mkdir(path)
|
os.mkdir(path)
|
||||||
|
|
||||||
command = 'sudo cat /sys/fs/cgroup/blkio/' + website.externalApp + '/blkio.throttle.io_service_bytes'
|
command = 'sudo cat /sys/fs/cgroup/blkio/' + website.externalApp + '/blkio.throttle.io_service_bytes'
|
||||||
output = subprocess.check_output(command, shell=True).splitlines()
|
output = ProcessUtilities.outputExecutioner(command, shell=True).splitlines()
|
||||||
|
|
||||||
readCurrent = output[0].split(' ')[2]
|
readCurrent = output[0].split(' ')[2]
|
||||||
writeCurrent = output[1].split(' ')[2]
|
writeCurrent = output[1].split(' ')[2]
|
||||||
@@ -333,7 +333,7 @@ def getUsageData(request):
|
|||||||
finalData['writeRate'] = 0
|
finalData['writeRate'] = 0
|
||||||
except:
|
except:
|
||||||
command = "sudo top -b -n 1 -u " + website.externalApp + " | awk 'NR>7 { sum += $9; } END { print sum; }'"
|
command = "sudo top -b -n 1 -u " + website.externalApp + " | awk 'NR>7 { sum += $9; } END { print sum; }'"
|
||||||
output = str(subprocess.check_output(command, shell=True))
|
output = str(ProcessUtilities.outputExecutioner(command, shell=True))
|
||||||
|
|
||||||
finalData = {}
|
finalData = {}
|
||||||
if len(output) == 0:
|
if len(output) == 0:
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import plogical.CyberCPLogFileWriter as logging
|
|||||||
from plogical.mysqlUtilities import mysqlUtilities
|
from plogical.mysqlUtilities import mysqlUtilities
|
||||||
from websiteFunctions.models import Websites
|
from websiteFunctions.models import Websites
|
||||||
from databases.models import Databases
|
from databases.models import Databases
|
||||||
|
from plogical.processUtilities import ProcessUtilities
|
||||||
|
|
||||||
class DatabaseManager:
|
class DatabaseManager:
|
||||||
|
|
||||||
@@ -174,7 +175,7 @@ class DatabaseManager:
|
|||||||
|
|
||||||
command = 'sudo mysql -u root -p' + password + ' -e "' + passwordCMD + '"'
|
command = 'sudo mysql -u root -p' + password + ' -e "' + passwordCMD + '"'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
data_ret = {'status': 0, 'changePasswordStatus': 0,'error_message': "Please see CyberPanel main log file."}
|
data_ret = {'status': 0, 'changePasswordStatus': 0,'error_message': "Please see CyberPanel main log file."}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class ContainerManager(multi.Thread):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def executioner(command, statusFile):
|
def executioner(command, statusFile):
|
||||||
try:
|
try:
|
||||||
res = subprocess.call(shlex.split(command), stdout=statusFile, stderr=statusFile)
|
res = ProcessUtilities.executioner(shlex.split(command), stdout=statusFile, stderr=statusFile)
|
||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import socket, smtplib
|
|||||||
import DNS
|
import DNS
|
||||||
from random import randint
|
from random import randint
|
||||||
import subprocess, shlex
|
import subprocess, shlex
|
||||||
|
from plogical.processUtilities import ProcessUtilities
|
||||||
|
|
||||||
|
|
||||||
class emailMarketing(multi.Thread):
|
class emailMarketing(multi.Thread):
|
||||||
@@ -212,7 +213,7 @@ class emailMarketing(multi.Thread):
|
|||||||
messageFile.close()
|
messageFile.close()
|
||||||
|
|
||||||
command = "sudo sed -i 's/{{ unsubscribeCheck }}/" + removalLink + "/g' " + tempPath
|
command = "sudo sed -i 's/{{ unsubscribeCheck }}/" + removalLink + "/g' " + tempPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
messageFile = open(tempPath, 'r')
|
messageFile = open(tempPath, 'r')
|
||||||
finalMessage = messageFile.read()
|
finalMessage = messageFile.read()
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def fetchPolicyServerStatus(request):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
command = 'sudo cat /etc/postfix/main.cf'
|
command = 'sudo cat /etc/postfix/main.cf'
|
||||||
output = subprocess.check_output(shlex.split(command)).split('\n')
|
output = ProcessUtilities.outputExecutioner(shlex.split(command)).split('\n')
|
||||||
|
|
||||||
installCheck = 0
|
installCheck = 0
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ def savePolicyServerStatus(request):
|
|||||||
|
|
||||||
execPath = execPath + " savePolicyServerStatus --install " + install
|
execPath = execPath + " savePolicyServerStatus --install " + install
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'status': 1, 'error_message': "None"}
|
data_ret = {'status': 1, 'error_message': "None"}
|
||||||
@@ -148,7 +148,7 @@ def listDomains(request):
|
|||||||
## Check if Policy Server is installed.
|
## Check if Policy Server is installed.
|
||||||
|
|
||||||
command = 'sudo cat /etc/postfix/main.cf'
|
command = 'sudo cat /etc/postfix/main.cf'
|
||||||
output = subprocess.check_output(shlex.split(command)).split('\n')
|
output = ProcessUtilities.outputExecutioner(shlex.split(command)).split('\n')
|
||||||
|
|
||||||
installCheck = 0
|
installCheck = 0
|
||||||
|
|
||||||
@@ -806,7 +806,7 @@ def installStatusSpamAssassin(request):
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
|
||||||
command = "sudo cat " + mailUtilities.spamassassinInstallLogPath
|
command = "sudo cat " + mailUtilities.spamassassinInstallLogPath
|
||||||
installStatus = subprocess.check_output(shlex.split(command))
|
installStatus = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
if installStatus.find("[200]")>-1:
|
if installStatus.find("[200]")>-1:
|
||||||
|
|
||||||
@@ -814,7 +814,7 @@ def installStatusSpamAssassin(request):
|
|||||||
|
|
||||||
execPath = execPath + " configureSpamAssassin"
|
execPath = execPath + " configureSpamAssassin"
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
pass
|
pass
|
||||||
@@ -884,7 +884,7 @@ def fetchSpamAssassinSettings(request):
|
|||||||
|
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
|
|
||||||
data = subprocess.check_output(shlex.split(command)).splitlines()
|
data = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
for items in data:
|
for items in data:
|
||||||
if items.find('report_safe ') > -1:
|
if items.find('report_safe ') > -1:
|
||||||
@@ -987,7 +987,7 @@ def saveSpamAssassinConfigurations(request):
|
|||||||
|
|
||||||
execPath = execPath + " saveSpamAssassinConfigs --tempConfigPath " + tempConfigPath
|
execPath = execPath + " saveSpamAssassinConfigs --tempConfigPath " + tempConfigPath
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'saveStatus': 1, 'error_message': "None"}
|
data_ret = {'saveStatus': 1, 'error_message': "None"}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class FileManager:
|
|||||||
return self.ajaxPre(0, 'Not allowed to browse this path, going back home!')
|
return self.ajaxPre(0, 'Not allowed to browse this path, going back home!')
|
||||||
|
|
||||||
command = "sudo ls -la --group-directories-first " + self.returnPathEnclosed(self.data['completeStartingPath'])
|
command = "sudo ls -la --group-directories-first " + self.returnPathEnclosed(self.data['completeStartingPath'])
|
||||||
output = subprocess.check_output(shlex.split(command)).splitlines()
|
output = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
for items in output:
|
for items in output:
|
||||||
@@ -72,7 +72,7 @@ class FileManager:
|
|||||||
finalData['status'] = 1
|
finalData['status'] = 1
|
||||||
|
|
||||||
command = "sudo ls -la --group-directories-first " + self.returnPathEnclosed(self.data['completeStartingPath'])
|
command = "sudo ls -la --group-directories-first " + self.returnPathEnclosed(self.data['completeStartingPath'])
|
||||||
output = subprocess.check_output(shlex.split(command)).splitlines()
|
output = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
for items in output:
|
for items in output:
|
||||||
@@ -225,7 +225,7 @@ class FileManager:
|
|||||||
|
|
||||||
command = 'sudo cat ' + self.returnPathEnclosed(self.data['fileName'])
|
command = 'sudo cat ' + self.returnPathEnclosed(self.data['fileName'])
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
finalData['fileContents'] = subprocess.check_output(shlex.split(command))
|
finalData['fileContents'] = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
json_data = json.dumps(finalData)
|
json_data = json.dumps(finalData)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ def changePermissions(request):
|
|||||||
externalApp = website.externalApp
|
externalApp = website.externalApp
|
||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp +" /home/"+domainName
|
command = "sudo chown -R " + externalApp + ":" + externalApp +" /home/"+domainName
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "sudo chown -R lscpd:lscpd /home/" + domainName+"/logs"
|
command = "sudo chown -R lscpd:lscpd /home/" + domainName+"/logs"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
data_ret = {'permissionsChanged': 1, 'error_message': "None"}
|
data_ret = {'permissionsChanged': 1, 'error_message': "None"}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
command = 'sudo firewall-cmd --reload'
|
command = 'sudo firewall-cmd --reload'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 0:
|
if res == 0:
|
||||||
final_dic = {'reload_status': 1, 'error_message': "None"}
|
final_dic = {'reload_status': 1, 'error_message': "None"}
|
||||||
@@ -194,7 +194,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 0:
|
if res == 0:
|
||||||
final_dic = {'start_status': 1, 'error_message': "None"}
|
final_dic = {'start_status': 1, 'error_message': "None"}
|
||||||
@@ -223,7 +223,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
command = 'sudo systemctl stop firewalld'
|
command = 'sudo systemctl stop firewalld'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 0:
|
if res == 0:
|
||||||
final_dic = {'stop_status': 1, 'error_message': "None"}
|
final_dic = {'stop_status': 1, 'error_message': "None"}
|
||||||
@@ -252,7 +252,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
command = 'sudo systemctl status firewalld'
|
command = 'sudo systemctl status firewalld'
|
||||||
|
|
||||||
status = subprocess.check_output(shlex.split(command))
|
status = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
if status.find("active") > -1:
|
if status.find("active") > -1:
|
||||||
final_dic = {'status': 1, 'error_message': "none", 'firewallStatus': 1}
|
final_dic = {'status': 1, 'error_message': "none", 'firewallStatus': 1}
|
||||||
@@ -301,7 +301,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
pathToSSH = "/etc/ssh/sshd_config"
|
pathToSSH = "/etc/ssh/sshd_config"
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
final_dic = {'status': 1, 'permitRootLogin': permitRootLogin, 'sshPort': sshPort}
|
final_dic = {'status': 1, 'permitRootLogin': permitRootLogin, 'sshPort': sshPort}
|
||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
@@ -337,7 +337,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
pathToKeyFile = "/root/.ssh/authorized_keys"
|
pathToKeyFile = "/root/.ssh/authorized_keys"
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
command = 'sudo chown -R root:root /root'
|
command = 'sudo chown -R root:root /root'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
@@ -406,7 +406,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
command = 'sudo semanage port -a -t ssh_port_t -p tcp ' + sshPort
|
command = 'sudo semanage port -a -t ssh_port_t -p tcp ' + sshPort
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
FirewallUtilities.addRule('tcp', sshPort, "0.0.0.0/0")
|
FirewallUtilities.addRule('tcp', sshPort, "0.0.0.0/0")
|
||||||
|
|
||||||
@@ -428,7 +428,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
## changin back permissions
|
## changin back permissions
|
||||||
|
|
||||||
@@ -469,7 +469,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -499,7 +499,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -524,7 +524,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -554,7 +554,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -597,7 +597,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -624,7 +624,7 @@ class FirewallManager:
|
|||||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||||
|
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
httpdConfig = subprocess.check_output(shlex.split(command)).splitlines()
|
httpdConfig = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
modSecInstalled = 0
|
modSecInstalled = 0
|
||||||
|
|
||||||
@@ -669,7 +669,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = execPath + " installModSecConfigs"
|
execPath = execPath + " installModSecConfigs"
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
pass
|
pass
|
||||||
@@ -738,7 +738,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
if os.path.exists(modSecPath):
|
if os.path.exists(modSecPath):
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
data = subprocess.check_output(shlex.split(command)).splitlines()
|
data = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
for items in data:
|
for items in data:
|
||||||
|
|
||||||
@@ -803,7 +803,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
|
|
||||||
data = subprocess.check_output(shlex.split(command)).splitlines()
|
data = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
for items in data:
|
for items in data:
|
||||||
if items.find('SecAuditEngine ') > -1:
|
if items.find('SecAuditEngine ') > -1:
|
||||||
@@ -917,7 +917,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = execPath + " saveModSecConfigs --tempConfigPath " + tempConfigPath
|
execPath = execPath + " saveModSecConfigs --tempConfigPath " + tempConfigPath
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
@@ -973,7 +973,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = execPath + " saveModSecConfigs --tempConfigPath " + tempConfigPath
|
execPath = execPath + " saveModSecConfigs --tempConfigPath " + tempConfigPath
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
@@ -1004,7 +1004,7 @@ class FirewallManager:
|
|||||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||||
|
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
httpdConfig = subprocess.check_output(shlex.split(command)).splitlines()
|
httpdConfig = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
modSecInstalled = 0
|
modSecInstalled = 0
|
||||||
|
|
||||||
@@ -1034,7 +1034,7 @@ class FirewallManager:
|
|||||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||||
|
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
httpdConfig = subprocess.check_output(shlex.split(command)).splitlines()
|
httpdConfig = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
modSecInstalled = 0
|
modSecInstalled = 0
|
||||||
|
|
||||||
@@ -1047,7 +1047,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
if modSecInstalled:
|
if modSecInstalled:
|
||||||
command = "sudo cat " + rulesPath
|
command = "sudo cat " + rulesPath
|
||||||
currentModSecRules = subprocess.check_output(shlex.split(command))
|
currentModSecRules = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
final_dic = {'modSecInstalled': 1,
|
final_dic = {'modSecInstalled': 1,
|
||||||
'currentModSecRules': currentModSecRules}
|
'currentModSecRules': currentModSecRules}
|
||||||
@@ -1063,7 +1063,7 @@ class FirewallManager:
|
|||||||
rulesPath = os.path.join(virtualHostUtilities.Server_root + "/conf/rules.conf")
|
rulesPath = os.path.join(virtualHostUtilities.Server_root + "/conf/rules.conf")
|
||||||
|
|
||||||
command = "sudo cat " + rulesPath
|
command = "sudo cat " + rulesPath
|
||||||
currentModSecRules = subprocess.check_output(shlex.split(command))
|
currentModSecRules = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
final_dic = {'modSecInstalled': 1,
|
final_dic = {'modSecInstalled': 1,
|
||||||
'currentModSecRules': currentModSecRules}
|
'currentModSecRules': currentModSecRules}
|
||||||
@@ -1098,7 +1098,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py"
|
||||||
execPath = execPath + " saveModSecRules"
|
execPath = execPath + " saveModSecRules"
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
@@ -1130,7 +1130,7 @@ class FirewallManager:
|
|||||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||||
|
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
httpdConfig = subprocess.check_output(shlex.split(command)).splitlines()
|
httpdConfig = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
modSecInstalled = 0
|
modSecInstalled = 0
|
||||||
|
|
||||||
@@ -1160,7 +1160,7 @@ class FirewallManager:
|
|||||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||||
|
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
httpdConfig = subprocess.check_output(shlex.split(command)).splitlines()
|
httpdConfig = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
modSecInstalled = 0
|
modSecInstalled = 0
|
||||||
|
|
||||||
@@ -1174,7 +1174,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
if modSecInstalled:
|
if modSecInstalled:
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
httpdConfig = subprocess.check_output(shlex.split(command)).splitlines()
|
httpdConfig = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
for items in httpdConfig:
|
for items in httpdConfig:
|
||||||
|
|
||||||
@@ -1205,7 +1205,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
command = 'sudo cat /usr/local/lsws/conf/comodo_litespeed/rules.conf.main'
|
command = 'sudo cat /usr/local/lsws/conf/comodo_litespeed/rules.conf.main'
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if res == 0:
|
if res == 0:
|
||||||
comodoInstalled = 1
|
comodoInstalled = 1
|
||||||
@@ -1242,7 +1242,7 @@ class FirewallManager:
|
|||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py"
|
||||||
execPath = execPath + " " + packName
|
execPath = execPath + " " + packName
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
@@ -1260,7 +1260,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py"
|
||||||
execPath = execPath + " " + packName
|
execPath = execPath + " " + packName
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
@@ -1292,7 +1292,7 @@ class FirewallManager:
|
|||||||
confPath = os.path.join(virtualHostUtilities.Server_root, 'conf/httpd_config.conf')
|
confPath = os.path.join(virtualHostUtilities.Server_root, 'conf/httpd_config.conf')
|
||||||
|
|
||||||
command = "sudo cat " + confPath
|
command = "sudo cat " + confPath
|
||||||
httpdConfig = subprocess.check_output(shlex.split(command)).splitlines()
|
httpdConfig = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
json_data = "["
|
json_data = "["
|
||||||
checker = 0
|
checker = 0
|
||||||
@@ -1334,7 +1334,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
comodoPath = '/usr/local/lsws/conf/comodo_litespeed'
|
comodoPath = '/usr/local/lsws/conf/comodo_litespeed'
|
||||||
command = 'sudo chown -R cyberpanel:cyberpanel /usr/local/lsws/conf'
|
command = 'sudo chown -R cyberpanel:cyberpanel /usr/local/lsws/conf'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
json_data = "["
|
json_data = "["
|
||||||
|
|
||||||
@@ -1370,7 +1370,7 @@ class FirewallManager:
|
|||||||
json_data = json_data + ',' + json.dumps(dic)
|
json_data = json_data + ',' + json.dumps(dic)
|
||||||
|
|
||||||
command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
|
command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
json_data = json_data + ']'
|
json_data = json_data + ']'
|
||||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||||
@@ -1403,7 +1403,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = execPath + " " + functionName + ' --packName ' + packName + ' --fileName ' + fileName
|
execPath = execPath + " " + functionName + ' --packName ' + packName + ' --fileName ' + fileName
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
@@ -1433,7 +1433,7 @@ class FirewallManager:
|
|||||||
csfInstalled = 1
|
csfInstalled = 1
|
||||||
try:
|
try:
|
||||||
command = 'sudo csf -h'
|
command = 'sudo csf -h'
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
if res == 1:
|
if res == 1:
|
||||||
csfInstalled = 0
|
csfInstalled = 0
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
@@ -1454,7 +1454,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
||||||
execPath = execPath + " installCSF"
|
execPath = execPath + " installCSF"
|
||||||
subprocess.Popen(shlex.split(execPath))
|
ProcessUtilities.popenExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
@@ -1477,7 +1477,7 @@ class FirewallManager:
|
|||||||
if installStatus.find("[200]")>-1:
|
if installStatus.find("[200]")>-1:
|
||||||
|
|
||||||
command = 'sudo rm -f ' + CSF.installLogPath
|
command = 'sudo rm -f ' + CSF.installLogPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
final_json = json.dumps({
|
final_json = json.dumps({
|
||||||
'error_message': "None",
|
'error_message': "None",
|
||||||
@@ -1488,7 +1488,7 @@ class FirewallManager:
|
|||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
elif installStatus.find("[404]") > -1:
|
elif installStatus.find("[404]") > -1:
|
||||||
command = 'sudo rm -f ' + CSF.installLogPath
|
command = 'sudo rm -f ' + CSF.installLogPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
final_json = json.dumps({
|
final_json = json.dumps({
|
||||||
'abort':1,
|
'abort':1,
|
||||||
'installed':0,
|
'installed':0,
|
||||||
@@ -1522,7 +1522,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
||||||
execPath = execPath + " removeCSF"
|
execPath = execPath + " removeCSF"
|
||||||
subprocess.Popen(shlex.split(execPath))
|
ProcessUtilities.popenExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
@@ -1581,7 +1581,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
||||||
execPath = execPath + " changeStatus --controller " + controller + " --status " + status
|
execPath = execPath + " changeStatus --controller " + controller + " --status " + status
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {"status": 1}
|
data_ret = {"status": 1}
|
||||||
@@ -1615,7 +1615,7 @@ class FirewallManager:
|
|||||||
|
|
||||||
execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py"
|
||||||
execPath = execPath + " modifyPorts --protocol " + protocol + " --ports " + ports
|
execPath = execPath + " modifyPorts --protocol " + protocol + " --ports " + ports
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {"status": 1}
|
data_ret = {"status": 1}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class FTPManager:
|
|||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/ftpUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/ftpUtilities.py"
|
||||||
execPath = execPath + " submitFTPCreation --domainName " + domainName + " --userName " + userName \
|
execPath = execPath + " submitFTPCreation --domainName " + domainName + " --userName " + userName \
|
||||||
+ " --password " + password + " --path " + path + " --owner " + admin.userName + ' --api ' + api
|
+ " --password " + password + " --path " + path + " --owner " + admin.userName + ' --api ' + api
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'status': 1, 'creatFTPStatus': 1, 'error_message': 'None'}
|
data_ret = {'status': 1, 'creatFTPStatus': 1, 'error_message': 'None'}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class HAManager(multi.Thread):
|
|||||||
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
try:
|
try:
|
||||||
result = subprocess.call(command, shell=True)
|
result = ProcessUtilities.executioner(command, shell=True)
|
||||||
if result != 0:
|
if result != 0:
|
||||||
logging.writeToFile(command + ' Failed.')
|
logging.writeToFile(command + ' Failed.')
|
||||||
except BaseException:
|
except BaseException:
|
||||||
@@ -99,14 +99,14 @@ class HAManager(multi.Thread):
|
|||||||
workerToken = ''
|
workerToken = ''
|
||||||
|
|
||||||
command = "sudo docker swarm join-token manager"
|
command = "sudo docker swarm join-token manager"
|
||||||
output = subprocess.check_output(shlex.split(command)).splitlines()
|
output = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
for items in output:
|
for items in output:
|
||||||
if items.find('--token') > -1:
|
if items.find('--token') > -1:
|
||||||
managerToken = items.split(' ')[-2]
|
managerToken = items.split(' ')[-2]
|
||||||
|
|
||||||
command = "sudo docker swarm join-token worker"
|
command = "sudo docker swarm join-token worker"
|
||||||
output = subprocess.check_output(shlex.split(command)).splitlines()
|
output = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
for items in output:
|
for items in output:
|
||||||
if items.find('--token') > -1:
|
if items.find('--token') > -1:
|
||||||
@@ -160,7 +160,7 @@ class HAManager(multi.Thread):
|
|||||||
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
try:
|
try:
|
||||||
result = subprocess.call(command, shell=True)
|
result = ProcessUtilities.executioner(command, shell=True)
|
||||||
if result != 0:
|
if result != 0:
|
||||||
logging.writeToFile(command + ' Failed.')
|
logging.writeToFile(command + ' Failed.')
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||||
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
|
||||||
php composer-setup.php
|
php composer-setup.php
|
||||||
php -r "unlink('composer-setup.php');"
|
php -r "unlink('composer-setup.php');"
|
||||||
cp composer.phar /usr/bin/composer
|
mv composer.phar /usr/bin/composer
|
||||||
@@ -8,7 +8,7 @@ class FirewallUtilities:
|
|||||||
import install as inst
|
import install as inst
|
||||||
try:
|
try:
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
if inst.preFlightsChecks.resFailed(inst.get_distro(), res):
|
if inst.preFlightsChecks.resFailed(inst.get_distro(), res):
|
||||||
inst.preFlightsChecks.stdOut("Failed to apply rule: " + command + " Error #" + str(res), 1)
|
inst.preFlightsChecks.stdOut("Failed to apply rule: " + command + " Error #" + str(res), 1)
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -337,7 +337,7 @@ class InstallCyberPanel:
|
|||||||
|
|
||||||
while (1):
|
while (1):
|
||||||
command = "systemctl start mysqld@1"
|
command = "systemctl start mysqld@1"
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if install.preFlightsChecks.resFailed(self.distro, res):
|
if install.preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
@@ -357,7 +357,7 @@ class InstallCyberPanel:
|
|||||||
|
|
||||||
while (1):
|
while (1):
|
||||||
command = "systemctl enable mysqld@1"
|
command = "systemctl enable mysqld@1"
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if install.preFlightsChecks.resFailed(self.distro, res):
|
if install.preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
@@ -546,7 +546,7 @@ class InstallCyberPanel:
|
|||||||
shutil.copy(ftpdPath + "/pureftpd-mysql.conf", '/etc/pure-ftpd/db/mysql.conf')
|
shutil.copy(ftpdPath + "/pureftpd-mysql.conf", '/etc/pure-ftpd/db/mysql.conf')
|
||||||
|
|
||||||
command = 'echo 1 > /etc/pure-ftpd/conf/TLS'
|
command = 'echo 1 > /etc/pure-ftpd/conf/TLS'
|
||||||
subprocess.call(command, shell=True)
|
ProcessUtilities.executioner(command, shell=True)
|
||||||
|
|
||||||
command = 'systemctl restart pure-ftpd-mysql.service'
|
command = 'systemctl restart pure-ftpd-mysql.service'
|
||||||
install.preFlightsChecks.call(command, self.distro, '[installPureFTPDConfigurations]',
|
install.preFlightsChecks.call(command, self.distro, '[installPureFTPDConfigurations]',
|
||||||
@@ -565,12 +565,12 @@ class InstallCyberPanel:
|
|||||||
|
|
||||||
if self.distro == ubuntu:
|
if self.distro == ubuntu:
|
||||||
command = 'systemctl stop systemd-resolved'
|
command = 'systemctl stop systemd-resolved'
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
if res != 0:
|
if res != 0:
|
||||||
InstallCyberPanel.stdOut('Unable to stop systemd.resolved, prohits install of PowerDNS, error #' +
|
InstallCyberPanel.stdOut('Unable to stop systemd.resolved, prohits install of PowerDNS, error #' +
|
||||||
str(res), 1, 1, os.EX_OSERR)
|
str(res), 1, 1, os.EX_OSERR)
|
||||||
command = 'systemctl disable systemd-resolved.service'
|
command = 'systemctl disable systemd-resolved.service'
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
if res != 0:
|
if res != 0:
|
||||||
InstallCyberPanel.stdOut(
|
InstallCyberPanel.stdOut(
|
||||||
'Unable to disable systemd.resolved, prohits install of PowerDNS, error #' +
|
'Unable to disable systemd.resolved, prohits install of PowerDNS, error #' +
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class mysqlUtilities:
|
|||||||
|
|
||||||
command = 'mysql -u root -p' + password + ' -e "' + createDB + '"'
|
command = 'mysql -u root -p' + password + ' -e "' + createDB + '"'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
@@ -29,7 +29,7 @@ class mysqlUtilities:
|
|||||||
command = 'mysql -u root -p' + password + ' -e "' + createUser + '"'
|
command = 'mysql -u root -p' + password + ' -e "' + createUser + '"'
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
@@ -37,7 +37,7 @@ class mysqlUtilities:
|
|||||||
dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'localhost'"
|
dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'localhost'"
|
||||||
command = 'mysql -u root -p' + password + ' -e "' + dropDB + '"'
|
command = 'mysql -u root -p' + password + ' -e "' + dropDB + '"'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ def installCertBot():
|
|||||||
cmd.append("install")
|
cmd.append("install")
|
||||||
cmd.append("certbot")
|
cmd.append("certbot")
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
|
|
||||||
installCertBot()
|
installCertBot()
|
||||||
@@ -44,7 +44,7 @@ class unInstallCyberPanel:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
shutil.rmtree("/etc/postfix")
|
shutil.rmtree("/etc/postfix")
|
||||||
shutil.rmtree("etc/dovecot")
|
shutil.rmtree("etc/dovecot")
|
||||||
@@ -66,7 +66,7 @@ class unInstallCyberPanel:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
shutil.rmtree("/var/lib/mysql")
|
shutil.rmtree("/var/lib/mysql")
|
||||||
os.remove("/etc/my.cnf")
|
os.remove("/etc/my.cnf")
|
||||||
@@ -88,7 +88,7 @@ class unInstallCyberPanel:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
shutil.rmtree("/usr/local/lsws")
|
shutil.rmtree("/usr/local/lsws")
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ class unInstallCyberPanel:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
shutil.rmtree("/etc/pure-ftpd")
|
shutil.rmtree("/etc/pure-ftpd")
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ class unInstallCyberPanel:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
shutil.rmtree("/etc/pdns")
|
shutil.rmtree("/etc/pdns")
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ class unInstallCyberPanel:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
shutil.rmtree("/etc/pdns")
|
shutil.rmtree("/etc/pdns")
|
||||||
|
|
||||||
|
|||||||
@@ -181,30 +181,6 @@ def loadLoginPage(request):
|
|||||||
newFWRule = FirewallRules(name="ftp", proto="tcp", port="21")
|
newFWRule = FirewallRules(name="ftp", proto="tcp", port="21")
|
||||||
newFWRule.save()
|
newFWRule.save()
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="smtp", proto="tcp", port="25")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="smtps", proto="tcp", port="587")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="ssmtp", proto="tcp", port="465")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="pop3", proto="tcp", port="110")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="imap", proto="tcp", port="143")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="simap", proto="tcp", port="993")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="dns", proto="udp", port="53")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="dnstcp", proto="tcp", port="53")
|
|
||||||
newFWRule.save()
|
|
||||||
|
|
||||||
newFWRule = FirewallRules(name="ftptls", proto="tcp", port="40110-40210")
|
newFWRule = FirewallRules(name="ftptls", proto="tcp", port="40110-40210")
|
||||||
newFWRule.save()
|
newFWRule.save()
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class MailServerManager:
|
|||||||
execPath = execPath + " createEmailAccount --domain " + domainName + " --userName " \
|
execPath = execPath + " createEmailAccount --domain " + domainName + " --userName " \
|
||||||
+ userName + " --password " + password
|
+ userName + " --password " + password
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'status': 1, 'createEmailStatus': 1, 'error_message': "None"}
|
data_ret = {'status': 1, 'createEmailStatus': 1, 'error_message': "None"}
|
||||||
@@ -391,13 +391,13 @@ class MailServerManager:
|
|||||||
try:
|
try:
|
||||||
path = "/etc/opendkim/keys/" + domainName + "/default.txt"
|
path = "/etc/opendkim/keys/" + domainName + "/default.txt"
|
||||||
command = "sudo cat " + path
|
command = "sudo cat " + path
|
||||||
output = subprocess.check_output(shlex.split(command))
|
output = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
leftIndex = output.index('(') + 2
|
leftIndex = output.index('(') + 2
|
||||||
rightIndex = output.rindex(')') - 1
|
rightIndex = output.rindex(')') - 1
|
||||||
|
|
||||||
path = "/etc/opendkim/keys/" + domainName + "/default.private"
|
path = "/etc/opendkim/keys/" + domainName + "/default.private"
|
||||||
command = "sudo cat " + path
|
command = "sudo cat " + path
|
||||||
privateKey = subprocess.check_output(shlex.split(command))
|
privateKey = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
data_ret = {'status': 1, 'fetchStatus': 1, 'keysAvailable': 1, 'publicKey': output[leftIndex:rightIndex],
|
data_ret = {'status': 1, 'fetchStatus': 1, 'keysAvailable': 1, 'publicKey': output[leftIndex:rightIndex],
|
||||||
'privateKey': privateKey, 'dkimSuccessMessage': 'Keys successfully fetched!',
|
'privateKey': privateKey, 'dkimSuccessMessage': 'Keys successfully fetched!',
|
||||||
@@ -428,7 +428,7 @@ class MailServerManager:
|
|||||||
|
|
||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py"
|
||||||
execPath = execPath + " generateKeys --domain " + domainName
|
execPath = execPath + " generateKeys --domain " + domainName
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
DNS.dnsTemplate(domainName, admin)
|
DNS.dnsTemplate(domainName, admin)
|
||||||
@@ -444,7 +444,7 @@ class MailServerManager:
|
|||||||
|
|
||||||
path = "/etc/opendkim/keys/" + domainName + "/default.txt"
|
path = "/etc/opendkim/keys/" + domainName + "/default.txt"
|
||||||
command = "sudo cat " + path
|
command = "sudo cat " + path
|
||||||
output = subprocess.check_output(shlex.split(command))
|
output = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
leftIndex = output.index('(') + 2
|
leftIndex = output.index('(') + 2
|
||||||
rightIndex = output.rindex(')') - 1
|
rightIndex = output.rindex(')') - 1
|
||||||
|
|
||||||
@@ -492,7 +492,7 @@ class MailServerManager:
|
|||||||
def installStatusOpenDKIM(self):
|
def installStatusOpenDKIM(self):
|
||||||
try:
|
try:
|
||||||
command = "sudo cat " + mailUtilities.installLogPath
|
command = "sudo cat " + mailUtilities.installLogPath
|
||||||
installStatus = subprocess.check_output(shlex.split(command))
|
installStatus = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
if installStatus.find("[200]") > -1:
|
if installStatus.find("[200]") > -1:
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ class MailServerManager:
|
|||||||
|
|
||||||
execPath = execPath + " configureOpenDKIM"
|
execPath = execPath + " configureOpenDKIM"
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -1320,7 +1320,7 @@ def getRequestStatus(request):
|
|||||||
requestStatusSize = len(requestStatus)
|
requestStatusSize = len(requestStatus)
|
||||||
|
|
||||||
if requestStatus.find("PHP Extension Installed") > -1:
|
if requestStatus.find("PHP Extension Installed") > -1:
|
||||||
if subprocess.check_output(checkCommand).find(extensionName) > -1:
|
if ProcessUtilities.outputExecutioner(checkCommand).find(extensionName) > -1:
|
||||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||||
ext.status = 1
|
ext.status = 1
|
||||||
ext.save()
|
ext.save()
|
||||||
@@ -1337,7 +1337,7 @@ def getRequestStatus(request):
|
|||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
elif requestStatus.find("Can not be installed") > -1:
|
elif requestStatus.find("Can not be installed") > -1:
|
||||||
|
|
||||||
if subprocess.check_output(checkCommand).find(extensionName) > -1:
|
if ProcessUtilities.outputExecutioner(checkCommand).find(extensionName) > -1:
|
||||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||||
ext.status = 1
|
ext.status = 1
|
||||||
ext.save()
|
ext.save()
|
||||||
@@ -1354,7 +1354,7 @@ def getRequestStatus(request):
|
|||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
elif requestStatus.find("Can not un-install Extension") > -1:
|
elif requestStatus.find("Can not un-install Extension") > -1:
|
||||||
|
|
||||||
if subprocess.check_output(checkCommand).find(extensionName) > -1:
|
if ProcessUtilities.outputExecutioner(checkCommand).find(extensionName) > -1:
|
||||||
ext = installedPackages.objects.get(extensionName=extensionName)
|
ext = installedPackages.objects.get(extensionName=extensionName)
|
||||||
ext.status = 1
|
ext.status = 1
|
||||||
ext.save()
|
ext.save()
|
||||||
@@ -1552,7 +1552,7 @@ def savePHPConfigBasic(request):
|
|||||||
|
|
||||||
execPath = execPath + " savePHPConfigBasic --phpVers " + phpVers + " --allow_url_fopen '" + allow_url_fopen + "' --display_errors '" + display_errors + "' --file_uploads '" + file_uploads + "' --allow_url_include '" + allow_url_include + "' --memory_limit " + memory_limit + " --max_execution_time " + max_execution_time + " --upload_max_filesize " + upload_max_filesize + " --max_input_time " + max_input_time + " --post_max_size " + post_max_size
|
execPath = execPath + " savePHPConfigBasic --phpVers " + phpVers + " --allow_url_fopen '" + allow_url_fopen + "' --display_errors '" + display_errors + "' --file_uploads '" + file_uploads + "' --allow_url_include '" + allow_url_include + "' --memory_limit " + memory_limit + " --max_execution_time " + max_execution_time + " --upload_max_filesize " + upload_max_filesize + " --max_input_time " + max_input_time + " --post_max_size " + post_max_size
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'saveStatus': 1}
|
data_ret = {'saveStatus': 1}
|
||||||
@@ -1650,7 +1650,7 @@ def savePHPConfigAdvance(request):
|
|||||||
|
|
||||||
execPath = execPath + " savePHPConfigAdvance --phpVers " + path + " --tempPath " + tempPath
|
execPath = execPath + " savePHPConfigAdvance --phpVers " + path + " --tempPath " + tempPath
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
status = {"saveStatus": 1, "configData": data['configData']}
|
status = {"saveStatus": 1, "configData": data['configData']}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ def issueSSL(request):
|
|||||||
|
|
||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||||
execPath = execPath + " issueSSL --virtualHostName " + virtualHost + " --administratorEmail " + adminEmail + " --path " + path
|
execPath = execPath + " issueSSL --virtualHostName " + virtualHost + " --administratorEmail " + adminEmail + " --path " + path
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
pass
|
pass
|
||||||
@@ -151,7 +151,7 @@ def obtainHostNameSSL(request):
|
|||||||
|
|
||||||
execPath = execPath + " issueSSLForHostName --virtualHostName " + virtualHost + " --path " + path
|
execPath = execPath + " issueSSLForHostName --virtualHostName " + virtualHost + " --path " + path
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {"status": 1, "SSL": 1,
|
data_ret = {"status": 1, "SSL": 1,
|
||||||
@@ -221,7 +221,7 @@ def obtainMailServerSSL(request):
|
|||||||
|
|
||||||
execPath = execPath + " issueSSLForMailServer --virtualHostName " + virtualHost + " --path " + path
|
execPath = execPath + " issueSSLForMailServer --virtualHostName " + virtualHost + " --path " + path
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {"status": 1, "SSL": 1,
|
data_ret = {"status": 1, "SSL": 1,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ServiceManager:
|
|||||||
type = self.extraArgs['type']
|
type = self.extraArgs['type']
|
||||||
path = '/etc/pdns/pdns.conf'
|
path = '/etc/pdns/pdns.conf'
|
||||||
|
|
||||||
data = subprocess.check_output(shlex.split('sudo cat ' + path)).splitlines()
|
data = ProcessUtilities.outputExecutioner(shlex.split('sudo cat ' + path)).splitlines()
|
||||||
|
|
||||||
if type == 'MASTER':
|
if type == 'MASTER':
|
||||||
counter = 0
|
counter = 0
|
||||||
|
|||||||
@@ -174,10 +174,10 @@ def saveStatus(request):
|
|||||||
sm.managePDNS()
|
sm.managePDNS()
|
||||||
|
|
||||||
command = 'sudo systemctl enable pdns'
|
command = 'sudo systemctl enable pdns'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo systemctl restart pdns'
|
command = 'sudo systemctl restart pdns'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
@@ -186,10 +186,10 @@ def saveStatus(request):
|
|||||||
pdns.save()
|
pdns.save()
|
||||||
|
|
||||||
command = 'sudo systemctl stop pdns'
|
command = 'sudo systemctl stop pdns'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo systemctl disable pdns'
|
command = 'sudo systemctl disable pdns'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
elif service == 'postfix':
|
elif service == 'postfix':
|
||||||
@@ -199,13 +199,13 @@ def saveStatus(request):
|
|||||||
writeToFile = open(servicePath, 'w+')
|
writeToFile = open(servicePath, 'w+')
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
command = 'sudo systemctl start postfix'
|
command = 'sudo systemctl start postfix'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
else:
|
else:
|
||||||
command = 'sudo systemctl stop postfix'
|
command = 'sudo systemctl stop postfix'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo systemctl disable postfix'
|
command = 'sudo systemctl disable postfix'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.remove(servicePath)
|
os.remove(servicePath)
|
||||||
@@ -223,13 +223,13 @@ def saveStatus(request):
|
|||||||
writeToFile = open(servicePath, 'w+')
|
writeToFile = open(servicePath, 'w+')
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
command = 'sudo systemctl start ' + serviceName
|
command = 'sudo systemctl start ' + serviceName
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
else:
|
else:
|
||||||
command = 'sudo systemctl stop ' + serviceName
|
command = 'sudo systemctl stop ' + serviceName
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo systemctl disable ' + serviceName
|
command = 'sudo systemctl disable ' + serviceName
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.remove(servicePath)
|
os.remove(servicePath)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class CyberCPLogFileWriter:
|
|||||||
def readLastNFiles(numberOfLines,fileName):
|
def readLastNFiles(numberOfLines,fileName):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
lastFewLines = subprocess.check_output(["tail", "-n",str(numberOfLines),fileName])
|
lastFewLines = ProcessUtilities.outputExecutioner(["tail", "-n",str(numberOfLines),fileName])
|
||||||
|
|
||||||
return lastFewLines
|
return lastFewLines
|
||||||
|
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
def installWPCLI(self):
|
def installWPCLI(self):
|
||||||
try:
|
try:
|
||||||
command = 'sudo wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar'
|
command = 'sudo wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo chmod +x wp-cli.phar'
|
command = 'sudo chmod +x wp-cli.phar'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo mv wp-cli.phar /usr/bin/wp'
|
command = 'sudo mv wp-cli.phar /usr/bin/wp'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.writeToFile( str(msg) + ' [ApplicationInstaller.installWPCLI]')
|
logging.writeToFile( str(msg) + ' [ApplicationInstaller.installWPCLI]')
|
||||||
@@ -94,13 +94,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
try:
|
try:
|
||||||
if os.path.exists("/etc/lsb-release"):
|
if os.path.exists("/etc/lsb-release"):
|
||||||
command = 'apt -y install git'
|
command = 'apt -y install git'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
else:
|
else:
|
||||||
command = 'sudo yum -y install http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm'
|
command = 'sudo yum -y install http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo yum install git -y'
|
command = 'sudo yum install git -y'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.writeToFile( str(msg) + ' [ApplicationInstaller.installGit]')
|
logging.writeToFile( str(msg) + ' [ApplicationInstaller.installGit]')
|
||||||
@@ -158,7 +158,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
command = 'sudo wp --info'
|
command = 'sudo wp --info'
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
self.installWPCLI()
|
self.installWPCLI()
|
||||||
@@ -235,7 +235,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
if not os.path.exists(finalPath):
|
if not os.path.exists(finalPath):
|
||||||
command = 'sudo mkdir -p ' + finalPath
|
command = 'sudo mkdir -p ' + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
## checking for directories/files
|
## checking for directories/files
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "sudo wp core download --allow-root --path=" + finalPath
|
command = "sudo wp core download --allow-root --path=" + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "sudo wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=localhost --dbprefix=wp_ --allow-root --path=" + finalPath
|
command = "sudo wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=localhost --dbprefix=wp_ --allow-root --path=" + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if home == '0':
|
if home == '0':
|
||||||
path = self.extraArgs['path']
|
path = self.extraArgs['path']
|
||||||
@@ -267,7 +267,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
finalURL = domainName
|
finalURL = domainName
|
||||||
|
|
||||||
command = 'sudo wp core install --url="http://' + finalURL + '" --title="' + blogTitle + '" --admin_user="' + adminUser + '" --admin_password="' + adminPassword + '" --admin_email="' + adminEmail + '" --allow-root --path=' + finalPath
|
command = 'sudo wp core install --url="http://' + finalURL + '" --title="' + blogTitle + '" --admin_user="' + adminUser + '" --admin_password="' + adminPassword + '" --admin_email="' + adminEmail + '" --allow-root --path=' + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -276,21 +276,21 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "sudo wp plugin install litespeed-cache --allow-root --path=" + finalPath
|
command = "sudo wp plugin install litespeed-cache --allow-root --path=" + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
statusFile.writelines('Activating LSCache Plugin,90')
|
statusFile.writelines('Activating LSCache Plugin,90')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "sudo wp plugin activate litespeed-cache --allow-root --path=" + finalPath
|
command = "sudo wp plugin activate litespeed-cache --allow-root --path=" + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
statusFile.writelines("Successfully Installed. [200]")
|
statusFile.writelines("Successfully Installed. [200]")
|
||||||
@@ -308,7 +308,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mysqlUtilities.deleteDatabase(dbName, dbUser)
|
mysqlUtilities.deleteDatabase(dbName, dbUser)
|
||||||
@@ -406,7 +406,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
if not os.path.exists(finalPath):
|
if not os.path.exists(finalPath):
|
||||||
command = 'sudo mkdir -p ' + finalPath
|
command = 'sudo mkdir -p ' + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
## checking for directories/files
|
## checking for directories/files
|
||||||
|
|
||||||
@@ -420,13 +420,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "sudo wget https://download.prestashop.com/download/releases/prestashop_1.7.4.2.zip"
|
command = "sudo wget https://download.prestashop.com/download/releases/prestashop_1.7.4.2.zip"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "sudo unzip -o prestashop_1.7.4.2.zip -d " + finalPath
|
command = "sudo unzip -o prestashop_1.7.4.2.zip -d " + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "sudo unzip -o " + finalPath + "prestashop.zip -d " + finalPath
|
command = "sudo unzip -o " + finalPath + "prestashop.zip -d " + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -449,22 +449,22 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
" --db_server=localhost --db_name=" + dbName + " --db_user=" + dbUser + " --db_password=" + dbPassword \
|
" --db_server=localhost --db_name=" + dbName + " --db_user=" + dbUser + " --db_password=" + dbPassword \
|
||||||
+ " --name='" + shopName + "' --firstname=" + firstName + " --lastname=" + lastName + \
|
+ " --name='" + shopName + "' --firstname=" + firstName + " --lastname=" + lastName + \
|
||||||
" --email=" + email + " --password=" + password
|
" --email=" + email + " --password=" + password
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "sudo rm -rf " + finalPath + "install"
|
command = "sudo rm -rf " + finalPath + "install"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
command = "sudo rm -f prestashop_1.7.4.2.zip"
|
command = "sudo rm -f prestashop_1.7.4.2.zip"
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
statusFile.writelines("Successfully Installed. [200]")
|
statusFile.writelines("Successfully Installed. [200]")
|
||||||
@@ -480,7 +480,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mysqlUtilities.deleteDatabase(dbName, dbUser)
|
mysqlUtilities.deleteDatabase(dbName, dbUser)
|
||||||
@@ -512,7 +512,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
command = 'sudo git --help'
|
command = 'sudo git --help'
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
@@ -561,7 +561,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
if not os.path.exists(finalPath):
|
if not os.path.exists(finalPath):
|
||||||
command = 'sudo mkdir -p ' + finalPath
|
command = 'sudo mkdir -p ' + finalPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
## checking for directories/files
|
## checking for directories/files
|
||||||
|
|
||||||
@@ -579,7 +579,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
try:
|
try:
|
||||||
command = 'sudo GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no" git clone --depth 1 --no-single-branch git@' + defaultProvider +'.com:' + username + '/' + reponame + '.git -b ' + branch + ' ' + finalPath
|
command = 'sudo GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no" git clone --depth 1 --no-single-branch git@' + defaultProvider +'.com:' + username + '/' + reponame + '.git -b ' + branch + ' ' + finalPath
|
||||||
logging.writeToFile(command)
|
logging.writeToFile(command)
|
||||||
subprocess.check_output(shlex.split(command))
|
ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
except subprocess.CalledProcessError, msg:
|
except subprocess.CalledProcessError, msg:
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
statusFile.writelines('Failed to clone repository, make sure you deployed your key to repository. [404]')
|
statusFile.writelines('Failed to clone repository, make sure you deployed your key to repository. [404]')
|
||||||
@@ -590,7 +590,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
vhost.addRewriteRules(domainName)
|
vhost.addRewriteRules(domainName)
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
@@ -633,7 +633,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
command = 'sudo git --git-dir=' + finalPath + '.git --work-tree=' + finalPath +' pull'
|
command = 'sudo git --git-dir=' + finalPath + '.git --work-tree=' + finalPath +' pull'
|
||||||
subprocess.check_output(shlex.split(command))
|
ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -642,7 +642,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd)
|
ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -674,16 +674,16 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
|
|
||||||
command = 'sudo rm -rf ' + finalPath
|
command = 'sudo rm -rf ' + finalPath
|
||||||
subprocess.check_output(shlex.split(command))
|
ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo mkdir ' + finalPath
|
command = 'sudo mkdir ' + finalPath
|
||||||
subprocess.check_output(shlex.split(command))
|
ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd)
|
ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
gitPath = '/home/cyberpanel/' + domain + '.git'
|
gitPath = '/home/cyberpanel/' + domain + '.git'
|
||||||
|
|
||||||
@@ -731,7 +731,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
if not os.path.exists("staging.zip"):
|
if not os.path.exists("staging.zip"):
|
||||||
command = 'wget --no-check-certificate https://github.com/joomla/joomla-cms/archive/staging.zip -P ' + finalPath
|
command = 'wget --no-check-certificate https://github.com/joomla/joomla-cms/archive/staging.zip -P ' + finalPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
else:
|
else:
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
statusFile.writelines("File already exists." + " [404]")
|
statusFile.writelines("File already exists." + " [404]")
|
||||||
@@ -741,12 +741,12 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
command = 'unzip ' + finalPath + 'staging.zip -d ' + finalPath
|
command = 'unzip ' + finalPath + 'staging.zip -d ' + finalPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
os.remove(finalPath + 'staging.zip')
|
os.remove(finalPath + 'staging.zip')
|
||||||
|
|
||||||
command = 'cp -r ' + finalPath + 'joomla-cms-staging/. ' + finalPath
|
command = 'cp -r ' + finalPath + 'joomla-cms-staging/. ' + finalPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
shutil.rmtree(finalPath + "joomla-cms-staging")
|
shutil.rmtree(finalPath + "joomla-cms-staging")
|
||||||
os.rename(finalPath + "installation/configuration.php-dist", finalPath + "configuration.php")
|
os.rename(finalPath + "installation/configuration.php-dist", finalPath + "configuration.php")
|
||||||
@@ -816,7 +816,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
f2.close()
|
f2.close()
|
||||||
|
|
||||||
# Restore SQL
|
# Restore SQL
|
||||||
proc = subprocess.Popen(["mysql", "--user=%s" % dbUser, "--password=%s" % dbPassword, dbName],
|
proc = ProcessUtilities.popenExecutioner(["mysql", "--user=%s" % dbUser, "--password=%s" % dbPassword, dbName],
|
||||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
usercreation = """INSERT INTO `%susers`
|
usercreation = """INSERT INTO `%susers`
|
||||||
@@ -833,7 +833,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
command = "sudo chown -R " + virtualHostUser + ":" + virtualHostUser + " " + finalPath
|
command = "sudo chown -R " + virtualHostUser + ":" + virtualHostUser + " " + finalPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
vhost.addRewriteRules(domainName)
|
vhost.addRewriteRules(domainName)
|
||||||
|
|
||||||
@@ -852,7 +852,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "sudo chown -R " + virtualHostUser + ":" + virtualHostUser + " " + homeDir
|
command = "sudo chown -R " + virtualHostUser + ":" + virtualHostUser + " " + homeDir
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mysqlUtilities.deleteDatabase(dbName, dbUser)
|
mysqlUtilities.deleteDatabase(dbName, dbUser)
|
||||||
@@ -881,11 +881,11 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
command = 'sudo git --git-dir=' + finalPath + '/.git checkout -b ' + githubBranch
|
command = 'sudo git --git-dir=' + finalPath + '/.git checkout -b ' + githubBranch
|
||||||
subprocess.check_output(shlex.split(command))
|
ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
command = 'sudo git --git-dir=' + finalPath + '/.git checkout ' + githubBranch
|
command = 'sudo git --git-dir=' + finalPath + '/.git checkout ' + githubBranch
|
||||||
subprocess.check_output(shlex.split(command))
|
ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
except subprocess.CalledProcessError, msg:
|
except subprocess.CalledProcessError, msg:
|
||||||
logging.writeToFile('Failed to change branch: ' + str(msg))
|
logging.writeToFile('Failed to change branch: ' + str(msg))
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class backupSchedule:
|
|||||||
|
|
||||||
writeToFile = open(backupLogPath, "a")
|
writeToFile = open(backupLogPath, "a")
|
||||||
command = "sudo scp -o StrictHostKeyChecking=no -P "+port+" -i /root/.ssh/cyberpanel " + backupPath + " root@"+IPAddress+":/home/backup/" + ipAddressLocal + "/" + time.strftime("%a-%b") + "/"
|
command = "sudo scp -o StrictHostKeyChecking=no -P "+port+" -i /root/.ssh/cyberpanel " + backupPath + " root@"+IPAddress+":/home/backup/" + ipAddressLocal + "/" + time.strftime("%a-%b") + "/"
|
||||||
subprocess.call(shlex.split(command), stdout=writeToFile)
|
ProcessUtilities.executioner(shlex.split(command), stdout=writeToFile)
|
||||||
|
|
||||||
## Remove backups already sent to remote destinations
|
## Remove backups already sent to remote destinations
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ class backupSchedule:
|
|||||||
|
|
||||||
command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + ipAddress + " mkdir -p /home/backup/" + ipAddressLocal + "/" + time.strftime(
|
command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + ipAddress + " mkdir -p /home/backup/" + ipAddressLocal + "/" + time.strftime(
|
||||||
"%a-%b")
|
"%a-%b")
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for virtualHost in os.listdir("/home"):
|
for virtualHost in os.listdir("/home"):
|
||||||
|
|||||||
@@ -638,7 +638,7 @@ class backupUtilities:
|
|||||||
## Change permissions
|
## Change permissions
|
||||||
|
|
||||||
command = "chmod -r vmail:vmail " + emailHome
|
command = "chmod -r vmail:vmail " + emailHome
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@@ -656,7 +656,7 @@ class backupUtilities:
|
|||||||
|
|
||||||
command = "chown -R " + externalApp + ":" + externalApp + " " + websiteHome
|
command = "chown -R " + externalApp + ":" + externalApp + " " + websiteHome
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd)
|
ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
status = os.path.join(completPath, 'status')
|
status = os.path.join(completPath, 'status')
|
||||||
@@ -778,7 +778,7 @@ class backupUtilities:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def checkIfHostIsUp(IPAddress):
|
def checkIfHostIsUp(IPAddress):
|
||||||
try:
|
try:
|
||||||
if subprocess.check_output(['ping', IPAddress, '-c 1']).find("0% packet loss") > -1:
|
if ProcessUtilities.outputExecutioner(['ping', IPAddress, '-c 1']).find("0% packet loss") > -1:
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
@@ -807,22 +807,22 @@ class backupUtilities:
|
|||||||
index = checkConn.expect(expectation)
|
index = checkConn.expect(expectation)
|
||||||
|
|
||||||
if index == 0:
|
if index == 0:
|
||||||
subprocess.call(['kill', str(checkConn.pid)])
|
ProcessUtilities.executioner(['kill', str(checkConn.pid)])
|
||||||
logging.CyberCPLogFileWriter.writeToFile("Remote Server is not able to authenticate for transfer to initiate, IP Address:" + IPAddress)
|
logging.CyberCPLogFileWriter.writeToFile("Remote Server is not able to authenticate for transfer to initiate, IP Address:" + IPAddress)
|
||||||
return [0,"Remote Server is not able to authenticate for transfer to initiate."]
|
return [0,"Remote Server is not able to authenticate for transfer to initiate."]
|
||||||
elif index == 1:
|
elif index == 1:
|
||||||
subprocess.call(['kill', str(checkConn.pid)])
|
ProcessUtilities.executioner(['kill', str(checkConn.pid)])
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
"Remote Server is not able to authenticate for transfer to initiate, IP Address:" + IPAddress)
|
"Remote Server is not able to authenticate for transfer to initiate, IP Address:" + IPAddress)
|
||||||
return [0, "Remote Server is not able to authenticate for transfer to initiate."]
|
return [0, "Remote Server is not able to authenticate for transfer to initiate."]
|
||||||
elif index == 2:
|
elif index == 2:
|
||||||
subprocess.call(['kill', str(checkConn.pid)])
|
ProcessUtilities.executioner(['kill', str(checkConn.pid)])
|
||||||
return [1, "None"]
|
return [1, "None"]
|
||||||
elif index == 4:
|
elif index == 4:
|
||||||
subprocess.call(['kill', str(checkConn.pid)])
|
ProcessUtilities.executioner(['kill', str(checkConn.pid)])
|
||||||
return [1, "None"]
|
return [1, "None"]
|
||||||
else:
|
else:
|
||||||
subprocess.call(['kill', str(checkConn.pid)])
|
ProcessUtilities.executioner(['kill', str(checkConn.pid)])
|
||||||
return [1, "None"]
|
return [1, "None"]
|
||||||
|
|
||||||
except pexpect.TIMEOUT, msg:
|
except pexpect.TIMEOUT, msg:
|
||||||
@@ -907,13 +907,13 @@ class backupUtilities:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
command = "sudo ssh -o StrictHostKeyChecking=no -p "+ port +" -i /root/.ssh/cyberpanel root@"+IPAddress+" mkdir /home/backup"
|
command = "sudo ssh -o StrictHostKeyChecking=no -p "+ port +" -i /root/.ssh/cyberpanel root@"+IPAddress+" mkdir /home/backup"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + IPAddress + ' "cat /root/.ssh/authorized_keys /root/.ssh/temp > /root/.ssh/authorized_temp"'
|
command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + IPAddress + ' "cat /root/.ssh/authorized_keys /root/.ssh/temp > /root/.ssh/authorized_temp"'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + IPAddress + ' "cat /root/.ssh/authorized_temp > /root/.ssh/authorized_keys"'
|
command = "sudo ssh -o StrictHostKeyChecking=no -p " + port + " -i /root/.ssh/cyberpanel root@" + IPAddress + ' "cat /root/.ssh/authorized_temp > /root/.ssh/authorized_keys"'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [createBackupDir]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [createBackupDir]")
|
||||||
@@ -923,7 +923,7 @@ class backupUtilities:
|
|||||||
def host_key_verification(IPAddress):
|
def host_key_verification(IPAddress):
|
||||||
try:
|
try:
|
||||||
command = 'sudo ssh-keygen -R ' + IPAddress
|
command = 'sudo ssh-keygen -R ' + IPAddress
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
return 1
|
return 1
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [host_key_verification]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [host_key_verification]")
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import tarfile
|
|||||||
import shutil
|
import shutil
|
||||||
from mailUtilities import mailUtilities
|
from mailUtilities import mailUtilities
|
||||||
import threading as multi
|
import threading as multi
|
||||||
|
from plogical.processUtilities import ProcessUtilities
|
||||||
|
|
||||||
class CSF(multi.Thread):
|
class CSF(multi.Thread):
|
||||||
installLogPath = "/home/cyberpanel/csfInstallLog"
|
installLogPath = "/home/cyberpanel/csfInstallLog"
|
||||||
@@ -140,7 +141,7 @@ class CSF(multi.Thread):
|
|||||||
currentSettings = {}
|
currentSettings = {}
|
||||||
|
|
||||||
command = 'sudo cat /etc/csf/csf.conf'
|
command = 'sudo cat /etc/csf/csf.conf'
|
||||||
output = subprocess.check_output(shlex.split(command)).splitlines()
|
output = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
for items in output:
|
for items in output:
|
||||||
if items.find('TESTING') > -1 and items.find('=') > -1 and (items[0]!= '#') and items.find('TESTING_INTERVAL') == -1:
|
if items.find('TESTING') > -1 and items.find('=') > -1 and (items[0]!= '#') and items.find('TESTING_INTERVAL') == -1:
|
||||||
@@ -166,7 +167,7 @@ class CSF(multi.Thread):
|
|||||||
currentSettings['firewallStatus'] = 0
|
currentSettings['firewallStatus'] = 0
|
||||||
|
|
||||||
command = 'sudo iptables -nv -L'
|
command = 'sudo iptables -nv -L'
|
||||||
output = subprocess.check_output(shlex.split(command))
|
output = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
if output.find('0.0.0.0/0') > -1:
|
if output.find('0.0.0.0/0') > -1:
|
||||||
currentSettings['firewallStatus'] = 1
|
currentSettings['firewallStatus'] = 1
|
||||||
@@ -258,10 +259,10 @@ class CSF(multi.Thread):
|
|||||||
def allowIP(ipAddress):
|
def allowIP(ipAddress):
|
||||||
try:
|
try:
|
||||||
command = 'sudo csf -dr ' + ipAddress
|
command = 'sudo csf -dr ' + ipAddress
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo csf -a ' + ipAddress
|
command = 'sudo csf -a ' + ipAddress
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[allowIP]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[allowIP]")
|
||||||
@@ -271,10 +272,10 @@ class CSF(multi.Thread):
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
command = 'sudo csf -tr ' + ipAddress
|
command = 'sudo csf -tr ' + ipAddress
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo csf -d ' + ipAddress
|
command = 'sudo csf -d ' + ipAddress
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[blockIP]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[blockIP]")
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ class DNS:
|
|||||||
|
|
||||||
path = "/etc/opendkim/keys/" + topLevelDomain + "/default.txt"
|
path = "/etc/opendkim/keys/" + topLevelDomain + "/default.txt"
|
||||||
command = "sudo cat " + path
|
command = "sudo cat " + path
|
||||||
output = subprocess.check_output(shlex.split(command))
|
output = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
leftIndex = output.index('(') + 2
|
leftIndex = output.index('(') + 2
|
||||||
rightIndex = output.rindex(')') - 1
|
rightIndex = output.rindex(')') - 1
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class findBWUsage:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
logging.CyberCPLogFileWriter.writeToFile("1440 [setup_cron]")
|
logging.CyberCPLogFileWriter.writeToFile("1440 [setup_cron]")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class FirewallUtilities:
|
|||||||
def doCommand(command):
|
def doCommand(command):
|
||||||
try:
|
try:
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
if FirewallUtilities.resFailed(res):
|
if FirewallUtilities.resFailed(res):
|
||||||
logging.CyberCPLogFileWriter.writeToFile("Failed to apply rule: " + command + " Error #" + str(res))
|
logging.CyberCPLogFileWriter.writeToFile("Failed to apply rule: " + command + " Error #" + str(res))
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class FTPUtilities:
|
|||||||
cmd.append("ftpuser:2001")
|
cmd.append("ftpuser:2001")
|
||||||
cmd.append(path)
|
cmd.append(path)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print "Permissions not changed."
|
print "Permissions not changed."
|
||||||
else:
|
else:
|
||||||
@@ -58,7 +58,7 @@ class FTPUtilities:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print "Permissions not changed."
|
print "Permissions not changed."
|
||||||
@@ -72,7 +72,7 @@ class FTPUtilities:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
@@ -96,7 +96,7 @@ class FTPUtilities:
|
|||||||
|
|
||||||
command = "chown " + externalApp + ":" + externalApp + " " + path
|
command = "chown " + externalApp + ":" + externalApp + " " + path
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
return 1,'None'
|
return 1,'None'
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class installUtilities:
|
|||||||
cmd.append("-y")
|
cmd.append("-y")
|
||||||
cmd.append("install")
|
cmd.append("install")
|
||||||
cmd.append("epel-release")
|
cmd.append("epel-release")
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
@@ -47,7 +47,7 @@ class installUtilities:
|
|||||||
cmd.append("rpm")
|
cmd.append("rpm")
|
||||||
cmd.append("-ivh")
|
cmd.append("-ivh")
|
||||||
cmd.append("http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm")
|
cmd.append("http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm")
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
print(" Could not add Litespeed repo " )
|
print(" Could not add Litespeed repo " )
|
||||||
@@ -78,7 +78,7 @@ class installUtilities:
|
|||||||
cmd.append("install")
|
cmd.append("install")
|
||||||
cmd.append("openlitespeed-1.4.26")
|
cmd.append("openlitespeed-1.4.26")
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
@@ -111,7 +111,7 @@ class installUtilities:
|
|||||||
cmd.append("/usr/local/lsws/bin/lswsctrl")
|
cmd.append("/usr/local/lsws/bin/lswsctrl")
|
||||||
cmd.append("start")
|
cmd.append("start")
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
@@ -144,7 +144,7 @@ class installUtilities:
|
|||||||
command = "sudo /usr/local/lsws/bin/lswsctrl restart"
|
command = "sudo /usr/local/lsws/bin/lswsctrl restart"
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [reStartLiteSpeed]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [reStartLiteSpeed]")
|
||||||
@@ -165,7 +165,7 @@ class installUtilities:
|
|||||||
command = "sudo /usr/local/lsws/bin/lswsctrl restart"
|
command = "sudo /usr/local/lsws/bin/lswsctrl restart"
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
@@ -216,7 +216,7 @@ class installUtilities:
|
|||||||
cmd.append("groupinstall")
|
cmd.append("groupinstall")
|
||||||
cmd.append("lsphp-all")
|
cmd.append("lsphp-all")
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
@@ -310,7 +310,7 @@ class installUtilities:
|
|||||||
cmd.append("remove")
|
cmd.append("remove")
|
||||||
cmd.append("openlitespeed-1.4.26")
|
cmd.append("openlitespeed-1.4.26")
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
@@ -338,7 +338,7 @@ class installUtilities:
|
|||||||
cmd.append("remove")
|
cmd.append("remove")
|
||||||
cmd.append("lsphp*")
|
cmd.append("lsphp*")
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
@@ -380,7 +380,7 @@ class installUtilities:
|
|||||||
cmd.append("start")
|
cmd.append("start")
|
||||||
cmd.append("mariadb")
|
cmd.append("mariadb")
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
@@ -416,7 +416,7 @@ class installUtilities:
|
|||||||
cmd.append("install")
|
cmd.append("install")
|
||||||
cmd.append("mariadb-server")
|
cmd.append("mariadb-server")
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
@@ -456,7 +456,7 @@ class installUtilities:
|
|||||||
cmd.append("enable")
|
cmd.append("enable")
|
||||||
cmd.append("mariadb")
|
cmd.append("mariadb")
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
print("###############################################")
|
print("###############################################")
|
||||||
|
|||||||
@@ -80,13 +80,13 @@ class mailUtilities:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
command = 'chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data/_data_'
|
command = 'chown -R lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data/_data_'
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
## After effects ends
|
## After effects ends
|
||||||
|
|
||||||
@@ -159,18 +159,18 @@ class mailUtilities:
|
|||||||
FNULL = open(os.devnull, 'w')
|
FNULL = open(os.devnull, 'w')
|
||||||
|
|
||||||
command = "opendkim-genkey -D /etc/opendkim/keys/" + virtualHostName + " -d " + virtualHostName + " -s default"
|
command = "opendkim-genkey -D /etc/opendkim/keys/" + virtualHostName + " -d " + virtualHostName + " -s default"
|
||||||
subprocess.call(shlex.split(command),stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(shlex.split(command),stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
## Fix permissions
|
## Fix permissions
|
||||||
|
|
||||||
command = "chown -R root:opendkim /etc/opendkim/keys/" + virtualHostName
|
command = "chown -R root:opendkim /etc/opendkim/keys/" + virtualHostName
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "chmod 640 /etc/opendkim/keys/" + virtualHostName + "/default.private"
|
command = "chmod 640 /etc/opendkim/keys/" + virtualHostName + "/default.private"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "chmod 644 /etc/opendkim/keys/" + virtualHostName + "/default.txt"
|
command = "chmod 644 /etc/opendkim/keys/" + virtualHostName + "/default.txt"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
## Edit key file
|
## Edit key file
|
||||||
|
|
||||||
@@ -202,10 +202,10 @@ class mailUtilities:
|
|||||||
## Restart postfix and OpenDKIM
|
## Restart postfix and OpenDKIM
|
||||||
|
|
||||||
command = "systemctl restart opendkim"
|
command = "systemctl restart opendkim"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "systemctl restart postfix"
|
command = "systemctl restart postfix"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
return 1, "None"
|
return 1, "None"
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ class mailUtilities:
|
|||||||
path = "/etc/opendkim.conf"
|
path = "/etc/opendkim.conf"
|
||||||
|
|
||||||
command = "sudo cat " + path
|
command = "sudo cat " + path
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
@@ -285,15 +285,15 @@ milter_default_action = accept
|
|||||||
#### Restarting Postfix and OpenDKIM
|
#### Restarting Postfix and OpenDKIM
|
||||||
|
|
||||||
command = "systemctl start opendkim"
|
command = "systemctl start opendkim"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "systemctl enable opendkim"
|
command = "systemctl enable opendkim"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "systemctl start postfix"
|
command = "systemctl start postfix"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
return
|
return
|
||||||
@@ -316,14 +316,14 @@ milter_default_action = accept
|
|||||||
FNULL = open(os.devnull, 'w')
|
FNULL = open(os.devnull, 'w')
|
||||||
|
|
||||||
command = "sudo mkdir " + mailUtilities.cyberPanelHome
|
command = "sudo mkdir " + mailUtilities.cyberPanelHome
|
||||||
subprocess.call(shlex.split(command), stdout=FNULL)
|
ProcessUtilities.executioner(shlex.split(command), stdout=FNULL)
|
||||||
|
|
||||||
command = "sudo chown -R cyberpanel:cyberpanel " + mailUtilities.cyberPanelHome
|
command = "sudo chown -R cyberpanel:cyberpanel " + mailUtilities.cyberPanelHome
|
||||||
subprocess.call(shlex.split(command), stdout=FNULL)
|
ProcessUtilities.executioner(shlex.split(command), stdout=FNULL)
|
||||||
except:
|
except:
|
||||||
FNULL = open(os.devnull, 'w')
|
FNULL = open(os.devnull, 'w')
|
||||||
command = "sudo chown -R cyberpanel:cyberpanel " + mailUtilities.cyberPanelHome
|
command = "sudo chown -R cyberpanel:cyberpanel " + mailUtilities.cyberPanelHome
|
||||||
subprocess.call(shlex.split(command), stdout=FNULL)
|
ProcessUtilities.executioner(shlex.split(command), stdout=FNULL)
|
||||||
|
|
||||||
except BaseException,msg:
|
except BaseException,msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [checkHome]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [checkHome]")
|
||||||
@@ -339,7 +339,7 @@ milter_default_action = accept
|
|||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
with open(mailUtilities.installLogPath, 'w') as f:
|
with open(mailUtilities.installLogPath, 'w') as f:
|
||||||
res = subprocess.call(cmd, stdout=f)
|
res = ProcessUtilities.executioner(cmd, stdout=f)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
writeToFile = open(mailUtilities.installLogPath, 'a')
|
writeToFile = open(mailUtilities.installLogPath, 'a')
|
||||||
@@ -363,10 +363,10 @@ milter_default_action = accept
|
|||||||
def restartServices():
|
def restartServices():
|
||||||
try:
|
try:
|
||||||
command = 'systemctl restart postfix'
|
command = 'systemctl restart postfix'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'systemctl restart dovecot'
|
command = 'systemctl restart dovecot'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
except BaseException,msg:
|
except BaseException,msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [restartServices]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [restartServices]")
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ milter_default_action = accept
|
|||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
with open(mailUtilities.spamassassinInstallLogPath, 'w') as f:
|
with open(mailUtilities.spamassassinInstallLogPath, 'w') as f:
|
||||||
res = subprocess.call(cmd, stdout=f)
|
res = ProcessUtilities.executioner(cmd, stdout=f)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
writeToFile = open(mailUtilities.spamassassinInstallLogPath, 'a')
|
writeToFile = open(mailUtilities.spamassassinInstallLogPath, 'a')
|
||||||
@@ -411,7 +411,7 @@ milter_default_action = accept
|
|||||||
path = "/etc/mail/spamassassin/local.cf"
|
path = "/etc/mail/spamassassin/local.cf"
|
||||||
|
|
||||||
command = "sudo cat " + path
|
command = "sudo cat " + path
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
@@ -443,21 +443,21 @@ milter_default_action = accept
|
|||||||
|
|
||||||
|
|
||||||
command = "groupadd spamd"
|
command = "groupadd spamd"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd"
|
command = "useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "chown spamd:spamd /var/log/spamassassin"
|
command = "chown spamd:spamd /var/log/spamassassin"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "systemctl enable spamassassin"
|
command = "systemctl enable spamassassin"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "systemctl start spamassassin"
|
command = "systemctl start spamassassin"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
## Configuration to postfix
|
## Configuration to postfix
|
||||||
|
|
||||||
@@ -478,7 +478,7 @@ milter_default_action = accept
|
|||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
command = 'systemctl restart postfix'
|
command = 'systemctl restart postfix'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
@@ -531,7 +531,7 @@ milter_default_action = accept
|
|||||||
conf.close()
|
conf.close()
|
||||||
|
|
||||||
command = 'systemctl restart spamassassin'
|
command = 'systemctl restart spamassassin'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
return
|
return
|
||||||
@@ -552,10 +552,10 @@ milter_default_action = accept
|
|||||||
shutil.copy("/usr/local/CyberCP/postfixSenderPolicy/cpecs.service", "/etc/systemd/system/cpecs.service")
|
shutil.copy("/usr/local/CyberCP/postfixSenderPolicy/cpecs.service", "/etc/systemd/system/cpecs.service")
|
||||||
|
|
||||||
command = 'systemctl enable cpecs'
|
command = 'systemctl enable cpecs'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'systemctl start cpecs'
|
command = 'systemctl start cpecs'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
writeToFile = open(postfixPath, 'a')
|
writeToFile = open(postfixPath, 'a')
|
||||||
writeToFile.writelines('smtpd_data_restrictions = check_policy_service unix:/var/log/policyServerSocket\n')
|
writeToFile.writelines('smtpd_data_restrictions = check_policy_service unix:/var/log/policyServerSocket\n')
|
||||||
@@ -563,7 +563,7 @@ milter_default_action = accept
|
|||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
command = 'systemctl restart postfix'
|
command = 'systemctl restart postfix'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
else:
|
else:
|
||||||
|
|
||||||
data = open(postfixPath, 'r').readlines()
|
data = open(postfixPath, 'r').readlines()
|
||||||
@@ -580,10 +580,10 @@ milter_default_action = accept
|
|||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
command = 'systemctl stop cpecs'
|
command = 'systemctl stop cpecs'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'systemctl restart postfix'
|
command = 'systemctl restart postfix'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class modSec:
|
|||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
with open(modSec.installLogPath, 'w') as f:
|
with open(modSec.installLogPath, 'w') as f:
|
||||||
res = subprocess.call(cmd, stdout=f)
|
res = ProcessUtilities.executioner(cmd, stdout=f)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
writeToFile = open(modSec.installLogPath, 'a')
|
writeToFile = open(modSec.installLogPath, 'a')
|
||||||
@@ -230,7 +230,7 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf
|
|||||||
os.remove('comodo.tar.gz')
|
os.remove('comodo.tar.gz')
|
||||||
|
|
||||||
command = "wget https://" + modSec.mirrorPath + "/modsec/comodo.tar.gz"
|
command = "wget https://" + modSec.mirrorPath + "/modsec/comodo.tar.gz"
|
||||||
result = subprocess.call(shlex.split(command))
|
result = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if result == 1:
|
if result == 1:
|
||||||
return 0
|
return 0
|
||||||
@@ -250,13 +250,13 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf
|
|||||||
os.remove('cpanel_litespeed_vendor')
|
os.remove('cpanel_litespeed_vendor')
|
||||||
|
|
||||||
command = "wget https://waf.comodo.com/api/cpanel_litespeed_vendor"
|
command = "wget https://waf.comodo.com/api/cpanel_litespeed_vendor"
|
||||||
result = subprocess.call(shlex.split(command))
|
result = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if result == 1:
|
if result == 1:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
command = "unzip cpanel_litespeed_vendor -d " + extractLocation
|
command = "unzip cpanel_litespeed_vendor -d " + extractLocation
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -334,16 +334,16 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf
|
|||||||
os.remove('cpanel_litespeed_vendor')
|
os.remove('cpanel_litespeed_vendor')
|
||||||
|
|
||||||
command = "wget https://waf.comodo.com/api/cpanel_litespeed_vendor"
|
command = "wget https://waf.comodo.com/api/cpanel_litespeed_vendor"
|
||||||
result = subprocess.call(shlex.split(command))
|
result = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if result == 1:
|
if result == 1:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
command = "unzip cpanel_litespeed_vendor -d " + extractLocation
|
command = "unzip cpanel_litespeed_vendor -d " + extractLocation
|
||||||
result = subprocess.call(shlex.split(command))
|
result = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
|
command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
return
|
return
|
||||||
@@ -398,7 +398,7 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf
|
|||||||
os.remove('owasp.tar.gz')
|
os.remove('owasp.tar.gz')
|
||||||
|
|
||||||
command = "wget https://" + modSec.mirrorPath + "/modsec/owasp.tar.gz"
|
command = "wget https://" + modSec.mirrorPath + "/modsec/owasp.tar.gz"
|
||||||
result = subprocess.call(shlex.split(command))
|
result = ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
if result == 1:
|
if result == 1:
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class mysqlUtilities:
|
|||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
with open(tempStoragePath+"/"+databaseName+'.sql', 'w') as f:
|
with open(tempStoragePath+"/"+databaseName+'.sql', 'w') as f:
|
||||||
res = subprocess.call(cmd,stdout=f)
|
res = ProcessUtilities.executioner(cmd,stdout=f)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
logging.CyberCPLogFileWriter.writeToFile("Database: "+databaseName + "could not be backed! [createDatabaseBackup]")
|
logging.CyberCPLogFileWriter.writeToFile("Database: "+databaseName + "could not be backed! [createDatabaseBackup]")
|
||||||
@@ -143,7 +143,7 @@ class mysqlUtilities:
|
|||||||
|
|
||||||
|
|
||||||
with open(tempStoragePath + "/" + databaseName + '.sql', 'r') as f:
|
with open(tempStoragePath + "/" + databaseName + '.sql', 'r') as f:
|
||||||
res = subprocess.call(cmd, stdin=f)
|
res = ProcessUtilities.executioner(cmd, stdin=f)
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
logging.CyberCPLogFileWriter.writeToFile("Could not restore MYSQL database: " +databaseName +"! [restoreDatabaseBackup]")
|
logging.CyberCPLogFileWriter.writeToFile("Could not restore MYSQL database: " +databaseName +"! [restoreDatabaseBackup]")
|
||||||
@@ -347,7 +347,7 @@ class mysqlUtilities:
|
|||||||
command = 'sudo mv /etc/my.cnf.bak /etc/my.cnf'
|
command = 'sudo mv /etc/my.cnf.bak /etc/my.cnf'
|
||||||
else:
|
else:
|
||||||
command = 'sudo mv /etc/mysql/my.cnf.bak /etc/mysql//my.cnf'
|
command = 'sudo mv /etc/mysql/my.cnf.bak /etc/mysql//my.cnf'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
return 0, str(msg)
|
return 0, str(msg)
|
||||||
|
|
||||||
@@ -383,7 +383,7 @@ class mysqlUtilities:
|
|||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
command = 'sudo mv /etc/my.cnf.bak /etc/my.cnf'
|
command = 'sudo mv /etc/my.cnf.bak /etc/my.cnf'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
return 0, str(msg)
|
return 0, str(msg)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class phpUtilities:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with open(phpUtilities.installLogPath, 'w') as f:
|
with open(phpUtilities.installLogPath, 'w') as f:
|
||||||
subprocess.call(cmd, stdout=f)
|
ProcessUtilities.executioner(cmd, stdout=f)
|
||||||
|
|
||||||
writeToFile = open(phpUtilities.installLogPath, 'a')
|
writeToFile = open(phpUtilities.installLogPath, 'a')
|
||||||
writeToFile.writelines("PHP Extension Installed.\n")
|
writeToFile.writelines("PHP Extension Installed.\n")
|
||||||
@@ -59,7 +59,7 @@ class phpUtilities:
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
with open(phpUtilities.installLogPath, 'w') as f:
|
with open(phpUtilities.installLogPath, 'w') as f:
|
||||||
subprocess.call(cmd, stdout=f)
|
ProcessUtilities.executioner(cmd, stdout=f)
|
||||||
|
|
||||||
writeToFile = open(phpUtilities.installLogPath, 'a')
|
writeToFile = open(phpUtilities.installLogPath, 'a')
|
||||||
writeToFile.writelines("PHP Extension Removed.\n")
|
writeToFile.writelines("PHP Extension Removed.\n")
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class ProcessUtilities:
|
|||||||
command = "sudo /usr/local/lsws/bin/lswsctrl restart"
|
command = "sudo /usr/local/lsws/bin/lswsctrl restart"
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 0:
|
if res == 0:
|
||||||
return 1
|
return 1
|
||||||
@@ -58,7 +58,7 @@ class ProcessUtilities:
|
|||||||
command = "sudo /usr/local/lsws/bin/lswsctrl stop"
|
command = "sudo /usr/local/lsws/bin/lswsctrl stop"
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
if res == 0:
|
if res == 0:
|
||||||
return 1
|
return 1
|
||||||
@@ -68,17 +68,6 @@ class ProcessUtilities:
|
|||||||
except subprocess.CalledProcessError, msg:
|
except subprocess.CalledProcessError, msg:
|
||||||
logging.writeToFile(str(msg) + "[stopLitespeed]")
|
logging.writeToFile(str(msg) + "[stopLitespeed]")
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def executioner(command):
|
|
||||||
try:
|
|
||||||
res = subprocess.call(shlex.split(command))
|
|
||||||
if res == 0:
|
|
||||||
return 1
|
|
||||||
else:
|
|
||||||
return 0
|
|
||||||
except BaseException, msg:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def killLiteSpeed():
|
def killLiteSpeed():
|
||||||
try:
|
try:
|
||||||
@@ -118,7 +107,7 @@ class ProcessUtilities:
|
|||||||
def containerCheck():
|
def containerCheck():
|
||||||
try:
|
try:
|
||||||
command = 'sudo cat /etc/cgrules.conf'
|
command = 'sudo cat /etc/cgrules.conf'
|
||||||
result = subprocess.call(shlex.split(command))
|
result = ProcessUtilities.executioner(shlex.split(command))
|
||||||
if result == 1:
|
if result == 1:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
@@ -126,5 +115,24 @@ class ProcessUtilities:
|
|||||||
except BaseException:
|
except BaseException:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def executioner(command):
|
||||||
|
try:
|
||||||
|
res = subprocess.call(shlex.split(command))
|
||||||
|
if res == 0:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
except BaseException, msg:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def outputExecutioner(command):
|
||||||
|
return subprocess.check_output(shlex.split(command))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def popenExecutioner(command):
|
||||||
|
return subprocess.Popen(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ class remoteBackup:
|
|||||||
## complete path is a path to the file need to send
|
## complete path is a path to the file need to send
|
||||||
|
|
||||||
command = 'sudo rsync -avz -e "ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no" ' + completedPathToSend + ' root@' + IPAddress + ':/home/backup/transfer-'+folderNumber
|
command = 'sudo rsync -avz -e "ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no" ' + completedPathToSend + ' root@' + IPAddress + ':/home/backup/transfer-'+folderNumber
|
||||||
subprocess.call(shlex.split(command), stdout=writeToFile)
|
ProcessUtilities.executioner(shlex.split(command), stdout=writeToFile)
|
||||||
os.remove(completedPathToSend)
|
os.remove(completedPathToSend)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ class remoteTransferUtilities:
|
|||||||
## complete path is a path to the file need to send
|
## complete path is a path to the file need to send
|
||||||
|
|
||||||
command = "sudo scp -o StrictHostKeyChecking=no -i /root/.ssh/cyberpanel " + completedPathToSend + " root@" + IPAddress + ":/home/backup/transfer-" + folderNumber + "/"
|
command = "sudo scp -o StrictHostKeyChecking=no -i /root/.ssh/cyberpanel " + completedPathToSend + " root@" + IPAddress + ":/home/backup/transfer-" + folderNumber + "/"
|
||||||
subprocess.call(shlex.split(command), stdout=writeToFile)
|
ProcessUtilities.executioner(shlex.split(command), stdout=writeToFile)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]")
|
||||||
|
|||||||
@@ -236,14 +236,14 @@ class sslUtilities:
|
|||||||
|
|
||||||
if not os.path.exists(acmePath):
|
if not os.path.exists(acmePath):
|
||||||
command = 'wget -O - https://get.acme.sh | sh'
|
command = 'wget -O - https://get.acme.sh | sh'
|
||||||
subprocess.call(command, shell=True)
|
ProcessUtilities.executioner(command, shell=True)
|
||||||
|
|
||||||
if aliasDomain == None:
|
if aliasDomain == None:
|
||||||
|
|
||||||
existingCertPath = '/etc/letsencrypt/live/' + virtualHostName
|
existingCertPath = '/etc/letsencrypt/live/' + virtualHostName
|
||||||
if not os.path.exists(existingCertPath):
|
if not os.path.exists(existingCertPath):
|
||||||
command = 'mkdir -p ' + existingCertPath
|
command = 'mkdir -p ' + existingCertPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logging.CyberCPLogFileWriter.writeToFile("Trying to obtain SSL for: " + virtualHostName + " and: www." + virtualHostName)
|
logging.CyberCPLogFileWriter.writeToFile("Trying to obtain SSL for: " + virtualHostName + " and: www." + virtualHostName)
|
||||||
@@ -252,7 +252,7 @@ class sslUtilities:
|
|||||||
+ ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \
|
+ ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \
|
||||||
+ ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force'
|
+ ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force'
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(command))
|
output = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
logging.CyberCPLogFileWriter.writeToFile("Successfully obtained SSL for: " + virtualHostName + " and: www." + virtualHostName)
|
logging.CyberCPLogFileWriter.writeToFile("Successfully obtained SSL for: " + virtualHostName + " and: www." + virtualHostName)
|
||||||
|
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ class sslUtilities:
|
|||||||
command = acmePath + " --issue -d " + virtualHostName + ' --cert-file ' + existingCertPath \
|
command = acmePath + " --issue -d " + virtualHostName + ' --cert-file ' + existingCertPath \
|
||||||
+ '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \
|
+ '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \
|
||||||
+ ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force'
|
+ ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force'
|
||||||
output = subprocess.check_output(shlex.split(command))
|
output = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
logging.CyberCPLogFileWriter.writeToFile("Successfully obtained SSL for: " + virtualHostName)
|
logging.CyberCPLogFileWriter.writeToFile("Successfully obtained SSL for: " + virtualHostName)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
logging.CyberCPLogFileWriter.writeToFile('Failed to obtain SSL, issuing self-signed SSL for: ' + virtualHostName)
|
logging.CyberCPLogFileWriter.writeToFile('Failed to obtain SSL, issuing self-signed SSL for: ' + virtualHostName)
|
||||||
@@ -275,7 +275,7 @@ class sslUtilities:
|
|||||||
existingCertPath = '/etc/letsencrypt/live/' + virtualHostName
|
existingCertPath = '/etc/letsencrypt/live/' + virtualHostName
|
||||||
if not os.path.exists(existingCertPath):
|
if not os.path.exists(existingCertPath):
|
||||||
command = 'mkdir -p ' + existingCertPath
|
command = 'mkdir -p ' + existingCertPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
@@ -286,7 +286,7 @@ class sslUtilities:
|
|||||||
+ ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \
|
+ ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \
|
||||||
+ ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force'
|
+ ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force'
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(command))
|
output = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
"Successfully obtained SSL for: " + virtualHostName + ", www." + virtualHostName + ", " + aliasDomain + "and www." + aliasDomain + ",")
|
"Successfully obtained SSL for: " + virtualHostName + ", www." + virtualHostName + ", " + aliasDomain + "and www." + aliasDomain + ",")
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class tuning:
|
|||||||
try:
|
try:
|
||||||
dataToReturn = {}
|
dataToReturn = {}
|
||||||
command = "sudo cat /usr/local/lsws/conf/httpd_config.conf"
|
command = "sudo cat /usr/local/lsws/conf/httpd_config.conf"
|
||||||
datas = subprocess.check_output(shlex.split(command)).split("\n")
|
datas = ProcessUtilities.outputExecutioner(shlex.split(command)).split("\n")
|
||||||
|
|
||||||
for items in datas:
|
for items in datas:
|
||||||
if items.find("maxConnections")>-1:
|
if items.find("maxConnections")>-1:
|
||||||
@@ -58,7 +58,7 @@ class tuning:
|
|||||||
dataToReturn = {}
|
dataToReturn = {}
|
||||||
|
|
||||||
command = "sudo cat /usr/local/lsws/conf/httpd_config.xml"
|
command = "sudo cat /usr/local/lsws/conf/httpd_config.xml"
|
||||||
datas = subprocess.check_output(shlex.split(command))
|
datas = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
comTree = ElementTree.fromstring(datas)
|
comTree = ElementTree.fromstring(datas)
|
||||||
tuningData = comTree.find('tuning')
|
tuningData = comTree.find('tuning')
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ class tuning:
|
|||||||
path = installUtilities.Server_root_path + "/conf/vhosts/"+virtualHost+"/vhost.conf"
|
path = installUtilities.Server_root_path + "/conf/vhosts/"+virtualHost+"/vhost.conf"
|
||||||
|
|
||||||
command = "sudo cat "+path
|
command = "sudo cat "+path
|
||||||
datas = subprocess.check_output(shlex.split(command)).split("\n")
|
datas = ProcessUtilities.outputExecutioner(shlex.split(command)).split("\n")
|
||||||
|
|
||||||
dataToReturn = {}
|
dataToReturn = {}
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ class tuning:
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
command = "sudo cat /usr/local/lsws/conf/httpd_config.xml"
|
command = "sudo cat /usr/local/lsws/conf/httpd_config.xml"
|
||||||
datas = subprocess.check_output(shlex.split(command))
|
datas = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
comTree = ElementTree.fromstring(datas)
|
comTree = ElementTree.fromstring(datas)
|
||||||
extProcessorList = comTree.findall('extProcessorList/extProcessor')
|
extProcessorList = comTree.findall('extProcessorList/extProcessor')
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class Upgrade:
|
|||||||
try:
|
try:
|
||||||
count = 0
|
count = 0
|
||||||
while True:
|
while True:
|
||||||
res = subprocess.call(shlex.split(command))
|
res = ProcessUtilities.executioner(shlex.split(command))
|
||||||
if res != 0:
|
if res != 0:
|
||||||
count = count + 1
|
count = count + 1
|
||||||
Upgrade.stdOut(component + ' failed, trying again, try number: ' + str(count), 0)
|
Upgrade.stdOut(component + ' failed, trying again, try number: ' + str(count), 0)
|
||||||
@@ -89,7 +89,7 @@ class Upgrade:
|
|||||||
##
|
##
|
||||||
|
|
||||||
env_path = '/usr/local/CyberCP'
|
env_path = '/usr/local/CyberCP'
|
||||||
subprocess.call(['virtualenv', env_path])
|
ProcessUtilities.executioner(['virtualenv', env_path])
|
||||||
activate_this = os.path.join(env_path, 'bin', 'activate_this.py')
|
activate_this = os.path.join(env_path, 'bin', 'activate_this.py')
|
||||||
execfile(activate_this, dict(__file__=activate_this))
|
execfile(activate_this, dict(__file__=activate_this))
|
||||||
|
|
||||||
|
|||||||
44
plogical/upgradeCritical.py
Normal file
44
plogical/upgradeCritical.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/local/CyberCP/bin/python2
|
||||||
|
import sys
|
||||||
|
sys.path.append('/usr/local/CyberCP')
|
||||||
|
import subprocess, shlex
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class UpgradeCritical:
|
||||||
|
@staticmethod
|
||||||
|
def executioner(command):
|
||||||
|
try:
|
||||||
|
FNULL = open(os.devnull, 'w')
|
||||||
|
|
||||||
|
res = ProcessUtilities.executioner(shlex.split(command), stdout=FNULL)
|
||||||
|
if res == 0:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
except BaseException, msg:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def UpgradeImportantPackages():
|
||||||
|
if os.path.exists('/etc/lsb-release'):
|
||||||
|
|
||||||
|
command = "DEBIAN_FRONTEND=noninteractive apt-get install --only-upgrade pdns-server pdns-backend-mysql install dovecot-imapd dovecot-pop3d postfix-mysql pure-ftpd postfix dovecot-mysql -y"
|
||||||
|
UpgradeCritical.executioner(command)
|
||||||
|
else:
|
||||||
|
|
||||||
|
command = "yum update"
|
||||||
|
UpgradeCritical.executioner(command)
|
||||||
|
|
||||||
|
command = "yum -y upgrade pdns pdns-backend-mysql pure-ftpd postfix dovecot dovecot-mysql"
|
||||||
|
UpgradeCritical.executioner(command)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
UpgradeCritical.UpgradeImportantPackages()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -39,15 +39,15 @@ class vhost:
|
|||||||
command = "adduser " + virtualHostUser + " -M -d " + path
|
command = "adduser " + virtualHostUser + " -M -d " + path
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
command = "groupadd " + virtualHostUser
|
command = "groupadd " + virtualHostUser
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
command = "usermod -a -G " + virtualHostUser + " " + virtualHostUser
|
command = "usermod -a -G " + virtualHostUser + " " + virtualHostUser
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [addingUsers]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [addingUsers]")
|
||||||
@@ -60,7 +60,7 @@ class vhost:
|
|||||||
try:
|
try:
|
||||||
command = 'chmod 711 /home'
|
command = 'chmod 711 /home'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -69,11 +69,11 @@ class vhost:
|
|||||||
|
|
||||||
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + path
|
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + path
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
command = "chmod 711 " + path
|
command = "chmod 711 " + path
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
@@ -85,7 +85,7 @@ class vhost:
|
|||||||
|
|
||||||
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + pathHTML
|
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + pathHTML
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
@@ -97,7 +97,7 @@ class vhost:
|
|||||||
|
|
||||||
command = "chown " + "lscpd" + ":" + "lscpd" + " " + pathLogs
|
command = "chown " + "lscpd" + ":" + "lscpd" + " " + pathLogs
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
|
||||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||||
@@ -106,7 +106,7 @@ class vhost:
|
|||||||
command = "chmod -R 755 " + pathLogs
|
command = "chmod -R 755 " + pathLogs
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
@@ -127,7 +127,7 @@ class vhost:
|
|||||||
|
|
||||||
command = "chown " + "lsadm" + ":" + "lsadm" + " " + completePathToConfigFile
|
command = "chown " + "lsadm" + ":" + "lsadm" + " " + completePathToConfigFile
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except IOError, msg:
|
except IOError, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [createDirectories]]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [createDirectories]]")
|
||||||
@@ -149,13 +149,13 @@ class vhost:
|
|||||||
|
|
||||||
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + "/home/" + virtualHostName + "/public_html/index.html"
|
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + "/home/" + virtualHostName + "/public_html/index.html"
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
vhostPath = vhost.Server_root + "/conf/vhosts"
|
vhostPath = vhost.Server_root + "/conf/vhosts"
|
||||||
|
|
||||||
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [finalizeVhostCreation]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [finalizeVhostCreation]")
|
||||||
@@ -332,7 +332,7 @@ class vhost:
|
|||||||
## Delete mail accounts
|
## Delete mail accounts
|
||||||
|
|
||||||
command = "sudo rm -rf /home/vmail/" + virtualHostName
|
command = "sudo rm -rf /home/vmail/" + virtualHostName
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
|
||||||
return 0
|
return 0
|
||||||
@@ -368,7 +368,7 @@ class vhost:
|
|||||||
## Delete mail accounts
|
## Delete mail accounts
|
||||||
|
|
||||||
command = "sudo rm -rf /home/vmail/" + virtualHostName
|
command = "sudo rm -rf /home/vmail/" + virtualHostName
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
|
str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
|
||||||
@@ -596,7 +596,7 @@ class vhost:
|
|||||||
try:
|
try:
|
||||||
command = 'sudo chown -R cyberpanel:cyberpanel ' + path
|
command = 'sudo chown -R cyberpanel:cyberpanel ' + path
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
|
|
||||||
@@ -607,7 +607,7 @@ class vhost:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
@@ -673,12 +673,12 @@ class vhost:
|
|||||||
|
|
||||||
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + path + "/index.html"
|
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + path + "/index.html"
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
vhostPath = vhost.Server_root + "/conf/vhosts"
|
vhostPath = vhost.Server_root + "/conf/vhosts"
|
||||||
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [finalizeDomainCreation]")
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [finalizeDomainCreation]")
|
||||||
@@ -696,7 +696,7 @@ class vhost:
|
|||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + path
|
command = "chown " + virtualHostUser + ":" + virtualHostUser + " " + path
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(
|
logging.CyberCPLogFileWriter.writeToFile(
|
||||||
str(msg) + "329 [Not able to create directories for virtual host [createDirectoryForDomain]]")
|
str(msg) + "329 [Not able to create directories for virtual host [createDirectoryForDomain]]")
|
||||||
|
|||||||
@@ -166,10 +166,10 @@ class virtualHostUtilities:
|
|||||||
def getAccessLogs(fileName, page):
|
def getAccessLogs(fileName, page):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
numberOfTotalLines = int(subprocess.check_output(["wc", "-l", fileName]).split(" ")[0])
|
numberOfTotalLines = int(ProcessUtilities.outputExecutioner(["wc", "-l", fileName]).split(" ")[0])
|
||||||
|
|
||||||
if numberOfTotalLines < 25:
|
if numberOfTotalLines < 25:
|
||||||
data = subprocess.check_output(["cat", fileName])
|
data = ProcessUtilities.outputExecutioner(["cat", fileName])
|
||||||
else:
|
else:
|
||||||
if page == 1:
|
if page == 1:
|
||||||
end = numberOfTotalLines
|
end = numberOfTotalLines
|
||||||
@@ -199,10 +199,10 @@ class virtualHostUtilities:
|
|||||||
def getErrorLogs(fileName, page):
|
def getErrorLogs(fileName, page):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
numberOfTotalLines = int(subprocess.check_output(["wc", "-l", fileName]).split(" ")[0])
|
numberOfTotalLines = int(ProcessUtilities.outputExecutioner(["wc", "-l", fileName]).split(" ")[0])
|
||||||
|
|
||||||
if numberOfTotalLines < 25:
|
if numberOfTotalLines < 25:
|
||||||
data = subprocess.check_output(["cat", fileName])
|
data = ProcessUtilities.outputExecutioner(["cat", fileName])
|
||||||
else:
|
else:
|
||||||
if page == 1:
|
if page == 1:
|
||||||
end = numberOfTotalLines
|
end = numberOfTotalLines
|
||||||
@@ -303,13 +303,13 @@ class virtualHostUtilities:
|
|||||||
if not os.path.exists("latest.tar.gz"):
|
if not os.path.exists("latest.tar.gz"):
|
||||||
command = 'wget --no-check-certificate http://wordpress.org/latest.tar.gz -O latest.tar.gz'
|
command = 'wget --no-check-certificate http://wordpress.org/latest.tar.gz -O latest.tar.gz'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
command = 'tar -xzvf latest.tar.gz -C ' + finalPath
|
command = 'tar -xzvf latest.tar.gz -C ' + finalPath
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
## Get plugin
|
## Get plugin
|
||||||
|
|
||||||
@@ -318,13 +318,13 @@ class virtualHostUtilities:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
command = 'unzip litespeed-cache.1.1.5.1.zip -d ' + finalPath
|
command = 'unzip litespeed-cache.1.1.5.1.zip -d ' + finalPath
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
root = finalPath
|
root = finalPath
|
||||||
|
|
||||||
@@ -368,7 +368,7 @@ class virtualHostUtilities:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
vhost.addRewriteRules(domainName)
|
vhost.addRewriteRules(domainName)
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ class virtualHostUtilities:
|
|||||||
os.mkdir(homeDir)
|
os.mkdir(homeDir)
|
||||||
command = "chown -R " + virtualHostUser + ":" + virtualHostUser + " " + homeDir
|
command = "chown -R " + virtualHostUser + ":" + virtualHostUser + " " + homeDir
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
res = ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
print "0," + str(msg)
|
print "0," + str(msg)
|
||||||
return
|
return
|
||||||
@@ -454,7 +454,7 @@ class virtualHostUtilities:
|
|||||||
|
|
||||||
command = 'systemctl restart lscpd'
|
command = 'systemctl restart lscpd'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd)
|
ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
return 1,'None'
|
return 1,'None'
|
||||||
@@ -838,7 +838,7 @@ class virtualHostUtilities:
|
|||||||
pathToStoreSSL = '/etc/letsencrypt/live/' + virtualHost
|
pathToStoreSSL = '/etc/letsencrypt/live/' + virtualHost
|
||||||
|
|
||||||
command = 'mkdir -p ' + pathToStoreSSL
|
command = 'mkdir -p ' + pathToStoreSSL
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
pathToStoreSSLPrivKey = pathToStoreSSL + "/privkey.pem"
|
pathToStoreSSLPrivKey = pathToStoreSSL + "/privkey.pem"
|
||||||
pathToStoreSSLFullChain = pathToStoreSSL + "/fullchain.pem"
|
pathToStoreSSLFullChain = pathToStoreSSL + "/fullchain.pem"
|
||||||
@@ -863,7 +863,7 @@ class virtualHostUtilities:
|
|||||||
|
|
||||||
command = "chown " + "lsadm" + ":" + "lsadm" + " " + pathToStoreSSL
|
command = "chown " + "lsadm" + ":" + "lsadm" + " " + pathToStoreSSL
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
print "1,None"
|
print "1,None"
|
||||||
|
|
||||||
@@ -1002,7 +1002,7 @@ class virtualHostUtilities:
|
|||||||
def getDiskUsage(path, totalAllowed):
|
def getDiskUsage(path, totalAllowed):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
totalUsageInMB = subprocess.check_output(["sudo", "du", "-hs", path, "--block-size=1M"]).split()[0]
|
totalUsageInMB = ProcessUtilities.outputExecutioner(["sudo", "du", "-hs", path, "--block-size=1M"]).split()[0]
|
||||||
|
|
||||||
percentage = float(100) / float(totalAllowed)
|
percentage = float(100) / float(totalAllowed)
|
||||||
|
|
||||||
@@ -1021,7 +1021,7 @@ class virtualHostUtilities:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
@@ -1033,7 +1033,7 @@ class virtualHostUtilities:
|
|||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||||
execPath = execPath + " deleteVirtualHostConfigurations --virtualHostName " + websiteName
|
execPath = execPath + " deleteVirtualHostConfigurations --virtualHostName " + websiteName
|
||||||
subprocess.check_output(shlex.split(execPath))
|
ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
data_ret = {'status': 1, 'websiteDeleteStatus': 1, 'error_message': "None"}
|
data_ret = {'status': 1, 'websiteDeleteStatus': 1, 'error_message': "None"}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
@@ -321,7 +321,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||||
execPath = execPath + " deleteDomain --virtualHostName " + websiteName
|
execPath = execPath + " deleteDomain --virtualHostName " + websiteName
|
||||||
subprocess.check_output(shlex.split(execPath))
|
ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
data_ret = {'status': 1, 'websiteDeleteStatus': 1, 'error_message': "None"}
|
data_ret = {'status': 1, 'websiteDeleteStatus': 1, 'error_message': "None"}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
@@ -346,18 +346,18 @@ class WebsiteManager:
|
|||||||
if state == "Suspend":
|
if state == "Suspend":
|
||||||
confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + websiteName
|
confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + websiteName
|
||||||
command = "sudo mv " + confPath + " " + confPath + "-suspended"
|
command = "sudo mv " + confPath + " " + confPath + "-suspended"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
website.state = 0
|
website.state = 0
|
||||||
else:
|
else:
|
||||||
confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + websiteName
|
confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + websiteName
|
||||||
|
|
||||||
command = "sudo mv " + confPath + "-suspended" + " " + confPath
|
command = "sudo mv " + confPath + "-suspended" + " " + confPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + confPath
|
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + confPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd)
|
ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
website.state = 1
|
website.state = 1
|
||||||
@@ -506,7 +506,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " changePHP --phpVersion '" + phpVersion + "' --path " + completePathToConfigFile
|
execPath = execPath + " changePHP --phpVersion '" + phpVersion + "' --path " + completePathToConfigFile
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
pass
|
pass
|
||||||
@@ -574,7 +574,7 @@ class WebsiteManager:
|
|||||||
execPath = execPath + " findDomainBW --virtualHostName " + self.domain + " --bandwidth " + str(
|
execPath = execPath + " findDomainBW --virtualHostName " + self.domain + " --bandwidth " + str(
|
||||||
website.package.bandwidth)
|
website.package.bandwidth)
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
bwData = output.split(",")
|
bwData = output.split(",")
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
@@ -639,7 +639,7 @@ class WebsiteManager:
|
|||||||
execPath = execPath + " findDomainBW --virtualHostName " + self.domain + " --bandwidth " + str(
|
execPath = execPath + " findDomainBW --virtualHostName " + self.domain + " --bandwidth " + str(
|
||||||
website.package.bandwidth)
|
website.package.bandwidth)
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
bwData = output.split(",")
|
bwData = output.split(",")
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
@@ -695,7 +695,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " getAccessLogs --path " + fileName + " --page " + str(page)
|
execPath = execPath + " getAccessLogs --path " + fileName + " --page " + str(page)
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
final_json = json.dumps(
|
final_json = json.dumps(
|
||||||
@@ -757,7 +757,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " getErrorLogs --path " + fileName + " --page " + str(page)
|
execPath = execPath + " getErrorLogs --path " + fileName + " --page " + str(page)
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
final_json = json.dumps(
|
final_json = json.dumps(
|
||||||
@@ -783,7 +783,7 @@ class WebsiteManager:
|
|||||||
filePath = installUtilities.Server_root_path + "/conf/vhosts/" + self.domain + "/vhost.conf"
|
filePath = installUtilities.Server_root_path + "/conf/vhosts/" + self.domain + "/vhost.conf"
|
||||||
|
|
||||||
command = 'sudo cat ' + filePath
|
command = 'sudo cat ' + filePath
|
||||||
configData = subprocess.check_output(shlex.split(command))
|
configData = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
if len(configData) == 0:
|
if len(configData) == 0:
|
||||||
status = {'status': 0, "configstatus": 0, "error_message": "Configuration file is currently empty!"}
|
status = {'status': 0, "configstatus": 0, "error_message": "Configuration file is currently empty!"}
|
||||||
@@ -825,7 +825,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " saveVHostConfigs --path " + filePath + " --tempPath " + tempPath
|
execPath = execPath + " saveVHostConfigs --path " + filePath + " --tempPath " + tempPath
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
status = {"configstatus": 1}
|
status = {"configstatus": 1}
|
||||||
@@ -908,7 +908,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " saveRewriteRules --virtualHostName " + self.domain + " --path " + filePath + " --tempPath " + tempPath
|
execPath = execPath + " saveRewriteRules --virtualHostName " + self.domain + " --path " + filePath + " --tempPath " + tempPath
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
status = {"rewriteStatus": 1, 'error_message': output}
|
status = {"rewriteStatus": 1, 'error_message': output}
|
||||||
@@ -953,7 +953,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " saveSSL --virtualHostName " + self.domain + " --tempKeyPath " + tempKeyPath + " --tempCertPath " + tempCertPath
|
execPath = execPath + " saveSSL --virtualHostName " + self.domain + " --tempKeyPath " + tempKeyPath + " --tempCertPath " + tempCertPath
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'sslStatus': 1, 'error_message': "None"}
|
data_ret = {'sslStatus': 1, 'error_message': "None"}
|
||||||
@@ -986,7 +986,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " changePHP --phpVersion '" + phpVersion + "' --path " + completePathToConfigFile
|
execPath = execPath + " changePHP --phpVersion '" + phpVersion + "' --path " + completePathToConfigFile
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
pass
|
pass
|
||||||
@@ -1036,8 +1036,8 @@ class WebsiteManager:
|
|||||||
crons = []
|
crons = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# f = subprocess.check_output(["sudo", "cat", cronPath])
|
# f = ProcessUtilities.outputExecutioner(["sudo", "cat", cronPath])
|
||||||
f = subprocess.check_output(["sudo", "crontab", "-u", website.externalApp, "-l"])
|
f = ProcessUtilities.outputExecutioner(["sudo", "crontab", "-u", website.externalApp, "-l"])
|
||||||
except subprocess.CalledProcessError as error:
|
except subprocess.CalledProcessError as error:
|
||||||
dic = {'getWebsiteCron': 0, 'error_message': 'Unable to access Cron file'}
|
dic = {'getWebsiteCron': 0, 'error_message': 'Unable to access Cron file'}
|
||||||
json_data = json.dumps(dic)
|
json_data = json.dumps(dic)
|
||||||
@@ -1093,8 +1093,8 @@ class WebsiteManager:
|
|||||||
crons = []
|
crons = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# f = subprocess.check_output(["sudo", "cat", cronPath])
|
# f = ProcessUtilities.outputExecutioner(["sudo", "cat", cronPath])
|
||||||
f = subprocess.check_output(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
f = ProcessUtilities.outputExecutioner(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
||||||
print f
|
print f
|
||||||
except subprocess.CalledProcessError as error:
|
except subprocess.CalledProcessError as error:
|
||||||
dic = {'getWebsiteCron': 0, 'error_message': 'Unable to access Cron file'}
|
dic = {'getWebsiteCron': 0, 'error_message': 'Unable to access Cron file'}
|
||||||
@@ -1161,7 +1161,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
finalCron = "%s %s %s %s %s %s" % (minute, hour, monthday, month, weekday, command)
|
finalCron = "%s %s %s %s %s %s" % (minute, hour, monthday, month, weekday, command)
|
||||||
|
|
||||||
output = subprocess.check_output(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
output = ProcessUtilities.outputExecutioner(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
||||||
|
|
||||||
if "no crontab for" in output:
|
if "no crontab for" in output:
|
||||||
data_ret = {'addNewCron': 0, 'error_message': 'crontab file does not exists for user'}
|
data_ret = {'addNewCron': 0, 'error_message': 'crontab file does not exists for user'}
|
||||||
@@ -1172,7 +1172,7 @@ class WebsiteManager:
|
|||||||
file.write(output)
|
file.write(output)
|
||||||
|
|
||||||
# Confirming that directory is read/writable
|
# Confirming that directory is read/writable
|
||||||
o = subprocess.call(['sudo', 'chown', 'cyberpanel:cyberpanel', tempPath])
|
o = ProcessUtilities.executioner(['sudo', 'chown', 'cyberpanel:cyberpanel', tempPath])
|
||||||
if o is not 0:
|
if o is not 0:
|
||||||
data_ret = {'addNewCron': 0, 'error_message': 'Error Changing Permissions'}
|
data_ret = {'addNewCron': 0, 'error_message': 'Error Changing Permissions'}
|
||||||
final_json = json.dumps(data_ret)
|
final_json = json.dumps(data_ret)
|
||||||
@@ -1186,7 +1186,7 @@ class WebsiteManager:
|
|||||||
with open(tempPath, 'w') as file:
|
with open(tempPath, 'w') as file:
|
||||||
file.writelines(data)
|
file.writelines(data)
|
||||||
|
|
||||||
output = subprocess.call(["sudo", "/usr/bin/crontab", "-u", website.externalApp, tempPath])
|
output = ProcessUtilities.executioner(["sudo", "/usr/bin/crontab", "-u", website.externalApp, tempPath])
|
||||||
|
|
||||||
os.remove(tempPath)
|
os.remove(tempPath)
|
||||||
if output != 0:
|
if output != 0:
|
||||||
@@ -1222,7 +1222,7 @@ class WebsiteManager:
|
|||||||
line -= 1
|
line -= 1
|
||||||
website = Websites.objects.get(domain=self.domain)
|
website = Websites.objects.get(domain=self.domain)
|
||||||
|
|
||||||
output = subprocess.check_output(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
output = ProcessUtilities.outputExecutioner(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
||||||
|
|
||||||
if "no crontab for" in output:
|
if "no crontab for" in output:
|
||||||
data_ret = {'addNewCron': 0, 'error_message': 'No Cron exists for this user'}
|
data_ret = {'addNewCron': 0, 'error_message': 'No Cron exists for this user'}
|
||||||
@@ -1235,7 +1235,7 @@ class WebsiteManager:
|
|||||||
file.write(output)
|
file.write(output)
|
||||||
|
|
||||||
# Confirming that directory is read/writable
|
# Confirming that directory is read/writable
|
||||||
o = subprocess.call(['sudo', 'chown', 'cyberpanel:cyberpanel', tempPath])
|
o = ProcessUtilities.executioner(['sudo', 'chown', 'cyberpanel:cyberpanel', tempPath])
|
||||||
if o is not 0:
|
if o is not 0:
|
||||||
data_ret = {'addNewCron': 0, 'error_message': 'Error Changing Permissions'}
|
data_ret = {'addNewCron': 0, 'error_message': 'Error Changing Permissions'}
|
||||||
final_json = json.dumps(data_ret)
|
final_json = json.dumps(data_ret)
|
||||||
@@ -1249,7 +1249,7 @@ class WebsiteManager:
|
|||||||
with open(tempPath, 'w') as file:
|
with open(tempPath, 'w') as file:
|
||||||
file.writelines(data)
|
file.writelines(data)
|
||||||
|
|
||||||
output = subprocess.call(["sudo", "/usr/bin/crontab", "-u", website.externalApp, tempPath])
|
output = ProcessUtilities.executioner(["sudo", "/usr/bin/crontab", "-u", website.externalApp, tempPath])
|
||||||
|
|
||||||
os.remove(tempPath)
|
os.remove(tempPath)
|
||||||
if output != 0:
|
if output != 0:
|
||||||
@@ -1291,23 +1291,23 @@ class WebsiteManager:
|
|||||||
website = Websites.objects.get(domain=self.domain)
|
website = Websites.objects.get(domain=self.domain)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
output = ProcessUtilities.outputExecutioner(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
subprocess.call(('sudo', 'crontab', '-u', website.externalApp, '-'))
|
ProcessUtilities.executioner(('sudo', 'crontab', '-u', website.externalApp, '-'))
|
||||||
except:
|
except:
|
||||||
data_ret = {'addNewCron': 0, 'error_message': 'Unable to initialise crontab file for user'}
|
data_ret = {'addNewCron': 0, 'error_message': 'Unable to initialise crontab file for user'}
|
||||||
final_json = json.dumps(data_ret)
|
final_json = json.dumps(data_ret)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
output = subprocess.check_output(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
output = ProcessUtilities.outputExecutioner(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
||||||
|
|
||||||
if "no crontab for" in output:
|
if "no crontab for" in output:
|
||||||
echo = subprocess.Popen((['cat', '/dev/null']), stdout=subprocess.PIPE)
|
echo = subprocess.Popen((['cat', '/dev/null']), stdout=subprocess.PIPE)
|
||||||
subprocess.call(('sudo', 'crontab', '-u', website.externalApp, '-'), stdin=echo.stdout)
|
ProcessUtilities.executioner(('sudo', 'crontab', '-u', website.externalApp, '-'), stdin=echo.stdout)
|
||||||
echo.wait()
|
echo.wait()
|
||||||
echo.stdout.close()
|
echo.stdout.close()
|
||||||
output = subprocess.check_output(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
output = ProcessUtilities.outputExecutioner(["sudo", "/usr/bin/crontab", "-u", website.externalApp, "-l"])
|
||||||
if "no crontab for" in output:
|
if "no crontab for" in output:
|
||||||
data_ret = {'addNewCron': 0, 'error_message': 'Unable to initialise crontab file for user'}
|
data_ret = {'addNewCron': 0, 'error_message': 'Unable to initialise crontab file for user'}
|
||||||
final_json = json.dumps(data_ret)
|
final_json = json.dumps(data_ret)
|
||||||
@@ -1320,7 +1320,7 @@ class WebsiteManager:
|
|||||||
with open(tempPath, "a") as file:
|
with open(tempPath, "a") as file:
|
||||||
file.write(output + finalCron + "\n")
|
file.write(output + finalCron + "\n")
|
||||||
|
|
||||||
output = subprocess.call(["sudo", "/usr/bin/crontab", "-u", website.externalApp, tempPath])
|
output = ProcessUtilities.executioner(["sudo", "/usr/bin/crontab", "-u", website.externalApp, tempPath])
|
||||||
|
|
||||||
os.remove(tempPath)
|
os.remove(tempPath)
|
||||||
if output != 0:
|
if output != 0:
|
||||||
@@ -1363,7 +1363,7 @@ class WebsiteManager:
|
|||||||
execPath = execPath + " createAlias --masterDomain " + self.domain + " --aliasDomain " + aliasDomain + " --ssl " + str(
|
execPath = execPath + " createAlias --masterDomain " + self.domain + " --aliasDomain " + aliasDomain + " --ssl " + str(
|
||||||
ssl) + " --sslPath " + sslpath + " --administratorEmail " + admin.email + ' --websiteOwner ' + admin.userName
|
ssl) + " --sslPath " + sslpath + " --administratorEmail " + admin.email + ' --websiteOwner ' + admin.userName
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
pass
|
pass
|
||||||
@@ -1408,7 +1408,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " issueAliasSSL --masterDomain " + self.domain + " --aliasDomain " + aliasDomain + " --sslPath " + sslpath + " --administratorEmail " + admin.email
|
execPath = execPath + " issueAliasSSL --masterDomain " + self.domain + " --aliasDomain " + aliasDomain + " --sslPath " + sslpath + " --administratorEmail " + admin.email
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'sslStatus': 1, 'error_message': "None", "existsStatus": 0}
|
data_ret = {'sslStatus': 1, 'error_message': "None", "existsStatus": 0}
|
||||||
@@ -1444,7 +1444,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " deleteAlias --masterDomain " + self.domain + " --aliasDomain " + aliasDomain
|
execPath = execPath + " deleteAlias --masterDomain " + self.domain + " --aliasDomain " + aliasDomain
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'deleteAlias': 1, 'error_message': "None", "existsStatus": 0}
|
data_ret = {'deleteAlias': 1, 'error_message': "None", "existsStatus": 0}
|
||||||
@@ -1478,7 +1478,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
execPath = execPath + " changeOpenBasedir --virtualHostName '" + self.domain + "' --openBasedirValue " + openBasedirValue
|
execPath = execPath + " changeOpenBasedir --virtualHostName '" + self.domain + "' --openBasedirValue " + openBasedirValue
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
pass
|
pass
|
||||||
@@ -1566,7 +1566,7 @@ class WebsiteManager:
|
|||||||
|
|
||||||
if lastLine.find('[200]') > -1:
|
if lastLine.find('[200]') > -1:
|
||||||
command = 'sudo rm -f ' + statusFile
|
command = 'sudo rm -f ' + statusFile
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
data_ret = {'abort': 1, 'installStatus': 1, 'installationProgress': "100",
|
data_ret = {'abort': 1, 'installStatus': 1, 'installationProgress': "100",
|
||||||
'currentStatus': 'Successfully Installed.'}
|
'currentStatus': 'Successfully Installed.'}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
@@ -1802,7 +1802,7 @@ Host gitlab.com
|
|||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
command = 'sudo cat /root/.ssh/git.pub'
|
command = 'sudo cat /root/.ssh/git.pub'
|
||||||
deploymentKey = subprocess.check_output(shlex.split(command)).strip('\n')
|
deploymentKey = ProcessUtilities.outputExecutioner(shlex.split(command)).strip('\n')
|
||||||
|
|
||||||
return render(request, 'websiteFunctions/setupGit.html',
|
return render(request, 'websiteFunctions/setupGit.html',
|
||||||
{'domainName': self.domain, 'deploymentKey': deploymentKey, 'installed': 0})
|
{'domainName': self.domain, 'deploymentKey': deploymentKey, 'installed': 0})
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class pluginInstaller:
|
|||||||
def extractPlugin(pluginName):
|
def extractPlugin(pluginName):
|
||||||
pathToPlugin = pluginName + '.zip'
|
pathToPlugin = pluginName + '.zip'
|
||||||
command = 'unzip ' + pathToPlugin + ' -d /usr/local/CyberCP'
|
command = 'unzip ' + pathToPlugin + ' -d /usr/local/CyberCP'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def upgradingSettingsFile(pluginName):
|
def upgradingSettingsFile(pluginName):
|
||||||
@@ -65,7 +65,7 @@ class pluginInstaller:
|
|||||||
|
|
||||||
pluginFile = pluginPath + '/' + pluginName
|
pluginFile = pluginPath + '/' + pluginName
|
||||||
command = 'touch ' + pluginFile
|
command = 'touch ' + pluginFile
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def addInterfaceLink(pluginName):
|
def addInterfaceLink(pluginName):
|
||||||
@@ -87,15 +87,15 @@ class pluginInstaller:
|
|||||||
currentDir = os.getcwd()
|
currentDir = os.getcwd()
|
||||||
|
|
||||||
command = "rm -rf /usr/local/lscp/cyberpanel/static"
|
command = "rm -rf /usr/local/lscp/cyberpanel/static"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
os.chdir('/usr/local/CyberCP')
|
os.chdir('/usr/local/CyberCP')
|
||||||
|
|
||||||
command = "python manage.py collectstatic --noinput"
|
command = "python manage.py collectstatic --noinput"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = "mv /usr/local/CyberCP/static /usr/local/lscp/cyberpanel"
|
command = "mv /usr/local/CyberCP/static /usr/local/lscp/cyberpanel"
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
os.chdir(currentDir)
|
os.chdir(currentDir)
|
||||||
@@ -106,10 +106,10 @@ class pluginInstaller:
|
|||||||
|
|
||||||
if os.path.exists(pluginHome + '/pre_install'):
|
if os.path.exists(pluginHome + '/pre_install'):
|
||||||
command = 'chmod +x ' + pluginHome + '/pre_install'
|
command = 'chmod +x ' + pluginHome + '/pre_install'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = pluginHome + '/pre_install'
|
command = pluginHome + '/pre_install'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def postScript(pluginName):
|
def postScript(pluginName):
|
||||||
@@ -117,10 +117,10 @@ class pluginInstaller:
|
|||||||
|
|
||||||
if os.path.exists(pluginHome + '/post_install'):
|
if os.path.exists(pluginHome + '/post_install'):
|
||||||
command = 'chmod +x ' + pluginHome + '/post_install'
|
command = 'chmod +x ' + pluginHome + '/post_install'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = pluginHome + '/post_install'
|
command = pluginHome + '/post_install'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -286,7 +286,7 @@ class pluginInstaller:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def restartGunicorn():
|
def restartGunicorn():
|
||||||
command = 'systemctl restart gunicorn.socket'
|
command = 'systemctl restart gunicorn.socket'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ def getLogsFromFile(request):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
command = "sudo tail -50 " + fileName
|
command = "sudo tail -50 " + fileName
|
||||||
fewLinesOfLogFile = subprocess.check_output(shlex.split(command))
|
fewLinesOfLogFile = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
status = {"status": 1, "logstatus": 1, "logsdata": fewLinesOfLogFile}
|
status = {"status": 1, "logstatus": 1, "logsdata": fewLinesOfLogFile}
|
||||||
final_json = json.dumps(status)
|
final_json = json.dumps(status)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
@@ -175,7 +175,7 @@ def clearLogFile(request):
|
|||||||
|
|
||||||
execPath = execPath + " cleanLogFile --fileName " + fileName
|
execPath = execPath + " cleanLogFile --fileName " + fileName
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'cleanStatus': 1, 'error_message': "None"}
|
data_ret = {'cleanStatus': 1, 'error_message': "None"}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class ServerStatusUtil:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def executioner(command, statusFile):
|
def executioner(command, statusFile):
|
||||||
try:
|
try:
|
||||||
res = subprocess.call(shlex.split(command), stdout=statusFile, stderr=statusFile)
|
res = ProcessUtilities.executioner(shlex.split(command), stdout=statusFile, stderr=statusFile)
|
||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
@@ -94,7 +94,7 @@ class ServerStatusUtil:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
command = 'chown -R lsadm:lsadm ' + confPath
|
command = 'chown -R lsadm:lsadm ' + confPath
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ class ServerStatusUtil:
|
|||||||
FNULL = open(os.devnull, 'w')
|
FNULL = open(os.devnull, 'w')
|
||||||
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
@@ -209,7 +209,7 @@ class ServerStatusUtil:
|
|||||||
FNULL = open(os.devnull, 'w')
|
FNULL = open(os.devnull, 'w')
|
||||||
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
ProcessUtilities.executioner(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ def litespeedStatus(request):
|
|||||||
OLS = 1
|
OLS = 1
|
||||||
try:
|
try:
|
||||||
|
|
||||||
versionInformation = subprocess.check_output(["/usr/local/lsws/bin/lshttpd", "-v"]).split("\n")
|
versionInformation = ProcessUtilities.outputExecutioner(["/usr/local/lsws/bin/lshttpd", "-v"]).split("\n")
|
||||||
lsversion = versionInformation[0]
|
lsversion = versionInformation[0]
|
||||||
modules = versionInformation[1]
|
modules = versionInformation[1]
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ def servicesStatus(request):
|
|||||||
mailStatus = []
|
mailStatus = []
|
||||||
dockerStatus = []
|
dockerStatus = []
|
||||||
|
|
||||||
processlist = subprocess.check_output(['ps', '-A'])
|
processlist = ProcessUtilities.outputExecutioner(['ps', '-A'])
|
||||||
|
|
||||||
def getServiceStats(service):
|
def getServiceStats(service):
|
||||||
if service in processlist:
|
if service in processlist:
|
||||||
@@ -309,7 +309,7 @@ def servicesAction(request):
|
|||||||
|
|
||||||
command = 'sudo systemctl %s %s' % (action, service)
|
command = 'sudo systemctl %s %s' % (action, service)
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = ProcessUtilities.executioner(cmd)
|
||||||
|
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||||
result = p.communicate()[0]
|
result = p.communicate()[0]
|
||||||
@@ -366,7 +366,7 @@ def switchTOLSWSStatus(request):
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
command = 'sudo cat ' + serverStatusUtil.ServerStatusUtil.lswsInstallStatusPath
|
command = 'sudo cat ' + serverStatusUtil.ServerStatusUtil.lswsInstallStatusPath
|
||||||
output = subprocess.check_output(shlex.split(command))
|
output = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
if output.find('[404]') > -1:
|
if output.find('[404]') > -1:
|
||||||
data_ret = {'abort': 1, 'requestStatus': output, 'installed': 0}
|
data_ret = {'abort': 1, 'requestStatus': output, 'installed': 0}
|
||||||
@@ -400,10 +400,10 @@ def licenseStatus(request):
|
|||||||
return ACLManager.loadErrorJson('status', 0)
|
return ACLManager.loadErrorJson('status', 0)
|
||||||
|
|
||||||
command = 'sudo cat /usr/local/lsws/conf/serial.no'
|
command = 'sudo cat /usr/local/lsws/conf/serial.no'
|
||||||
serial = subprocess.check_output(shlex.split(command))
|
serial = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo /usr/local/lsws/bin/lshttpd -V'
|
command = 'sudo /usr/local/lsws/bin/lshttpd -V'
|
||||||
expiration = subprocess.check_output(shlex.split(command))
|
expiration = ProcessUtilities.outputExecutioner(shlex.split(command))
|
||||||
|
|
||||||
final_dic = {'status': 1, "erroMessage": 0, 'lsSerial': serial, 'lsexpiration': expiration}
|
final_dic = {'status': 1, "erroMessage": 0, 'lsSerial': serial, 'lsexpiration': expiration}
|
||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
@@ -435,7 +435,7 @@ def changeLicense(request):
|
|||||||
newKey = data['newKey']
|
newKey = data['newKey']
|
||||||
|
|
||||||
command = 'sudo chown -R cyberpanel:cyberpanel /usr/local/lsws/conf'
|
command = 'sudo chown -R cyberpanel:cyberpanel /usr/local/lsws/conf'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
serialPath = '/usr/local/lsws/conf/serial.no'
|
serialPath = '/usr/local/lsws/conf/serial.no'
|
||||||
serialFile = open(serialPath, 'w')
|
serialFile = open(serialPath, 'w')
|
||||||
@@ -443,13 +443,13 @@ def changeLicense(request):
|
|||||||
serialFile.close()
|
serialFile.close()
|
||||||
|
|
||||||
command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
|
command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo /usr/local/lsws/bin/lshttpd -r'
|
command = 'sudo /usr/local/lsws/bin/lshttpd -r'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo /usr/local/lsws/bin/lswsctrl restart'
|
command = 'sudo /usr/local/lsws/bin/lswsctrl restart'
|
||||||
subprocess.call(shlex.split(command))
|
ProcessUtilities.executioner(shlex.split(command))
|
||||||
|
|
||||||
final_dic = {'status': 1, "erroMessage": 'None'}
|
final_dic = {'status': 1, "erroMessage": 'None'}
|
||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
@@ -488,7 +488,7 @@ def topProcessesStatus(request):
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
with open("/home/cyberpanel/top", "w") as outfile:
|
with open("/home/cyberpanel/top", "w") as outfile:
|
||||||
subprocess.call("sudo top -n1 -b", shell=True, stdout=outfile)
|
ProcessUtilities.executioner("sudo top -n1 -b", shell=True, stdout=outfile)
|
||||||
|
|
||||||
data = open('/home/cyberpanel/top', 'r').readlines()
|
data = open('/home/cyberpanel/top', 'r').readlines()
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ def topProcessesStatus(request):
|
|||||||
## CPU Details
|
## CPU Details
|
||||||
|
|
||||||
command = 'sudo cat /proc/cpuinfo'
|
command = 'sudo cat /proc/cpuinfo'
|
||||||
output = subprocess.check_output(shlex.split(command)).splitlines()
|
output = ProcessUtilities.outputExecutioner(shlex.split(command)).splitlines()
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class tuningManager:
|
|||||||
|
|
||||||
execPath = execPath + " saveTuningDetails --maxConn " + maxConn + " --maxSSLConn " + maxSSLConn + " --connTime " + connTime + " --keepAlive " + keepAlive + " --inMemCache '" + inMemCache + "' --gzipCompression " + gzipCompression
|
execPath = execPath + " saveTuningDetails --maxConn " + maxConn + " --maxSSLConn " + maxSSLConn + " --connTime " + connTime + " --keepAlive " + keepAlive + " --inMemCache '" + inMemCache + "' --gzipCompression " + gzipCompression
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'fetch_status': 1, 'error_message': "None", 'tuneStatus': 1}
|
data_ret = {'fetch_status': 1, 'error_message': "None", 'tuneStatus': 1}
|
||||||
@@ -166,7 +166,7 @@ class tuningManager:
|
|||||||
|
|
||||||
execPath = execPath + " tunePHP --virtualHost " + domainSelection + " --initTimeout " + initTimeout + " --maxConns " + maxConns + " --memSoftLimit " + memSoftLimit + " --memHardLimit '" + memHardLimit + "' --procSoftLimit " + procSoftLimit + " --procHardLimit " + procHardLimit + " --persistConn " + persistConn
|
execPath = execPath + " tunePHP --virtualHost " + domainSelection + " --initTimeout " + initTimeout + " --maxConns " + maxConns + " --memSoftLimit " + memSoftLimit + " --memHardLimit '" + memHardLimit + "' --procSoftLimit " + procSoftLimit + " --procHardLimit " + procHardLimit + " --persistConn " + persistConn
|
||||||
|
|
||||||
output = subprocess.check_output(shlex.split(execPath))
|
output = ProcessUtilities.outputExecutioner(shlex.split(execPath))
|
||||||
|
|
||||||
if output.find("1,None") > -1:
|
if output.find("1,None") > -1:
|
||||||
data_ret = {'tuneStatus': 1, 'fetch_status': 0, 'error_message': "None"}
|
data_ret = {'tuneStatus': 1, 'fetch_status': 0, 'error_message': "None"}
|
||||||
|
|||||||
Reference in New Issue
Block a user