mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-11 15:56:11 +01:00
combine robert changes
This commit is contained in:
@@ -13,6 +13,8 @@ from mailServer.mailserverManager import MailServerManager
|
|||||||
from ftp.ftpManager import FTPManager
|
from ftp.ftpManager import FTPManager
|
||||||
from manageSSL.views import issueSSL
|
from manageSSL.views import issueSSL
|
||||||
from plogical.backupManager import BackupManager
|
from plogical.backupManager import BackupManager
|
||||||
|
import userManagment.views as um
|
||||||
|
from packages.packagesManager import PackagesManager
|
||||||
|
|
||||||
class CloudManager:
|
class CloudManager:
|
||||||
|
|
||||||
@@ -729,4 +731,321 @@ class CloudManager:
|
|||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
return self.ajaxPre(0, str(msg))
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def fetchACLs(self):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['userName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
|
||||||
|
userID = admin.pk
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if currentACL['admin'] == 1:
|
||||||
|
aclNames = ACLManager.unFileteredACLs()
|
||||||
|
elif currentACL['changeUserACL'] == 1:
|
||||||
|
aclNames = ACLManager.unFileteredACLs()
|
||||||
|
elif currentACL['createNewUser'] == 1:
|
||||||
|
aclNames = ['user']
|
||||||
|
else:
|
||||||
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
json_data = "["
|
||||||
|
checker = 0
|
||||||
|
|
||||||
|
for items in aclNames:
|
||||||
|
dic = {'acl': items}
|
||||||
|
|
||||||
|
if checker == 0:
|
||||||
|
json_data = json_data + json.dumps(dic)
|
||||||
|
checker = 1
|
||||||
|
else:
|
||||||
|
json_data = json_data + ',' + json.dumps(dic)
|
||||||
|
|
||||||
|
json_data = json_data + ']'
|
||||||
|
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def submitUserCreation(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
return um.submitUserCreation(request)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def fetchUsers(self):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
|
||||||
|
userID = admin.pk
|
||||||
|
allUsers = ACLManager.loadUserObjects(userID)
|
||||||
|
|
||||||
|
json_data = "["
|
||||||
|
checker = 0
|
||||||
|
|
||||||
|
for user in allUsers:
|
||||||
|
dic = {
|
||||||
|
"id": user.id,
|
||||||
|
"userName": user.userName,
|
||||||
|
"firstName": user.firstName,
|
||||||
|
"lastName": user.lastName,
|
||||||
|
"email": user.email,
|
||||||
|
"acl": user.acl.name,
|
||||||
|
"websitesLimit": user.initWebsitesLimit
|
||||||
|
}
|
||||||
|
|
||||||
|
if checker == 0:
|
||||||
|
json_data = json_data + json.dumps(dic)
|
||||||
|
checker = 1
|
||||||
|
else:
|
||||||
|
json_data = json_data + ',' + json.dumps(dic)
|
||||||
|
|
||||||
|
json_data = json_data + ']'
|
||||||
|
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def submitUserDeletion(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
return um.submitUserDeletion(request)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def saveModificationsUser(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
return um.saveModifications(request)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def userWithResellerPriv(self):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
|
||||||
|
userID = admin.pk
|
||||||
|
allUsers = ACLManager.userWithResellerPriv(userID)
|
||||||
|
|
||||||
|
json_data = "["
|
||||||
|
checker = 0
|
||||||
|
|
||||||
|
for user in allUsers:
|
||||||
|
dic = {
|
||||||
|
"userName": user,
|
||||||
|
}
|
||||||
|
|
||||||
|
if checker == 0:
|
||||||
|
json_data = json_data + json.dumps(dic)
|
||||||
|
checker = 1
|
||||||
|
else:
|
||||||
|
json_data = json_data + ',' + json.dumps(dic)
|
||||||
|
|
||||||
|
json_data = json_data + ']'
|
||||||
|
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def saveResellerChanges(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
return um.saveResellerChanges(request)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def changeACLFunc(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
return um.changeACLFunc(request)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def createACLFunc(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
return um.createACLFunc(request)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def findAllACLs(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
|
||||||
|
userID = admin.pk
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if currentACL['admin'] == 1:
|
||||||
|
aclNames = ACLManager.findAllACLs()
|
||||||
|
else:
|
||||||
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
|
json_data = "["
|
||||||
|
checker = 0
|
||||||
|
|
||||||
|
for items in aclNames:
|
||||||
|
dic = {'acl': items}
|
||||||
|
|
||||||
|
if checker == 0:
|
||||||
|
json_data = json_data + json.dumps(dic)
|
||||||
|
checker = 1
|
||||||
|
else:
|
||||||
|
json_data = json_data + ',' + json.dumps(dic)
|
||||||
|
|
||||||
|
json_data = json_data + ']'
|
||||||
|
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def deleteACLFunc(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
return um.deleteACLFunc(request)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def fetchACLDetails(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
return um.fetchACLDetails(request)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def submitACLModifications(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
return um.submitACLModifications(request)
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def submitPackage(self, request):
|
||||||
|
try:
|
||||||
|
adminUser = self.data['serverUserName']
|
||||||
|
adminPass = self.data['serverPassword']
|
||||||
|
|
||||||
|
admin = Administrator.objects.get(userName=adminUser)
|
||||||
|
request.session['userID'] = admin.pk
|
||||||
|
|
||||||
|
if hashPassword.check_password(admin.password, adminPass):
|
||||||
|
pm = PackagesManager(request)
|
||||||
|
return pm.submitPackage()
|
||||||
|
else:
|
||||||
|
return self.ajaxPre(0, 'Invalid login information.')
|
||||||
|
|
||||||
|
except BaseException, msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,34 @@ def router(request):
|
|||||||
return cm.getCurrentBackups()
|
return cm.getCurrentBackups()
|
||||||
elif controller == 'deleteBackup':
|
elif controller == 'deleteBackup':
|
||||||
return cm.deleteBackup()
|
return cm.deleteBackup()
|
||||||
|
elif controller == 'fetchACLs':
|
||||||
|
return cm.fetchACLs()
|
||||||
|
elif controller == 'submitUserCreation':
|
||||||
|
return cm.submitUserCreation(request)
|
||||||
|
elif controller == 'fetchUsers':
|
||||||
|
return cm.fetchUsers()
|
||||||
|
elif controller == 'submitUserDeletion':
|
||||||
|
return cm.submitUserDeletion(request)
|
||||||
|
elif controller == 'saveModificationsUser':
|
||||||
|
return cm.saveModificationsUser(request)
|
||||||
|
elif controller == 'userWithResellerPriv':
|
||||||
|
return cm.userWithResellerPriv()
|
||||||
|
elif controller == 'saveResellerChanges':
|
||||||
|
return cm.saveResellerChanges(request)
|
||||||
|
elif controller == 'changeACLFunc':
|
||||||
|
return cm.changeACLFunc(request)
|
||||||
|
elif controller == 'createACLFunc':
|
||||||
|
return cm.createACLFunc(request)
|
||||||
|
elif controller == 'findAllACLs':
|
||||||
|
return cm.findAllACLs(request)
|
||||||
|
elif controller == 'deleteACLFunc':
|
||||||
|
return cm.deleteACLFunc(request)
|
||||||
|
elif controller == 'fetchACLDetails':
|
||||||
|
return cm.fetchACLDetails(request)
|
||||||
|
elif controller == 'submitACLModifications':
|
||||||
|
return cm.submitACLModifications(request)
|
||||||
|
elif controller == 'submitPackage':
|
||||||
|
return cm.submitPackage(request)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
cm = CloudManager(None)
|
cm = CloudManager(None)
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
|
||||||
import installLog as logging
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
import shlex
|
import shlex
|
||||||
import socket
|
|
||||||
|
|
||||||
class FirewallUtilities:
|
class FirewallUtilities:
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ import stat
|
|||||||
centos = 0
|
centos = 0
|
||||||
ubuntu = 1
|
ubuntu = 1
|
||||||
|
|
||||||
class preFlightsChecks:
|
|
||||||
|
|
||||||
|
class preFlightsChecks:
|
||||||
cyberPanelMirror = "mirror.cyberpanel.net/pip"
|
cyberPanelMirror = "mirror.cyberpanel.net/pip"
|
||||||
|
|
||||||
def __init__(self, rootPath, ip, path, cwd, cyberPanelPath, distro):
|
def __init__(self, rootPath, ip, path, cwd, cyberPanelPath, distro):
|
||||||
@@ -47,14 +47,12 @@ class preFlightsChecks:
|
|||||||
if do_exit:
|
if do_exit:
|
||||||
sys.exit(code)
|
sys.exit(code)
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pureFTPDServiceName(distro):
|
def pureFTPDServiceName(distro):
|
||||||
if distro == ubuntu:
|
if distro == ubuntu:
|
||||||
return 'pure-ftpd'
|
return 'pure-ftpd'
|
||||||
return 'pure-ftpd'
|
return 'pure-ftpd'
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resFailed(distro, res):
|
def resFailed(distro, res):
|
||||||
if distro == ubuntu and res != 0:
|
if distro == ubuntu and res != 0:
|
||||||
@@ -63,7 +61,6 @@ class preFlightsChecks:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def call(command, distro, bracket, message, log=0, do_exit=0, code=os.EX_OK):
|
def call(command, distro, bracket, message, log=0, do_exit=0, code=os.EX_OK):
|
||||||
preFlightsChecks.stdOut(message + " " + bracket, log)
|
preFlightsChecks.stdOut(message + " " + bracket, log)
|
||||||
@@ -87,7 +84,6 @@ class preFlightsChecks:
|
|||||||
break
|
break
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def checkIfSeLinuxDisabled(self):
|
def checkIfSeLinuxDisabled(self):
|
||||||
try:
|
try:
|
||||||
command = "sestatus"
|
command = "sestatus"
|
||||||
@@ -98,7 +94,8 @@ class preFlightsChecks:
|
|||||||
preFlightsChecks.stdOut("SELinux Check OK.")
|
preFlightsChecks.stdOut("SELinux Check OK.")
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("SELinux is enabled, please disable SELinux and restart the installation!")
|
logging.InstallLog.writeToFile(
|
||||||
|
"SELinux is enabled, please disable SELinux and restart the installation!")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
@@ -129,7 +126,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("SUDO install failed, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("SUDO install failed, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("We are not able to install SUDO, exiting the installer. [setup_account_cyberpanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"We are not able to install SUDO, exiting the installer. [setup_account_cyberpanel]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -201,9 +199,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("We are trying to add CyberPanel user to SUDO group, trying again, try number: " + str(count) + "\n")
|
preFlightsChecks.stdOut(
|
||||||
|
"We are trying to add CyberPanel user to SUDO group, trying again, try number: " + str(
|
||||||
|
count) + "\n")
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Not able to add user CyberPanel to SUDO group, exiting the installer. [setup_account_cyberpanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Not able to add user CyberPanel to SUDO group, exiting the installer. [setup_account_cyberpanel]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -211,7 +212,6 @@ class preFlightsChecks:
|
|||||||
preFlightsChecks.stdOut("CyberPanel user was successfully added to SUDO group!")
|
preFlightsChecks.stdOut("CyberPanel user was successfully added to SUDO group!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
path = "/etc/sudoers"
|
path = "/etc/sudoers"
|
||||||
@@ -242,9 +242,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("We are trying to create Let's Encrypt directory to store SSLs, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"We are trying to create Let's Encrypt directory to store SSLs, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Failed to create Let's Encrypt directory to store SSLs. Installer can continue without this.. [setup_account_cyberpanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Failed to create Let's Encrypt directory to store SSLs. Installer can continue without this.. [setup_account_cyberpanel]")
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Successfully created Let's Encrypt directory!")
|
logging.InstallLog.writeToFile("Successfully created Let's Encrypt directory!")
|
||||||
preFlightsChecks.stdOut("Successfully created Let's Encrypt directory!")
|
preFlightsChecks.stdOut("Successfully created Let's Encrypt directory!")
|
||||||
@@ -270,7 +273,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("YUM UPDATE FAILED, trying again, try number: " + str(count) + "\n")
|
preFlightsChecks.stdOut("YUM UPDATE FAILED, trying again, try number: " + str(count) + "\n")
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("YUM update failed to run, we are being optimistic that installer will still be able to complete installation. [yum_update]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"YUM update failed to run, we are being optimistic that installer will still be able to complete installation. [yum_update]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("YUM UPDATE ran successfully.")
|
logging.InstallLog.writeToFile("YUM UPDATE ran successfully.")
|
||||||
@@ -364,9 +368,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to add EPEL repository, trying again, try number: " + str(count) + "\n")
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to add EPEL repository, trying again, try number: " + str(count) + "\n")
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to add EPEL repository, exiting installer! [enableEPELRepo]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to add EPEL repository, exiting installer! [enableEPELRepo]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -421,9 +427,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("We are trying to install python development tools, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"We are trying to install python development tools, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to install python development tools, exiting installer! [install_python_dev]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to install python development tools, exiting installer! [install_python_dev]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -487,7 +495,6 @@ class preFlightsChecks:
|
|||||||
command = "pip uninstall --yes requests"
|
command = "pip uninstall --yes requests"
|
||||||
res = subprocess.call(shlex.split(command))
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
## Install specific versions
|
## Install specific versions
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -594,7 +601,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to install pexpect, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to install pexpect, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to install pexpect, exiting installer! [install_pexpect]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to install pexpect, exiting installer! [install_pexpect]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -613,7 +621,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to install pexpect, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to install pexpect, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to install pexpect, exiting installer! [install_pexpect]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to install pexpect, exiting installer! [install_pexpect]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -653,7 +662,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to install MySQL-python, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to install MySQL-python, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to install MySQL-python, exiting installer! [install_python_mysql_library]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to install MySQL-python, exiting installer! [install_python_mysql_library]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -707,7 +717,6 @@ class preFlightsChecks:
|
|||||||
socket = "/etc/systemd/system/gunicorn.socket"
|
socket = "/etc/systemd/system/gunicorn.socket"
|
||||||
conf = "/etc/tmpfiles.d/gunicorn.conf"
|
conf = "/etc/tmpfiles.d/gunicorn.conf"
|
||||||
|
|
||||||
|
|
||||||
shutil.copy("gun-configs/gunicorn.service", service)
|
shutil.copy("gun-configs/gunicorn.service", service)
|
||||||
shutil.copy("gun-configs/gunicorn.socket", socket)
|
shutil.copy("gun-configs/gunicorn.socket", socket)
|
||||||
shutil.copy("gun-configs/gunicorn.conf", conf)
|
shutil.copy("gun-configs/gunicorn.conf", conf)
|
||||||
@@ -726,7 +735,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to enable Gunicorn at system startup, try number: " + str(count))
|
preFlightsChecks.stdOut("Trying to enable Gunicorn at system startup, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Gunicorn will not start after system restart, you can manually enable using systemctl enable gunicorn.socket! [setup_gunicorn]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Gunicorn will not start after system restart, you can manually enable using systemctl enable gunicorn.socket! [setup_gunicorn]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
@@ -836,7 +846,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to upgrade requests, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to upgrade requests, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to install upgrade requests, exiting installer! [download_install_CyberPanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to install upgrade requests, exiting installer! [download_install_CyberPanel]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -860,7 +871,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to download CyberPanel, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to download CyberPanel, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to download CyberPanel, exiting installer! [download_install_CyberPanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to download CyberPanel, exiting installer! [download_install_CyberPanel]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -881,7 +893,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to extract CyberPanel, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to extract CyberPanel, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to extract CyberPanel. You can try to install on fresh OS again, exiting installer! [download_install_CyberPanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to extract CyberPanel. You can try to install on fresh OS again, exiting installer! [download_install_CyberPanel]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -889,8 +902,6 @@ class preFlightsChecks:
|
|||||||
preFlightsChecks.stdOut("Successfully extracted CyberPanel!")
|
preFlightsChecks.stdOut("Successfully extracted CyberPanel!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### update password:
|
### update password:
|
||||||
|
|
||||||
passFile = "/etc/cyberpanel/mysqlPassword"
|
passFile = "/etc/cyberpanel/mysqlPassword"
|
||||||
@@ -957,9 +968,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to prepare migrations file, trying again, try number: " + str(count) + "\n")
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to prepare migrations file, trying again, try number: " + str(count) + "\n")
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to prepare migrations file. You can try to install on fresh OS again, exiting installer! [download_install_CyberPanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to prepare migrations file. You can try to install on fresh OS again, exiting installer! [download_install_CyberPanel]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -978,9 +991,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to execute the migrations file, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to execute the migrations file, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to execute the migrations file, exiting installer! [download_install_CyberPanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to execute the migrations file, exiting installer! [download_install_CyberPanel]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -1001,7 +1016,6 @@ class preFlightsChecks:
|
|||||||
logging.InstallLog.writeToFile("Static content moved!")
|
logging.InstallLog.writeToFile("Static content moved!")
|
||||||
preFlightsChecks.stdOut("Static content moved!")
|
preFlightsChecks.stdOut("Static content moved!")
|
||||||
|
|
||||||
|
|
||||||
## fix permissions
|
## fix permissions
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -1012,9 +1026,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Changing permissions for '/usr/local/CyberCP' failed, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Changing permissions for '/usr/local/CyberCP' failed, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for '/usr/local/CyberCP', we are being optimistic that it is still going to work :) [download_install_CyberPanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for '/usr/local/CyberCP', we are being optimistic that it is still going to work :) [download_install_CyberPanel]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Permissions successfully changed for '/usr/local/CyberCP'")
|
logging.InstallLog.writeToFile("Permissions successfully changed for '/usr/local/CyberCP'")
|
||||||
@@ -1030,9 +1046,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change owner for '/usr/local/CyberCP', trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change owner for '/usr/local/CyberCP', trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change owner for '/usr/local/CyberCP', we are being optimistic that it is still going to work :) [download_install_CyberPanel]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change owner for '/usr/local/CyberCP', we are being optimistic that it is still going to work :) [download_install_CyberPanel]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Owner for '/usr/local/CyberCP' successfully changed!")
|
logging.InstallLog.writeToFile("Owner for '/usr/local/CyberCP' successfully changed!")
|
||||||
@@ -1124,7 +1142,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to download PYPMYAdmin, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to download PYPMYAdmin, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to download PYPMYAdmin, exiting installer! [download_install_phpmyadmin]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to download PYPMYAdmin, exiting installer! [download_install_phpmyadmin]")
|
||||||
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
else:
|
else:
|
||||||
@@ -1195,10 +1214,10 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
writeToFile = open('phpmyadmin/config.inc.php', 'w')
|
writeToFile = open('phpmyadmin/config.inc.php', 'w')
|
||||||
|
|
||||||
|
|
||||||
for items in data:
|
for items in data:
|
||||||
if items.find('blowfish_secret') > -1:
|
if items.find('blowfish_secret') > -1:
|
||||||
writeToFile.writelines("$cfg['blowfish_secret'] = '" + rString + "'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */\n")
|
writeToFile.writelines(
|
||||||
|
"$cfg['blowfish_secret'] = '" + rString + "'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */\n")
|
||||||
else:
|
else:
|
||||||
writeToFile.writelines(items)
|
writeToFile.writelines(items)
|
||||||
|
|
||||||
@@ -1220,7 +1239,6 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
###################################################### Email setup
|
###################################################### Email setup
|
||||||
|
|
||||||
|
|
||||||
@@ -1455,7 +1473,6 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def centos_lib_dir_to_ubuntu(self, filename, old, new):
|
def centos_lib_dir_to_ubuntu(self, filename, old, new):
|
||||||
try:
|
try:
|
||||||
fd = open(filename, 'r')
|
fd = open(filename, 'r')
|
||||||
@@ -1527,9 +1544,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to generate SSL for Postfix, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to generate SSL for Postfix, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to generate SSL for Postfix, you will not be able to send emails and rest should work fine! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to generate SSL for Postfix, you will not be able to send emails and rest should work fine! [setup_postfix_davecot_config]")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("SSL for Postfix generated!")
|
logging.InstallLog.writeToFile("SSL for Postfix generated!")
|
||||||
@@ -1549,17 +1568,17 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to generate ssl for Dovecot, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to generate ssl for Dovecot, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to generate SSL for Dovecot, you will not be able to send emails and rest should work fine! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to generate SSL for Dovecot, you will not be able to send emails and rest should work fine! [setup_postfix_davecot_config]")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("SSL generated for Dovecot!")
|
logging.InstallLog.writeToFile("SSL generated for Dovecot!")
|
||||||
preFlightsChecks.stdOut("SSL generated for Dovecot!")
|
preFlightsChecks.stdOut("SSL generated for Dovecot!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Cleanup config files for ubuntu
|
# Cleanup config files for ubuntu
|
||||||
if self.distro == ubuntu:
|
if self.distro == ubuntu:
|
||||||
preFlightsChecks.stdOut("Cleanup postfix/dovecot config files", 1)
|
preFlightsChecks.stdOut("Cleanup postfix/dovecot config files", 1)
|
||||||
@@ -1572,8 +1591,6 @@ class preFlightsChecks:
|
|||||||
self.centos_lib_dir_to_ubuntu("email-configs-one/main.cf", "/usr/libexec/postfix",
|
self.centos_lib_dir_to_ubuntu("email-configs-one/main.cf", "/usr/libexec/postfix",
|
||||||
"/usr/lib/postfix/sbin")
|
"/usr/lib/postfix/sbin")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########### Copy config files
|
########### Copy config files
|
||||||
|
|
||||||
if mysql == 'Two':
|
if mysql == 'Two':
|
||||||
@@ -1587,15 +1604,16 @@ class preFlightsChecks:
|
|||||||
shutil.copy("email-configs/dovecot-sql.conf.ext", davecotmysql)
|
shutil.copy("email-configs/dovecot-sql.conf.ext", davecotmysql)
|
||||||
else:
|
else:
|
||||||
shutil.copy("email-configs-one/mysql-virtual_domains.cf", "/etc/postfix/mysql-virtual_domains.cf")
|
shutil.copy("email-configs-one/mysql-virtual_domains.cf", "/etc/postfix/mysql-virtual_domains.cf")
|
||||||
shutil.copy("email-configs-one/mysql-virtual_forwardings.cf", "/etc/postfix/mysql-virtual_forwardings.cf")
|
shutil.copy("email-configs-one/mysql-virtual_forwardings.cf",
|
||||||
|
"/etc/postfix/mysql-virtual_forwardings.cf")
|
||||||
shutil.copy("email-configs-one/mysql-virtual_mailboxes.cf", "/etc/postfix/mysql-virtual_mailboxes.cf")
|
shutil.copy("email-configs-one/mysql-virtual_mailboxes.cf", "/etc/postfix/mysql-virtual_mailboxes.cf")
|
||||||
shutil.copy("email-configs-one/mysql-virtual_email2email.cf", "/etc/postfix/mysql-virtual_email2email.cf")
|
shutil.copy("email-configs-one/mysql-virtual_email2email.cf",
|
||||||
|
"/etc/postfix/mysql-virtual_email2email.cf")
|
||||||
shutil.copy("email-configs-one/main.cf", main)
|
shutil.copy("email-configs-one/main.cf", main)
|
||||||
shutil.copy("email-configs-one/master.cf", master)
|
shutil.copy("email-configs-one/master.cf", master)
|
||||||
shutil.copy("email-configs-one/dovecot.conf", davecot)
|
shutil.copy("email-configs-one/dovecot.conf", davecot)
|
||||||
shutil.copy("email-configs-one/dovecot-sql.conf.ext", davecotmysql)
|
shutil.copy("email-configs-one/dovecot-sql.conf.ext", davecotmysql)
|
||||||
|
|
||||||
|
|
||||||
######################################## Permissions
|
######################################## Permissions
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -1610,9 +1628,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change permissions for mysql-virtual_domains.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change permissions for mysql-virtual_domains.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for mysql-virtual_domains.cf. [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for mysql-virtual_domains.cf. [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Permissions changed for mysql-virtual_domains.cf!")
|
logging.InstallLog.writeToFile("Permissions changed for mysql-virtual_domains.cf!")
|
||||||
@@ -1633,16 +1654,18 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change permissions for mysql-virtual_forwardings.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change permissions for mysql-virtual_forwardings.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for mysql-virtual_forwardings.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for mysql-virtual_forwardings.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Permissions changed for mysql-virtual_forwardings.cf!")
|
logging.InstallLog.writeToFile("Permissions changed for mysql-virtual_forwardings.cf!")
|
||||||
preFlightsChecks.stdOut("Permissions changed for mysql-virtual_forwardings.cf!")
|
preFlightsChecks.stdOut("Permissions changed for mysql-virtual_forwardings.cf!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -1655,9 +1678,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change permissions for mysql-virtual_mailboxes.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change permissions for mysql-virtual_mailboxes.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for mysql-virtual_mailboxes.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for mysql-virtual_mailboxes.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Permissions changed for mysql-virtual_mailboxes.cf!")
|
logging.InstallLog.writeToFile("Permissions changed for mysql-virtual_mailboxes.cf!")
|
||||||
@@ -1677,9 +1703,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change permissions for mysql-virtual_email2email.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change permissions for mysql-virtual_email2email.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for mysql-virtual_email2email.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for mysql-virtual_email2email.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Permissions changed for mysql-virtual_email2email.cf!")
|
logging.InstallLog.writeToFile("Permissions changed for mysql-virtual_email2email.cf!")
|
||||||
@@ -1698,9 +1727,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change permissions for /etc/postfix/main.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change permissions for /etc/postfix/main.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for /etc/postfix/main.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for /etc/postfix/main.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Permissions changed for /etc/postfix/main.cf!")
|
logging.InstallLog.writeToFile("Permissions changed for /etc/postfix/main.cf!")
|
||||||
@@ -1721,16 +1753,18 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change permissions for /etc/postfix/master.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change permissions for /etc/postfix/master.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for /etc/postfix/master.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for /etc/postfix/master.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Permissions changed for /etc/postfix/master.cf!")
|
logging.InstallLog.writeToFile("Permissions changed for /etc/postfix/master.cf!")
|
||||||
preFlightsChecks.stdOut("Permissions changed for /etc/postfix/master.cf!")
|
preFlightsChecks.stdOut("Permissions changed for /etc/postfix/master.cf!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -1744,9 +1778,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change group for mysql-virtual_domains.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change group for mysql-virtual_domains.cf, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change group for mysql-virtual_domains.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change group for mysql-virtual_domains.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Group changed for mysql-virtual_domains.cf!")
|
logging.InstallLog.writeToFile("Group changed for mysql-virtual_domains.cf!")
|
||||||
@@ -1764,9 +1800,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change group for mysql-virtual_forwardings.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change group for mysql-virtual_forwardings.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change group for mysql-virtual_forwardings.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change group for mysql-virtual_forwardings.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Group changed for mysql-virtual_forwardings.cf!")
|
logging.InstallLog.writeToFile("Group changed for mysql-virtual_forwardings.cf!")
|
||||||
@@ -1784,9 +1823,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change group for mysql-virtual_mailboxes.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change group for mysql-virtual_mailboxes.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change group for mysql-virtual_mailboxes.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change group for mysql-virtual_mailboxes.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Group changed for mysql-virtual_mailboxes.cf!")
|
logging.InstallLog.writeToFile("Group changed for mysql-virtual_mailboxes.cf!")
|
||||||
@@ -1805,9 +1847,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change group for mysql-virtual_email2email.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change group for mysql-virtual_email2email.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change group for mysql-virtual_email2email.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change group for mysql-virtual_email2email.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Group changed for mysql-virtual_email2email.cf!")
|
logging.InstallLog.writeToFile("Group changed for mysql-virtual_email2email.cf!")
|
||||||
@@ -1824,9 +1869,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change group for /etc/postfix/main.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change group for /etc/postfix/main.cf, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change group for /etc/postfix/main.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change group for /etc/postfix/main.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Group changed for /etc/postfix/main.cf!")
|
logging.InstallLog.writeToFile("Group changed for /etc/postfix/main.cf!")
|
||||||
@@ -1847,16 +1894,17 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change group for /etc/postfix/master.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change group for /etc/postfix/master.cf, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change group for /etc/postfix/master.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change group for /etc/postfix/master.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Group changed for /etc/postfix/master.cf!")
|
logging.InstallLog.writeToFile("Group changed for /etc/postfix/master.cf!")
|
||||||
preFlightsChecks.stdOut("Group changed for /etc/postfix/master.cf!")
|
preFlightsChecks.stdOut("Group changed for /etc/postfix/master.cf!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
######################################## users and groups
|
######################################## users and groups
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -1873,7 +1921,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to add system group vmail, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to add system group vmail, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to add system group vmail! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to add system group vmail! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("System group vmail created successfully!")
|
logging.InstallLog.writeToFile("System group vmail created successfully!")
|
||||||
@@ -1896,14 +1945,14 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to add system user vmail, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to add system user vmail, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to add system user vmail! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to add system user vmail! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("System user vmail created successfully!")
|
logging.InstallLog.writeToFile("System user vmail created successfully!")
|
||||||
preFlightsChecks.stdOut("System user vmail created successfully!")
|
preFlightsChecks.stdOut("System user vmail created successfully!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
######################################## Further configurations
|
######################################## Further configurations
|
||||||
|
|
||||||
# hostname = socket.gethostname()
|
# hostname = socket.gethostname()
|
||||||
@@ -1922,9 +1971,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to add Postfix to system startup, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Trying to add Postfix to system startup, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Failed to enable Postfix to run at system restart you can manually do this using systemctl enable postfix.service! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Failed to enable Postfix to run at system restart you can manually do this using systemctl enable postfix.service! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("postfix.service successfully enabled!")
|
logging.InstallLog.writeToFile("postfix.service successfully enabled!")
|
||||||
@@ -1947,7 +1998,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to start Postfix, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Trying to start Postfix, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to start Postfix, you can not send email until you manually start Postfix using systemctl start postfix.service! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to start Postfix, you can not send email until you manually start Postfix using systemctl start postfix.service! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("postfix.service started successfully!")
|
logging.InstallLog.writeToFile("postfix.service started successfully!")
|
||||||
@@ -1968,9 +2020,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change group for /etc/dovecot/dovecot-sql.conf.ext, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change group for /etc/dovecot/dovecot-sql.conf.ext, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change group for /etc/dovecot/dovecot-sql.conf.ext! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change group for /etc/dovecot/dovecot-sql.conf.ext! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Group changed for /etc/dovecot/dovecot-sql.conf.ext!")
|
logging.InstallLog.writeToFile("Group changed for /etc/dovecot/dovecot-sql.conf.ext!")
|
||||||
@@ -1991,9 +2046,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change permissions for /etc/dovecot/dovecot-sql.conf.ext, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change permissions for /etc/dovecot/dovecot-sql.conf.ext, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for /etc/dovecot/dovecot-sql.conf.ext! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for /etc/dovecot/dovecot-sql.conf.ext! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Permissions changed for /etc/dovecot/dovecot-sql.conf.ext!")
|
logging.InstallLog.writeToFile("Permissions changed for /etc/dovecot/dovecot-sql.conf.ext!")
|
||||||
@@ -2004,7 +2062,6 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
|
|
||||||
while (1):
|
while (1):
|
||||||
|
|
||||||
command = 'systemctl enable dovecot.service'
|
command = 'systemctl enable dovecot.service'
|
||||||
@@ -2017,20 +2074,19 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to enable dovecot.service, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to enable dovecot.service, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to enable dovecot.service! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to enable dovecot.service! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("dovecot.service successfully enabled!")
|
logging.InstallLog.writeToFile("dovecot.service successfully enabled!")
|
||||||
preFlightsChecks.stdOut("dovecot.service successfully enabled!")
|
preFlightsChecks.stdOut("dovecot.service successfully enabled!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
|
|
||||||
while (1):
|
while (1):
|
||||||
command = 'systemctl start dovecot.service'
|
command = 'systemctl start dovecot.service'
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
@@ -2040,7 +2096,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to start dovecot.service, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to start dovecot.service, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to start dovecot.service! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to start dovecot.service! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("dovecot.service successfully started!")
|
logging.InstallLog.writeToFile("dovecot.service successfully started!")
|
||||||
@@ -2061,16 +2118,17 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to restart postfix.service, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to restart postfix.service, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to restart postfix.service! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to restart postfix.service! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("dovecot.service successfully restarted!")
|
logging.InstallLog.writeToFile("dovecot.service successfully restarted!")
|
||||||
preFlightsChecks.stdOut("postfix.service successfully restarted!")
|
preFlightsChecks.stdOut("postfix.service successfully restarted!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
## chaging permissions for main.cf
|
## chaging permissions for main.cf
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -2083,9 +2141,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change permissions for /etc/postfix/main.cf, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change permissions for /etc/postfix/main.cf, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for /etc/postfix/main.cf! [setup_postfix_davecot_config]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for /etc/postfix/main.cf! [setup_postfix_davecot_config]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Permissions changed for /etc/postfix/main.cf!")
|
logging.InstallLog.writeToFile("Permissions changed for /etc/postfix/main.cf!")
|
||||||
@@ -2126,7 +2187,6 @@ class preFlightsChecks:
|
|||||||
command = "systemctl restart dovecot"
|
command = "systemctl restart dovecot"
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
|
|
||||||
logging.InstallLog.writeToFile("Postfix and Dovecot configured")
|
logging.InstallLog.writeToFile("Postfix and Dovecot configured")
|
||||||
|
|
||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
@@ -2138,7 +2198,6 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def downoad_and_install_raindloop(self):
|
def downoad_and_install_raindloop(self):
|
||||||
try:
|
try:
|
||||||
###########
|
###########
|
||||||
@@ -2151,9 +2210,12 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to change owner for /usr/local/lscp/cyberpanel/, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Trying to change owner for /usr/local/lscp/cyberpanel/, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Failed to change owner for /usr/local/lscp/cyberpanel/, but installer can continue! [downoad_and_install_raindloop]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Failed to change owner for /usr/local/lscp/cyberpanel/, but installer can continue! [downoad_and_install_raindloop]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Owner changed for /usr/local/lscp/cyberpanel/!")
|
logging.InstallLog.writeToFile("Owner changed for /usr/local/lscp/cyberpanel/!")
|
||||||
@@ -2177,7 +2239,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to download Rainloop, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Trying to download Rainloop, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to download Rainloop, installation can continue but you will not be able to send emails! [downoad_and_install_raindloop]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to download Rainloop, installation can continue but you will not be able to send emails! [downoad_and_install_raindloop]")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Rainloop Downloaded!")
|
logging.InstallLog.writeToFile("Rainloop Downloaded!")
|
||||||
@@ -2199,7 +2262,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to unzip rainloop, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Trying to unzip rainloop, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("We could not unzip Rainloop, so you will not be able to send emails! [downoad_and_install_raindloop]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"We could not unzip Rainloop, so you will not be able to send emails! [downoad_and_install_raindloop]")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Rainloop successfully unzipped!")
|
logging.InstallLog.writeToFile("Rainloop successfully unzipped!")
|
||||||
@@ -2221,9 +2285,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to change permissions for Rainloop, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Trying to change permissions for Rainloop, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Failed to change permissions for Rainloop, so you will not be able to send emails!! [downoad_and_install_raindloop]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Failed to change permissions for Rainloop, so you will not be able to send emails!! [downoad_and_install_raindloop]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Rainloop permissions changed!")
|
logging.InstallLog.writeToFile("Rainloop permissions changed!")
|
||||||
@@ -2243,9 +2309,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to change permissions for Rainloop, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Trying to change permissions for Rainloop, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Failed to change permissions for Rainloop, so you will not be able to send emails!! [downoad_and_install_raindloop]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Failed to change permissions for Rainloop, so you will not be able to send emails!! [downoad_and_install_raindloop]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Rainloop permissions changed!")
|
logging.InstallLog.writeToFile("Rainloop permissions changed!")
|
||||||
@@ -2263,9 +2331,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to change owner for Rainloop, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Trying to change owner for Rainloop, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Failed to change owner for Rainloop, so you will not be able to send emails!! [downoad_and_install_raindloop]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Failed to change owner for Rainloop, so you will not be able to send emails!! [downoad_and_install_raindloop]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Rainloop owner changed!")
|
logging.InstallLog.writeToFile("Rainloop owner changed!")
|
||||||
@@ -2317,7 +2387,6 @@ class preFlightsChecks:
|
|||||||
return 0
|
return 0
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def removeUfw(self):
|
def removeUfw(self):
|
||||||
try:
|
try:
|
||||||
preFlightsChecks.stdOut("Checking to see if ufw firewall is installed (will be removed)", 1)
|
preFlightsChecks.stdOut("Checking to see if ufw firewall is installed (will be removed)", 1)
|
||||||
@@ -2352,7 +2421,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to install FirewallD, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to install FirewallD, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to install FirewallD, funtions related to Firewall will not work! [installFirewalld]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to install FirewallD, funtions related to Firewall will not work! [installFirewalld]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("FirewallD successfully installed!")
|
logging.InstallLog.writeToFile("FirewallD successfully installed!")
|
||||||
@@ -2381,14 +2451,14 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to start FirewallD, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Unable to start FirewallD, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to start FirewallD, you can manually start it later using systemctl start firewalld! [installFirewalld]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to start FirewallD, you can manually start it later using systemctl start firewalld! [installFirewalld]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("FirewallD successfully started!")
|
logging.InstallLog.writeToFile("FirewallD successfully started!")
|
||||||
preFlightsChecks.stdOut("FirewallD successfully started!")
|
preFlightsChecks.stdOut("FirewallD successfully started!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
##########
|
##########
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -2401,16 +2471,17 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to enable FirewallD at system startup, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Trying to enable FirewallD at system startup, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("FirewallD may not start after restart, you need to manually run systemctl enable firewalld ! [installFirewalld]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"FirewallD may not start after restart, you need to manually run systemctl enable firewalld ! [installFirewalld]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("FirewallD successfully enabled on system startup!")
|
logging.InstallLog.writeToFile("FirewallD successfully enabled on system startup!")
|
||||||
preFlightsChecks.stdOut("FirewallD successfully enabled on system startup!")
|
preFlightsChecks.stdOut("FirewallD successfully enabled on system startup!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
FirewallUtilities.addRule("tcp", "8090")
|
FirewallUtilities.addRule("tcp", "8090")
|
||||||
FirewallUtilities.addRule("tcp", "80")
|
FirewallUtilities.addRule("tcp", "80")
|
||||||
FirewallUtilities.addRule("tcp", "443")
|
FirewallUtilities.addRule("tcp", "443")
|
||||||
@@ -2462,12 +2533,16 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Unable to change permissions for /usr/local/lscp/bin/lscpdctrl, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Unable to change permissions for /usr/local/lscp/bin/lscpdctrl, trying again, try number: " + str(
|
||||||
|
count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for /usr/local/lscp/bin/lscpdctrl [setupLSCPDDaemon]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for /usr/local/lscp/bin/lscpdctrl [setupLSCPDDaemon]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Successfully changed permissions for /usr/local/lscp/bin/lscpdctrl!")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Successfully changed permissions for /usr/local/lscp/bin/lscpdctrl!")
|
||||||
preFlightsChecks.stdOut("Successfully changed permissions for /usr/local/lscp/bin/lscpdctrl!")
|
preFlightsChecks.stdOut("Successfully changed permissions for /usr/local/lscp/bin/lscpdctrl!")
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -2483,9 +2558,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to enable LSCPD on system startup, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Trying to enable LSCPD on system startup, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to change permissions for /usr/local/lscp/bin/lscpdctrl, you can do it manually using systemctl enable lscpd.service [setupLSCPDDaemon]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to change permissions for /usr/local/lscp/bin/lscpdctrl, you can do it manually using systemctl enable lscpd.service [setupLSCPDDaemon]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("LSCPD Successfully enabled at system startup!")
|
logging.InstallLog.writeToFile("LSCPD Successfully enabled at system startup!")
|
||||||
@@ -2558,14 +2635,14 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to install cronie, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Trying to install cronie, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to install cronie, cron jobs will not work. [setup_cron]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to install cronie, cron jobs will not work. [setup_cron]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Cronie successfully installed!")
|
logging.InstallLog.writeToFile("Cronie successfully installed!")
|
||||||
preFlightsChecks.stdOut("Cronie successfully installed!")
|
preFlightsChecks.stdOut("Cronie successfully installed!")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
while (1):
|
while (1):
|
||||||
@@ -2580,9 +2657,11 @@ class preFlightsChecks:
|
|||||||
|
|
||||||
if preFlightsChecks.resFailed(self.distro, res):
|
if preFlightsChecks.resFailed(self.distro, res):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to enable cronie on system startup, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut(
|
||||||
|
"Trying to enable cronie on system startup, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("We are not able to enable cron jobs at system startup, you can manually run systemctl enable crond. [setup_cron]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"We are not able to enable cron jobs at system startup, you can manually run systemctl enable crond. [setup_cron]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Cronie successfully enabled at system startup!")
|
logging.InstallLog.writeToFile("Cronie successfully enabled at system startup!")
|
||||||
@@ -2603,7 +2682,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to start crond, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Trying to start crond, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("We are not able to start crond, you can manually run systemctl start crond. [setup_cron]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"We are not able to start crond, you can manually run systemctl start crond. [setup_cron]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Crond successfully started!")
|
logging.InstallLog.writeToFile("Crond successfully started!")
|
||||||
@@ -2651,7 +2731,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to restart crond, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Trying to restart crond, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("We are not able to restart crond, you can manually run systemctl restart crond. [setup_cron]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"We are not able to restart crond, you can manually run systemctl restart crond. [setup_cron]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Crond successfully restarted!")
|
logging.InstallLog.writeToFile("Crond successfully restarted!")
|
||||||
@@ -2722,7 +2803,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to install rsync, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Trying to install rsync, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to install rsync, some of backup functions will not work. [install_rsync]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to install rsync, some of backup functions will not work. [install_rsync]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Succcessfully installed rsync!")
|
logging.InstallLog.writeToFile("Succcessfully installed rsync!")
|
||||||
@@ -2939,7 +3021,8 @@ class preFlightsChecks:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
preFlightsChecks.stdOut("Trying to install opendkim, trying again, try number: " + str(count))
|
preFlightsChecks.stdOut("Trying to install opendkim, trying again, try number: " + str(count))
|
||||||
if count == 3:
|
if count == 3:
|
||||||
logging.InstallLog.writeToFile("Unable to install opendkim, your mail may not end up in inbox. [installOpenDKIM]")
|
logging.InstallLog.writeToFile(
|
||||||
|
"Unable to install opendkim, your mail may not end up in inbox. [installOpenDKIM]")
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logging.InstallLog.writeToFile("Succcessfully installed opendkim!")
|
logging.InstallLog.writeToFile("Succcessfully installed opendkim!")
|
||||||
@@ -2988,7 +3071,6 @@ InternalHosts refile:/etc/opendkim/TrustedHosts
|
|||||||
writeToFile.write(configData)
|
writeToFile.write(configData)
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
|
|
||||||
## Configure postfix specific settings
|
## Configure postfix specific settings
|
||||||
|
|
||||||
postfixFilePath = "/etc/postfix/main.cf"
|
postfixFilePath = "/etc/postfix/main.cf"
|
||||||
@@ -3013,7 +3095,6 @@ milter_default_action = accept
|
|||||||
writeToFile.writelines(items)
|
writeToFile.writelines(items)
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
|
|
||||||
#### Restarting Postfix and OpenDKIM
|
#### Restarting Postfix and OpenDKIM
|
||||||
|
|
||||||
command = "systemctl start opendkim"
|
command = "systemctl start opendkim"
|
||||||
@@ -3370,6 +3451,7 @@ milter_default_action = accept
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def get_distro():
|
def get_distro():
|
||||||
distro = -1
|
distro = -1
|
||||||
distro_file = ""
|
distro_file = ""
|
||||||
@@ -3396,6 +3478,7 @@ def get_distro():
|
|||||||
|
|
||||||
return distro
|
return distro
|
||||||
|
|
||||||
|
|
||||||
def get_Ubuntu_release():
|
def get_Ubuntu_release():
|
||||||
release = -1
|
release = -1
|
||||||
if exists("/etc/lsb-release"):
|
if exists("/etc/lsb-release"):
|
||||||
@@ -3416,8 +3499,8 @@ def get_Ubuntu_release():
|
|||||||
|
|
||||||
return release
|
return release
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
parser = argparse.ArgumentParser(description='CyberPanel Installer')
|
||||||
parser.add_argument('publicip', help='Please enter public IP for your VPS or dedicated server.')
|
parser.add_argument('publicip', help='Please enter public IP for your VPS or dedicated server.')
|
||||||
parser.add_argument('--mysql', help='Specify number of MySQL instances to be used.')
|
parser.add_argument('--mysql', help='Specify number of MySQL instances to be used.')
|
||||||
@@ -3499,7 +3582,6 @@ def main():
|
|||||||
checks.setup_email_Passwords(installCyberPanel.InstallCyberPanel.mysqlPassword, mysql)
|
checks.setup_email_Passwords(installCyberPanel.InstallCyberPanel.mysqlPassword, mysql)
|
||||||
checks.setup_postfix_davecot_config(mysql)
|
checks.setup_postfix_davecot_config(mysql)
|
||||||
|
|
||||||
|
|
||||||
checks.install_unzip()
|
checks.install_unzip()
|
||||||
checks.install_zip()
|
checks.install_zip()
|
||||||
checks.install_rsync()
|
checks.install_rsync()
|
||||||
|
|||||||
Binary file not shown.
@@ -69,6 +69,10 @@ class PackagesManager:
|
|||||||
ftpAccounts = int(data['ftpAccounts'])
|
ftpAccounts = int(data['ftpAccounts'])
|
||||||
emails = int(data['emails'])
|
emails = int(data['emails'])
|
||||||
allowedDomains = int(data['allowedDomains'])
|
allowedDomains = int(data['allowedDomains'])
|
||||||
|
try:
|
||||||
|
api = data['api']
|
||||||
|
except:
|
||||||
|
api = '0'
|
||||||
|
|
||||||
if packageSpace < 0 or packageBandwidth < 0 or packageDatabases < 0 or ftpAccounts < 0 or emails < 0 or allowedDomains < 0:
|
if packageSpace < 0 or packageBandwidth < 0 or packageDatabases < 0 or ftpAccounts < 0 or emails < 0 or allowedDomains < 0:
|
||||||
data_ret = {'saveStatus': 0, 'error_message': "All values should be positive or 0."}
|
data_ret = {'saveStatus': 0, 'error_message': "All values should be positive or 0."}
|
||||||
@@ -77,6 +81,7 @@ class PackagesManager:
|
|||||||
|
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
|
if api == '0':
|
||||||
packageName = admin.userName + "_" + packageName
|
packageName = admin.userName + "_" + packageName
|
||||||
|
|
||||||
package = Package(admin=admin, packageName=packageName, diskSpace=packageSpace,
|
package = Package(admin=admin, packageName=packageName, diskSpace=packageSpace,
|
||||||
@@ -85,12 +90,12 @@ class PackagesManager:
|
|||||||
|
|
||||||
package.save()
|
package.save()
|
||||||
|
|
||||||
data_ret = {'saveStatus': 1, 'error_message': "None"}
|
data_ret = {'status': 1, 'saveStatus': 1, 'error_message': "None"}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
data_ret = {'saveStatus': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'saveStatus': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,24 @@ class ACLManager:
|
|||||||
adminNames.append(admin.userName)
|
adminNames.append(admin.userName)
|
||||||
return adminNames
|
return adminNames
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def loadUserObjects(userID):
|
||||||
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
adminObjects = []
|
||||||
|
|
||||||
|
finalResponse = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if finalResponse['admin'] == 1:
|
||||||
|
return Administrator.objects.all()
|
||||||
|
else:
|
||||||
|
admins = Administrator.objects.filter(owner=admin.pk)
|
||||||
|
for items in admins:
|
||||||
|
adminObjects.append(items)
|
||||||
|
|
||||||
|
adminObjects.append(admin)
|
||||||
|
|
||||||
|
return adminObjects
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def loadDeletionUsers(userID, finalResponse):
|
def loadDeletionUsers(userID, finalResponse):
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|||||||
@@ -1,33 +1,35 @@
|
|||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
|
||||||
import CyberCPLogFileWriter as logging
|
import CyberCPLogFileWriter as logging
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
import shlex
|
import shlex
|
||||||
import socket
|
from processUtilities import ProcessUtilities
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FirewallUtilities:
|
class FirewallUtilities:
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def resFailed(res):
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu and res != 0:
|
||||||
|
return True
|
||||||
|
elif ProcessUtilities.decideDistro() == ProcessUtilities.centos and res == 1:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def doCommand(command):
|
def doCommand(command):
|
||||||
import install as inst
|
|
||||||
try:
|
try:
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
res = subprocess.call(cmd)
|
res = subprocess.call(cmd)
|
||||||
if inst.preFlightsChecks.resFailed(inst.get_distro(), res):
|
if FirewallUtilities.resFailed(res):
|
||||||
inst.preFlightsChecks.stdOut("Failed to apply rule: " + command + " Error #" + str(res), 1)
|
logging.CyberCPLogFileWriter.writeToFile("Failed to apply rule: " + command + " Error #" + str(res))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
inst.preFlightsChecks.stdOut("Failed to apply rule: " + command + " Error: " + str(msg), 1)
|
logging.CyberCPLogFileWriter.writeToFile("Failed to apply rule: " + command + " Error: " + str(msg))
|
||||||
return 0
|
return 0
|
||||||
except ValueError, msg:
|
except ValueError, msg:
|
||||||
inst.preFlightsChecks.stdOut("Failed to apply rule: " + command + " Error: " + str(msg), 1)
|
logging.CyberCPLogFileWriter.writeToFile("Failed to apply rule: " + command + " Error: " + str(msg), 1)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@ class FirewallUtilities:
|
|||||||
|
|
||||||
command = "sudo firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
command = "sudo firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
||||||
|
|
||||||
if not FirewallUtilities.doComamnd(command):
|
if not FirewallUtilities.doCommand(command):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
ruleFamily = 'rule family="ipv6"'
|
ruleFamily = 'rule family="ipv6"'
|
||||||
@@ -49,12 +51,12 @@ class FirewallUtilities:
|
|||||||
|
|
||||||
command = "sudo firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
command = "sudo firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
||||||
|
|
||||||
if not FirewallUtilities.doComamnd(command):
|
if not FirewallUtilities.doCommand(command):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
command = 'sudo firewall-cmd --reload'
|
command = 'sudo firewall-cmd --reload'
|
||||||
|
|
||||||
if not FirewallUtilities.doComamnd(command):
|
if not FirewallUtilities.doCommand(command):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
@@ -68,7 +70,7 @@ class FirewallUtilities:
|
|||||||
|
|
||||||
command = "sudo firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
command = "sudo firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
||||||
|
|
||||||
if not FirewallUtilities.doComamnd(command):
|
if not FirewallUtilities.doCommand(command):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
ruleFamily = 'rule family="ipv6"'
|
ruleFamily = 'rule family="ipv6"'
|
||||||
@@ -76,12 +78,12 @@ class FirewallUtilities:
|
|||||||
|
|
||||||
command = "sudo firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
command = "sudo firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
|
||||||
|
|
||||||
if not FirewallUtilities.doComamnd(command):
|
if not FirewallUtilities.doCommand(command):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
command = 'sudo firewall-cmd --reload'
|
command = 'sudo firewall-cmd --reload'
|
||||||
|
|
||||||
if not FirewallUtilities.doComamnd(command):
|
if not FirewallUtilities.doCommand(command):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
@@ -1268,9 +1268,6 @@ app.controller('modifyACLCtrl', function($scope,$http) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
/* Java script code to create acl ends here */
|
/* Java script code to create acl ends here */
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "ACL Name" %}</label>
|
<label class="col-sm-3 control-label">{% trans "ACL Name" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input placeholder="E.g support" type="text" class="form-control" ng-model="aclName" required>
|
<input placeholder="E.g support" type="text" class="form-control" ng-model="aclName"
|
||||||
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -352,7 +353,7 @@
|
|||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input ng-model="scheDuleBackups" type="checkbox" value="">
|
<input ng-model="scheDuleBackups" type="checkbox" value="">
|
||||||
{% trans "Achedule Back up" %}
|
{% trans "Schedule Back up" %}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -402,21 +403,20 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label"></label>
|
<label class="col-sm-3 control-label"></label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<button type="button" ng-click="createACLFunc()" class="btn btn-primary btn-lg btn-block">{% trans "Create ACL" %} <img ng-hide="aclLoading" src="{% static 'images/loading.gif' %}"></button>
|
<button type="button" ng-click="createACLFunc()"
|
||||||
|
class="btn btn-primary btn-lg btn-block">{% trans "Create ACL" %} <img
|
||||||
|
ng-hide="aclLoading" src="{% static 'images/loading.gif' %}"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div ng-controller="createUserCtr" class="panel-body">
|
<div ng-controller="createUserCtr" class="panel-body">
|
||||||
<h3 class="title-hero">
|
<h3 class="title-hero">
|
||||||
{% trans "User Details" %} <img ng-hide="userCreationLoading" src="{% static 'images/loading.gif' %}">
|
{% trans "User Details" %} <img ng-hide="userCreationLoading"
|
||||||
|
src="{% static 'images/loading.gif' %}">
|
||||||
</h3>
|
</h3>
|
||||||
<div class="example-box-wrapper">
|
<div class="example-box-wrapper">
|
||||||
|
|
||||||
@@ -27,18 +28,22 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "First Name" %}</label>
|
<label class="col-sm-3 control-label">{% trans "First Name" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input name="firstName" ng-pattern="/^[a-zA-Z]+$/" type="text" class="form-control" ng-model="firstName" required>
|
<input name="firstName" ng-pattern="/^[a-zA-Z]+$/" type="text" class="form-control"
|
||||||
|
ng-model="firstName" required>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="createUser.firstName.$error.pattern" class="current-pack">{% trans "First Name should contain only alphabetic characters." %}</div>
|
<div ng-show="createUser.firstName.$error.pattern"
|
||||||
|
class="current-pack">{% trans "First Name should contain only alphabetic characters." %}</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Last Name" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Last Name" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input name="lastName" ng-pattern="/^[a-zA-Z]+$/" type="text" class="form-control" ng-model="lastName" required>
|
<input name="lastName" ng-pattern="/^[a-zA-Z]+$/" type="text" class="form-control"
|
||||||
|
ng-model="lastName" required>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="createUser.lastName.$error.pattern" class="current-pack">{% trans "Last Name should contain only alphabetic characters." %}</div>
|
<div ng-show="createUser.lastName.$error.pattern"
|
||||||
|
class="current-pack">{% trans "Last Name should contain only alphabetic characters." %}</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -48,12 +53,12 @@
|
|||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input name="email" type="email" class="form-control" ng-model="email" required>
|
<input name="email" type="email" class="form-control" ng-model="email" required>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="createUser.email.$error.email" class="current-pack">{% trans "Invalid Email" %}</div>
|
<div ng-show="createUser.email.$error.email"
|
||||||
|
class="current-pack">{% trans "Invalid Email" %}</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!------------ Account ACL ------------>
|
<!------------ Account ACL ------------>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -73,7 +78,8 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Websites Limit" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Websites Limit" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input placeholder="0 = Unlimited" type="number" class="form-control" ng-model="websitesLimits" required>
|
<input placeholder="0 = Unlimited" type="number" class="form-control"
|
||||||
|
ng-model="websitesLimits" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -85,31 +91,31 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Password" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Password" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input name="password" type="password" class="form-control" ng-model="password" required>
|
<input name="password" type="password" class="form-control" ng-model="password"
|
||||||
|
required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label"></label>
|
<label class="col-sm-3 control-label"></label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<button type="button" ng-click="createUserFunc()" class="btn btn-primary btn-lg btn-block">{% trans "Create User" %}</button>
|
<button type="button" ng-click="createUserFunc()"
|
||||||
|
class="btn btn-primary btn-lg btn-block">{% trans "Create User" %}</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label"></label>
|
<label class="col-sm-3 control-label"></label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<div ng-hide="userCreated" class="alert alert-success">
|
<div ng-hide="userCreated" class="alert alert-success">
|
||||||
<p>{% trans "Account with username:" %} <strong>{$ userName $}</strong> {% trans "is successfully created." %}</p>
|
<p>{% trans "Account with username:" %} <strong>{$ userName
|
||||||
|
$}</strong> {% trans "is successfully created." %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-hide="userCreationFailed" class="alert alert-danger">
|
<div ng-hide="userCreationFailed" class="alert alert-danger">
|
||||||
@@ -125,25 +131,20 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,14 @@ from plogical import hashPassword
|
|||||||
from plogical import CyberCPLogFileWriter as logging
|
from plogical import CyberCPLogFileWriter as logging
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
def loadUserHome(request):
|
def loadUserHome(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
try:
|
try:
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=val)
|
admin = Administrator.objects.get(pk=val)
|
||||||
|
|
||||||
return render(request, 'userManagment/index.html', {"type": admin.type})
|
return render(request, 'userManagment/index.html', {"type": admin.type})
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
@@ -27,6 +26,7 @@ def loadUserHome(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def viewProfile(request):
|
def viewProfile(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -46,6 +46,7 @@ def viewProfile(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def createUser(request):
|
def createUser(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -67,6 +68,7 @@ def createUser(request):
|
|||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitUserCreation(request):
|
def submitUserCreation(request):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -94,7 +96,7 @@ def submitUserCreation(request):
|
|||||||
currentAdmin = Administrator.objects.get(pk=userID)
|
currentAdmin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
if ACLManager.websitesLimitCheck(currentAdmin, websitesLimit) == 0:
|
if ACLManager.websitesLimitCheck(currentAdmin, websitesLimit) == 0:
|
||||||
data_ret = {'createStatus': 0,
|
data_ret = {'status': 0, 'createStatus': 0,
|
||||||
'error_message': "You've reached maximum websites limit as a reseller."}
|
'error_message': "You've reached maximum websites limit as a reseller."}
|
||||||
|
|
||||||
final_json = json.dumps(data_ret)
|
final_json = json.dumps(data_ret)
|
||||||
@@ -141,27 +143,28 @@ def submitUserCreation(request):
|
|||||||
)
|
)
|
||||||
newAdmin.save()
|
newAdmin.save()
|
||||||
else:
|
else:
|
||||||
data_ret = {'createStatus': 0,
|
data_ret = {'status': 0, 'createStatus': 0,
|
||||||
'error_message': "You are not authorized to access this resource."}
|
'error_message': "You are not authorized to access this resource."}
|
||||||
|
|
||||||
final_json = json.dumps(data_ret)
|
final_json = json.dumps(data_ret)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
data_ret = {'createStatus': 1,
|
data_ret = {'status': 1, 'createStatus': 1,
|
||||||
'error_message': "None"}
|
'error_message': "None"}
|
||||||
final_json = json.dumps(data_ret)
|
final_json = json.dumps(data_ret)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
data_ret = {'createStatus': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'createStatus': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
data_ret = {'createStatus': 0, 'error_message': "Not logged in as admin",}
|
data_ret = {'status': 0, 'createStatus': 0, 'error_message': "Not logged in as admin", }
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def modifyUsers(request):
|
def modifyUsers(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -170,6 +173,7 @@ def modifyUsers(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchUserDetails(request):
|
def fetchUserDetails(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -186,17 +190,19 @@ def fetchUserDetails(request):
|
|||||||
|
|
||||||
websitesLimit = user.initWebsitesLimit
|
websitesLimit = user.initWebsitesLimit
|
||||||
|
|
||||||
userDetails = {"firstName":firstName,
|
userDetails = {
|
||||||
|
"id": user.id,
|
||||||
|
"firstName": firstName,
|
||||||
"lastName": lastName,
|
"lastName": lastName,
|
||||||
"email": email,
|
"email": email,
|
||||||
"acl": user.acl.name,
|
"acl": user.acl.name,
|
||||||
"websitesLimit": websitesLimit}
|
"websitesLimit": websitesLimit
|
||||||
|
}
|
||||||
|
|
||||||
data_ret = {'fetchStatus': 1, 'error_message': 'None', "userDetails": userDetails}
|
data_ret = {'fetchStatus': 1, 'error_message': 'None', "userDetails": userDetails}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
data_ret = {'fetchStatus': 0, 'error_message': str(msg)}
|
data_ret = {'fetchStatus': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
@@ -207,6 +213,7 @@ def fetchUserDetails(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def saveModifications(request):
|
def saveModifications(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -231,20 +238,21 @@ def saveModifications(request):
|
|||||||
|
|
||||||
user.save()
|
user.save()
|
||||||
|
|
||||||
data_ret = {'saveStatus': 1, 'error_message': 'None'}
|
data_ret = {'status': 1, 'saveStatus': 1, 'error_message': 'None'}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
data_ret = {'saveStatus': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'saveStatus': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
data_ret = {'saveStatus': 0, 'error_message': "Not logged in as admin",}
|
data_ret = {'status': 0, 'saveStatus': 0, 'error_message': "Not logged in as admin", }
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def deleteUser(request):
|
def deleteUser(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -264,6 +272,7 @@ def deleteUser(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def submitUserDeletion(request):
|
def submitUserDeletion(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -275,22 +284,25 @@ def submitUserDeletion(request):
|
|||||||
|
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if accountUsername == 'admin':
|
||||||
|
data_ret = {'status': 0, 'deleteStatus': 0, 'error_message': 'You can not delete the super user.'}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
if currentACL['admin'] == 1:
|
if currentACL['admin'] == 1:
|
||||||
user = Administrator.objects.get(userName=accountUsername)
|
user = Administrator.objects.get(userName=accountUsername)
|
||||||
user.delete()
|
user.delete()
|
||||||
|
|
||||||
data_ret = {'deleteStatus': 1, 'error_message': 'None'}
|
data_ret = {'status': 1, 'deleteStatus': 1, 'error_message': 'None'}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
else:
|
else:
|
||||||
data_ret = {'deleteStatus': 1, 'error_message': 'Not enough privileges'}
|
data_ret = {'status': 0, 'deleteStatus': 1, 'error_message': 'Not enough privileges'}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
data_ret = {'deleteStatus': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'deleteStatus': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
@@ -299,6 +311,7 @@ def submitUserDeletion(request):
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def createNewACL(request):
|
def createNewACL(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -311,6 +324,7 @@ def createNewACL(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def createACLFunc(request):
|
def createACLFunc(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -389,8 +403,6 @@ def createACLFunc(request):
|
|||||||
)
|
)
|
||||||
newACL.save()
|
newACL.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
finalResponse = {'status': 1}
|
finalResponse = {'status': 1}
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadErrorJson()
|
return ACLManager.loadErrorJson()
|
||||||
@@ -398,10 +410,11 @@ def createACLFunc(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
finalResponse = {'status': 0, 'errorMessage': str(msg), 'error_message': str(msg)}
|
||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def deleteACL(request):
|
def deleteACL(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -429,17 +442,18 @@ def deleteACLFunc(request):
|
|||||||
acl.delete()
|
acl.delete()
|
||||||
finalResponse = {'status': 1}
|
finalResponse = {'status': 1}
|
||||||
else:
|
else:
|
||||||
finalResponse = {'status': 0, 'errorMesssage' : 'This ACL is currently in used by existing users.'}
|
finalResponse = {'status': 0, 'errorMesssage': 'This ACL is currently in used by existing users.', 'error_message': 'This ACL is currently in used by existing users.'}
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadErrorJson()
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
finalResponse = {'status': 0, 'errorMessage': str(msg), 'error_message': str(msg)}
|
||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def modifyACL(request):
|
def modifyACL(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -453,6 +467,7 @@ def modifyACL(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def fetchACLDetails(request):
|
def fetchACLDetails(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -517,7 +532,6 @@ def fetchACLDetails(request):
|
|||||||
finalResponse['deleteFTPAccount'] = acl.deleteFTPAccount
|
finalResponse['deleteFTPAccount'] = acl.deleteFTPAccount
|
||||||
finalResponse['listFTPAccounts'] = acl.listFTPAccounts
|
finalResponse['listFTPAccounts'] = acl.listFTPAccounts
|
||||||
|
|
||||||
|
|
||||||
## Backup Management
|
## Backup Management
|
||||||
|
|
||||||
finalResponse['createBackup'] = acl.createBackup
|
finalResponse['createBackup'] = acl.createBackup
|
||||||
@@ -526,7 +540,6 @@ def fetchACLDetails(request):
|
|||||||
finalResponse['scheDuleBackups'] = acl.scheDuleBackups
|
finalResponse['scheDuleBackups'] = acl.scheDuleBackups
|
||||||
finalResponse['remoteBackups'] = acl.remoteBackups
|
finalResponse['remoteBackups'] = acl.remoteBackups
|
||||||
|
|
||||||
|
|
||||||
## SSL Management
|
## SSL Management
|
||||||
|
|
||||||
finalResponse['manageSSL'] = acl.manageSSL
|
finalResponse['manageSSL'] = acl.manageSSL
|
||||||
@@ -544,6 +557,7 @@ def fetchACLDetails(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def submitACLModifications(request):
|
def submitACLModifications(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
@@ -635,7 +649,6 @@ def submitACLModifications(request):
|
|||||||
items.type = 3
|
items.type = 3
|
||||||
items.save()
|
items.save()
|
||||||
|
|
||||||
|
|
||||||
finalResponse = {'status': 1}
|
finalResponse = {'status': 1}
|
||||||
else:
|
else:
|
||||||
finalResponse = ACLManager.loadErrorJson()
|
finalResponse = ACLManager.loadErrorJson()
|
||||||
@@ -643,10 +656,11 @@ def submitACLModifications(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
finalResponse = {'status': 0, 'errorMessage': str(msg), 'error_message': str(msg)}
|
||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def changeUserACL(request):
|
def changeUserACL(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -668,14 +682,22 @@ def changeUserACL(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def changeACLFunc(request):
|
def changeACLFunc(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
|
data = json.loads(request.body)
|
||||||
|
|
||||||
|
if data['selectedUser'] == 'admin':
|
||||||
|
finalResponse = {'status': 0,
|
||||||
|
'errorMessage': "Super user can not be modified.",
|
||||||
|
'error_message': "Super user can not be modified."}
|
||||||
|
json_data = json.dumps(finalResponse)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
currentACL = ACLManager.loadedACL(val)
|
currentACL = ACLManager.loadedACL(val)
|
||||||
|
|
||||||
if currentACL['admin'] == 1:
|
if currentACL['admin'] == 1:
|
||||||
data = json.loads(request.body)
|
|
||||||
selectedACL = ACL.objects.get(name=data['selectedACL'])
|
selectedACL = ACL.objects.get(name=data['selectedACL'])
|
||||||
selectedUser = Administrator.objects.get(userName=data['selectedUser'])
|
selectedUser = Administrator.objects.get(userName=data['selectedUser'])
|
||||||
|
|
||||||
@@ -684,7 +706,6 @@ def changeACLFunc(request):
|
|||||||
|
|
||||||
finalResponse = {'status': 1}
|
finalResponse = {'status': 1}
|
||||||
elif currentACL['changeUserACL'] == 1:
|
elif currentACL['changeUserACL'] == 1:
|
||||||
data = json.loads(request.body)
|
|
||||||
selectedACL = ACL.objects.get(name=data['selectedACL'])
|
selectedACL = ACL.objects.get(name=data['selectedACL'])
|
||||||
selectedUser = Administrator.objects.get(userName=data['selectedUser'])
|
selectedUser = Administrator.objects.get(userName=data['selectedUser'])
|
||||||
|
|
||||||
@@ -698,10 +719,11 @@ def changeACLFunc(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
finalResponse = {'status': 0, 'errorMessage': str(msg), 'error_message': str(msg)}
|
||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def resellerCenter(request):
|
def resellerCenter(request):
|
||||||
try:
|
try:
|
||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
@@ -710,11 +732,13 @@ def resellerCenter(request):
|
|||||||
if currentACL['admin'] == 1:
|
if currentACL['admin'] == 1:
|
||||||
userNames = ACLManager.loadDeletionUsers(userID, currentACL)
|
userNames = ACLManager.loadDeletionUsers(userID, currentACL)
|
||||||
resellerPrivUsers = ACLManager.userWithResellerPriv(userID)
|
resellerPrivUsers = ACLManager.userWithResellerPriv(userID)
|
||||||
return render(request, 'userManagment/resellerCenter.html', {'userToBeModified': userNames, 'resellerPrivUsers': resellerPrivUsers})
|
return render(request, 'userManagment/resellerCenter.html',
|
||||||
|
{'userToBeModified': userNames, 'resellerPrivUsers': resellerPrivUsers})
|
||||||
elif currentACL['resellerCenter'] == 1:
|
elif currentACL['resellerCenter'] == 1:
|
||||||
userNames = ACLManager.loadDeletionUsers(userID, currentACL)
|
userNames = ACLManager.loadDeletionUsers(userID, currentACL)
|
||||||
resellerPrivUsers = ACLManager.userWithResellerPriv(userID)
|
resellerPrivUsers = ACLManager.userWithResellerPriv(userID)
|
||||||
return render(request, 'userManagment/resellerCenter.html',{'userToBeModified': userNames, 'resellerPrivUsers': resellerPrivUsers})
|
return render(request, 'userManagment/resellerCenter.html',
|
||||||
|
{'userToBeModified': userNames, 'resellerPrivUsers': resellerPrivUsers})
|
||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
@@ -722,17 +746,26 @@ def resellerCenter(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
def saveResellerChanges(request):
|
def saveResellerChanges(request):
|
||||||
try:
|
try:
|
||||||
val = request.session['userID']
|
val = request.session['userID']
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
|
|
||||||
|
if data['userToBeModified'] == 'admin':
|
||||||
|
finalResponse = {'status': 0,
|
||||||
|
'errorMessage': "Super user can not be modified.",
|
||||||
|
'error_message': "Super user can not be modified."}
|
||||||
|
json_data = json.dumps(finalResponse)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
userToBeModified = Administrator.objects.get(userName=data['userToBeModified'])
|
userToBeModified = Administrator.objects.get(userName=data['userToBeModified'])
|
||||||
newOwner = Administrator.objects.get(userName=data['newOwner'])
|
newOwner = Administrator.objects.get(userName=data['newOwner'])
|
||||||
|
|
||||||
if ACLManager.websitesLimitCheck(newOwner, data['websitesLimit'], userToBeModified) == 0:
|
if ACLManager.websitesLimitCheck(newOwner, data['websitesLimit'], userToBeModified) == 0:
|
||||||
finalResponse = {'status': 0,
|
finalResponse = {'status': 0,
|
||||||
'errorMessage': "You've reached maximum websites limit as a reseller."}
|
'errorMessage': "You've reached maximum websites limit as a reseller.",
|
||||||
|
'error_message': "You've reached maximum websites limit as a reseller."}
|
||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
@@ -744,6 +777,6 @@ def saveResellerChanges(request):
|
|||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
finalResponse = {'status':0, 'errorMessage': str(msg)}
|
finalResponse = {'status': 0, 'errorMessage': str(msg), 'error_message': str(msg)}
|
||||||
json_data = json.dumps(finalResponse)
|
json_data = json.dumps(finalResponse)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
Reference in New Issue
Block a user