Bug fixes.

This commit is contained in:
usmannasir
2018-07-05 15:22:48 +05:00
parent 27c31b522d
commit e952a6dc5d
30 changed files with 236 additions and 279 deletions

View File

@@ -1,5 +1,6 @@
from django.conf import settings
from django.shortcuts import HttpResponse
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
class secMiddleware:
@@ -9,6 +10,6 @@ class secMiddleware:
def __call__(self, request):
if request.method == 'POST':
if request.body.find(';') > -1 or request.body.find('&&') > -1 or request.body.find('|') > -1 or request.body.find('...') > -1:
return HttpResponse('Bad input.')
logging.writeToFile('Bad Input on.')
response = self.get_response(request)
return response

View File

@@ -24,7 +24,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'xr%j*p!*$0d%(-(e%@-*hyoz4$f%y77coq0u)6pwmjg4)q&19f'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
ALLOWED_HOSTS = ['*']

View File

@@ -11,7 +11,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Back up Website" %}</h2>
<h2>{% trans "Back up Website" %} - <a target="_blank" href="http://go.cyberpanel.net/backup" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Backup Docs" %}</span></a></h2>
<p>{% trans "This page can be used to Back up your websites" %}</p>
</div>

View File

@@ -11,7 +11,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Set up Back up Destinations" %}</h2>
<h2>{% trans "Set up Back up Destinations" %} - <a target="_blank" href="http://go.cyberpanel.net/remote-backup" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Remote Backups" %}</span></a></h2>
<p>{% trans "On this page you can set up your Back up destinations. (SFTP)" %}</p>
</div>

View File

@@ -10,7 +10,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Schedule Back up" %}</h2>
<h2>{% trans "Schedule Back up" %} - <a target="_blank" href="http://go.cyberpanel.net/remote-backup" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Remote Backups" %}</span></a></h2>
<p>{% trans "On this page you can schedule Back ups to localhost or remote server (If you have added one)." %}</p>
</div>

View File

@@ -11,7 +11,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Remote Backups" %}</h2>
<h2>{% trans "Remote Backups" %} - <a target="_blank" href="http://go.cyberpanel.net/remote-transfer" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Remote Transfer" %}</span></a></h2>
<p>{% trans "This feature can import website(s) from remote server" %}</p>
</div>

View File

@@ -11,7 +11,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Restore Website" %}</h2>
<h2>{% trans "Restore Website" %} - <a target="_blank" href="http://go.cyberpanel.net/backup" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Backup Docs" %}</span></a></h2>
<p>{% trans "This page can be used to restore your websites, Back up should be generated from CyberPanel Back up generation tool, it will detect all Back ups under <strong>/home/backup</strong>." %}</p>
</div>

View File

@@ -10,7 +10,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Add/Modify DNS Zone" %}</h2>
<h2>{% trans "Add/Modify DNS Zone" %} - <a target="_blank" href="http://go.cyberpanel.net/dns-records" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "DNS Docs" %}</span></a></h2>
<p>{% trans "On this page you can add/modify dns records for domains whose dns zone is already created." %}</p>
</div>
<div ng-controller="addModifyDNSRecords" class="panel">

View File

@@ -9,7 +9,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Create DNS Zone" %}</h2>
<h2>{% trans "Create DNS Zone" %} - <a target="_blank" href="http://go.cyberpanel.net/dns-records" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "DNS Docs" %}</span></a></h2>
<p>{% trans "This page is used to create DNS zone, to edit dns zone you can visit Modify DNS Zone Page." %}</p>
</div>
<div ng-controller="createDNSZone" class="panel">

View File

@@ -9,7 +9,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Create Nameserver" %}</h2>
<h2>{% trans "Create Nameserver" %} - <a target="_blank" href="http://go.cyberpanel.net/dns-records" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "DNS Docs" %}</span></a></h2>
<p>{% trans "You can use this page to setup nameservers using which people on the internet can resolve websites hosted on this server." %}</p>
</div>
<div ng-controller="createNameserver" class="panel">

View File

@@ -9,7 +9,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Delete DNS Zone" %}</h2>
<h2>{% trans "Delete DNS Zone" %} - <a target="_blank" href="http://go.cyberpanel.net/dns-records" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "DNS Docs" %}</span></a></h2>
<p>{% trans "This page can be used to delete DNS Zone. Deleting the DNS zone will remove all its related records as well." %}</p>
</div>
<div class="panel">

View File

@@ -10,7 +10,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "SpamAssassin Configurations!" %} </h2>
<h2>{% trans "SpamAssassin Configurations!" %} - <a target="_blank" href="http://go.cyberpanel.net/SpamAssassin" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "SpamAssassin Docs" %}</span></a> </h2>
<p>{% trans "On this page you can configure SpamAssassin settings." %}</p>
</div>

View File

@@ -10,7 +10,7 @@
<div ng-controller="emailDomainPage" class="container">
<div id="page-title">
<h2 ><span id="domainNamePage">{{ domain }}</span></h2>
<h2 ><span id="domainNamePage">{{ domain }}</span> - <a target="_blank" href="http://go.cyberpanel.net/emailLimits" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Emai Limits Docs" %}</span></a></h2>
<p>{% trans "View and change email limits for a domain name." %}</p>
</div>

View File

@@ -10,7 +10,7 @@
<div ng-controller="emailPage" class="container">
<div id="page-title">
<h2 ><span id="emailAddress">{{ emailAddress }}</span></h2>
<h2 ><span id="emailAddress">{{ emailAddress }}</span> - <a target="_blank" href="http://go.cyberpanel.net/emailLimits" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Emai Limits Docs" %}</span></a></h2>
<p>{% trans "View and change limits for an Email Address." %}</p>
</div>

View File

@@ -11,7 +11,7 @@
<div class="container">
<div id="page-title">
<h2 id="domainNamePage">{% trans "List Domains" %}</h2>
<h2 id="domainNamePage">{% trans "List Domains" %} - <a target="_blank" href="http://go.cyberpanel.net/emailLimits" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Emai Limits Docs" %}</span></a></h2>
<p>{% trans "On this page you manage emails limits for Domains/Email Addresses" %}</p>
</div>

View File

@@ -10,7 +10,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Email Policy Server Configurations!" %} </h2>
<h2>{% trans "Email Policy Server Configurations!" %} - <a target="_blank" href="http://go.cyberpanel.net/emailLimits" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Emai Limits Docs" %}</span></a> </h2>
<p>{% trans "Turn ON Email Policy Server to use Email Limits Feature. " %}</p>
</div>

View File

@@ -442,7 +442,7 @@ def getSSHConfigs(request):
def saveSSHConfigs(request):
try:
val = request.session['userID']
admin= Administrator.objects.get(val=val)
admin= Administrator.objects.get(pk=val)
try:
if request.method == 'POST':
data = json.loads(request.body)
@@ -460,9 +460,7 @@ def saveSSHConfigs(request):
rootLogin = data['rootLogin']
command = 'sudo semanage port -a -t ssh_port_t -p tcp ' +sshPort
cmd = shlex.split(command)
res = subprocess.call(cmd)

View File

@@ -44,7 +44,7 @@ class preFlightsChecks:
else:
logging.InstallLog.writeToFile("SELinux is enabled, please disable SELinux and restart the installation!")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
except BaseException,msg:
logging.InstallLog.writeToFile(str(msg) + "[checkIfSeLinuxDisabled]")
@@ -57,7 +57,7 @@ class preFlightsChecks:
return 1
else:
preFlightsChecks.stdOut("You are running Unsupported python version, please install python 2.7")
sys.exit()
os._exit(0)
def setup_account_cyberpanel(self):
try:
@@ -74,7 +74,7 @@ class preFlightsChecks:
if count == 3:
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")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("SUDO successfully installed!")
preFlightsChecks.stdOut("SUDO successfully installed!")
@@ -95,7 +95,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("We are not able add user cyberpanel to system, exiting the installer. [setup_account_cyberpanel]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("CyberPanel user added!")
preFlightsChecks.stdOut("CyberPanel user added!")
@@ -117,7 +117,7 @@ class preFlightsChecks:
if count == 3:
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")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("CyberPanel user was successfully added to SUDO group!")
preFlightsChecks.stdOut("CyberPanel user was successfully added to SUDO group!")
@@ -166,6 +166,8 @@ class preFlightsChecks:
except:
logging.InstallLog.writeToFile("[116] setup_account_cyberpanel")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
def yum_update(self):
try:
@@ -198,9 +200,7 @@ class preFlightsChecks:
return 1
def installCyberPanelRepo(self):
cmd = []
count = 0
while(1):
@@ -215,7 +215,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to add CyberPanel official repository, exiting installer! [installCyberPanelRepo]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("CyberPanel Repo added!")
preFlightsChecks.stdOut("CyberPanel Repo added!")
@@ -224,7 +224,6 @@ class preFlightsChecks:
def enableEPELRepo(self):
try:
cmd = []
count = 0
while (1):
@@ -240,6 +239,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to add EPEL repository, exiting installer! [enableEPELRepo]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("EPEL Repo added!")
preFlightsChecks.stdOut("EPEL Repo added!")
@@ -247,16 +247,19 @@ class preFlightsChecks:
except OSError,msg:
logging.InstallLog.writeToFile(str(msg) + " [enableEPELRepo]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
return 0
except ValueError,msg:
logging.InstallLog.writeToFile(str(msg) + " [enableEPELRepo]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
return 0
return 1
def install_pip(self):
count = 0
while (1):
command = "yum -y install python-pip"
res = subprocess.call(shlex.split(command))
@@ -267,7 +270,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install PIP, exiting installer! [install_pip]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("PIP successfully installed!")
preFlightsChecks.stdOut("PIP successfully installed!")
@@ -285,7 +288,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install python development tools, exiting installer! [install_python_dev]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Python development tools successfully installed!")
preFlightsChecks.stdOut("Python development tools successfully installed!")
@@ -304,7 +307,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install GCC, exiting installer! [install_gcc]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("GCC Successfully installed!")
preFlightsChecks.stdOut("GCC Successfully installed!")
@@ -324,9 +327,8 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile(
"Unable to install Python setup tools, exiting installer! [install_python_setup_tools]")
print("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] " + "Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("Python setup tools Successfully installed!")
print("[" + time.strftime("%I-%M-%S-%a-%b-%Y") + "] " + "Python setup tools Successfully installed!")
@@ -362,7 +364,7 @@ class preFlightsChecks:
logging.InstallLog.writeToFile(
"Unable to install urllib3 module, exiting installer! [install_python_requests]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("urllib3 module Successfully installed!")
preFlightsChecks.stdOut("urllib3 module Successfully installed!")
@@ -383,7 +385,7 @@ class preFlightsChecks:
logging.InstallLog.writeToFile(
"Unable to install requests module, exiting installer! [install_python_requests]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Requests module Successfully installed!")
preFlightsChecks.stdOut("Requests module Successfully installed!")
@@ -406,7 +408,7 @@ class preFlightsChecks:
logging.InstallLog.writeToFile(
"Unable to install urllib3 module, exiting installer! [install_python_requests]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("urllib3 module Successfully installed!")
preFlightsChecks.stdOut("urllib3 module Successfully installed!")
@@ -427,7 +429,7 @@ class preFlightsChecks:
logging.InstallLog.writeToFile(
"Unable to install requests module, exiting installer! [install_python_requests]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Requests module Successfully installed!")
preFlightsChecks.stdOut("Requests module Successfully installed!")
@@ -453,7 +455,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install pexpect, exiting installer! [install_pexpect]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("pexpect successfully installed!")
preFlightsChecks.stdOut("pexpect successfully installed!")
@@ -472,7 +474,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install pexpect, exiting installer! [install_pexpect]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("pexpect successfully installed!")
preFlightsChecks.stdOut("pexpect successfully installed!")
@@ -491,7 +493,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install DJANGO, exiting installer! [install_django]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("DJANGO successfully installed!")
preFlightsChecks.stdOut("DJANGO successfully installed!")
@@ -508,7 +510,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install MySQL-python, exiting installer! [install_python_mysql_library]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("MySQL-python successfully installed!")
preFlightsChecks.stdOut("MySQL-python successfully installed!")
@@ -525,7 +527,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install GUNICORN, exiting installer! [install_gunicorn]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("GUNICORN successfully installed!")
preFlightsChecks.stdOut("GUNICORN successfully installed!")
@@ -571,26 +573,6 @@ class preFlightsChecks:
preFlightsChecks.stdOut("Gunicorn can now start after system restart!")
break
##
count = 0
while(1):
command = "systemctl start gunicorn.socket"
res = subprocess.call(shlex.split(command))
if res == 1:
count = count + 1
preFlightsChecks.stdOut("Starting Gunicorn now, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile("Unable to start Gunicorn, exiting installer! [setup_gunicorn]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
else:
logging.InstallLog.writeToFile("Gunicorn successfully started!")
preFlightsChecks.stdOut("Gunicorn successfully started!")
break
except BaseException, msg:
logging.InstallLog.writeToFile(str(msg) + " [setup_gunicorn]")
preFlightsChecks.stdOut("Not able to setup gunicorn, see install log.")
@@ -616,7 +598,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install psutil, exiting installer! [install_psutil]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("psutil successfully installed!")
preFlightsChecks.stdOut("psutil successfully installed!")
@@ -634,7 +616,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install psutil, exiting installer! [install_psutil]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("psutil successfully installed!")
preFlightsChecks.stdOut("psutil successfully installed!")
@@ -669,7 +651,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install psmisc, exiting installer! [install_psmisc]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("psmisc successfully installed!")
preFlightsChecks.stdOut("psmisc successfully installed!")
@@ -691,7 +673,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install upgrade requests, exiting installer! [download_install_CyberPanel]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("requests module successfully upgraded!")
preFlightsChecks.stdOut("requests module successfully upgraded!")
@@ -715,7 +697,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to download CyberPanel, exiting installer! [download_install_CyberPanel]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("CyberPanel successfully downloaded!")
preFlightsChecks.stdOut("CyberPanel successfully downloaded!")
@@ -736,7 +718,7 @@ class preFlightsChecks:
if count == 3:
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")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Successfully extracted CyberPanel!")
preFlightsChecks.stdOut("Successfully extracted CyberPanel!")
@@ -811,7 +793,7 @@ class preFlightsChecks:
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]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Successfully prepared migrations file!")
preFlightsChecks.stdOut("Successfully prepared migrations file!")
@@ -832,7 +814,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to execute the migrations file, exiting installer! [download_install_CyberPanel]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Migrations file successfully executed!")
preFlightsChecks.stdOut("Migrations file successfully executed!")
@@ -846,7 +828,7 @@ class preFlightsChecks:
if res == 1:
logging.InstallLog.writeToFile("Could not move static content!")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Static content moved!")
preFlightsChecks.stdOut("Static content moved!")
@@ -906,7 +888,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install unzip, exiting installer! [install_unzip]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("unzip successfully installed!")
preFlightsChecks.stdOut("unzip Successfully installed!")
@@ -924,9 +906,7 @@ class preFlightsChecks:
def install_zip(self):
try:
count = 0
while (1):
command = 'yum -y install zip'
@@ -941,7 +921,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to install zip, exiting installer! [install_zip]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("zip successfully installed!")
preFlightsChecks.stdOut("zip successfully installed!")
@@ -963,7 +943,7 @@ class preFlightsChecks:
count = 0
while(1):
command = 'wget https://files.phpmyadmin.net/phpMyAdmin/4.8.1/phpMyAdmin-4.8.1-all-languages.zip'
command = 'wget https://files.phpmyadmin.net/phpMyAdmin/4.8.2/phpMyAdmin-4.8.2-all-languages.zip'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -973,7 +953,7 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile("Unable to download PYPMYAdmin, exiting installer! [download_install_phpmyadmin]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("PHPMYAdmin successfully downloaded!")
preFlightsChecks.stdOut("PHPMYAdmin successfully downloaded!")
@@ -984,7 +964,7 @@ class preFlightsChecks:
count = 0
while(1):
command = 'unzip phpMyAdmin-4.8.1-all-languages.zip'
command = 'unzip phpMyAdmin-4.8.2-all-languages.zip'
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -996,9 +976,8 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile(
"Unable to unzip PHPMYAdmin, exiting installer! [download_install_phpmyadmin]")
print("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] " + "Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("PHPMYAdmin unzipped!")
print(
@@ -1007,12 +986,12 @@ class preFlightsChecks:
###
os.remove("phpMyAdmin-4.8.1-all-languages.zip")
os.remove("phpMyAdmin-4.8.2-all-languages.zip")
count = 0
while(1):
command = 'mv phpMyAdmin-4.8.1-all-languages phpmyadmin'
command = 'mv phpMyAdmin-4.8.2-all-languages phpmyadmin'
cmd = shlex.split(command)
@@ -1026,9 +1005,8 @@ class preFlightsChecks:
if count == 3:
logging.InstallLog.writeToFile(
"Unable to install PHPMYAdmin, exiting installer! [download_install_phpmyadmin]")
print("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "] " + "Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
os._exit(0)
else:
logging.InstallLog.writeToFile("PHPMYAdmin Successfully installed!")
print(
@@ -1303,7 +1281,7 @@ class preFlightsChecks:
count = count + 1
preFlightsChecks.stdOut("Unable to generate SSL for Postfix, trying again, try number: " + str(count))
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
else:
logging.InstallLog.writeToFile("SSL for Postfix generated!")
@@ -1373,7 +1351,7 @@ class preFlightsChecks:
count = count + 1
preFlightsChecks.stdOut("Unable to change permissions for mysql-virtual_domains.cf, trying again, try number: " + str(count))
if count == 3:
logging.InstallLog.writeToFile("Unable 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
else:
logging.InstallLog.writeToFile("Permissions changed for mysql-virtual_domains.cf!")
@@ -2157,11 +2135,8 @@ class preFlightsChecks:
count = 0
while(1):
command = 'chmod +x /usr/local/lscp/bin/lscpdctrl'
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res == 1:
@@ -2235,11 +2210,8 @@ class preFlightsChecks:
try:
## first install crontab
file = open("installLogs.txt", 'a')
count = 0
while(1):
command = 'yum install cronie -y'
@@ -2265,9 +2237,7 @@ class preFlightsChecks:
while(1):
command = 'systemctl enable crond'
cmd = shlex.split(command)
res = subprocess.call(cmd, stdout=file)
if res == 1:
@@ -2284,11 +2254,8 @@ class preFlightsChecks:
count = 0
while(1):
command = 'systemctl start crond'
cmd = shlex.split(command)
res = subprocess.call(cmd, stdout=file)
if res == 1:
@@ -2312,6 +2279,12 @@ class preFlightsChecks:
command = 'chmod +x /usr/local/CyberCP/plogical/findBWUsage.py'
cmd = shlex.split(command)
res = subprocess.call(cmd, stdout=file)
if res == 1:
logging.InstallLog.writeToFile("1427 [setup_cron]")
else:
pass
command = 'chmod +x /usr/local/CyberCP/postfixSenderPolicy/client.py'
cmd = shlex.split(command)
@@ -2326,11 +2299,8 @@ class preFlightsChecks:
count = 0
while(1):
command = 'systemctl restart crond.service'
cmd = shlex.split(command)
res = subprocess.call(cmd, stdout=file)
if res == 1:
@@ -2449,7 +2419,7 @@ class preFlightsChecks:
logging.InstallLog.writeToFile(
"Unable to install urllib3 module, exiting installer! [install_python_requests]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("urllib3 module Successfully installed!")
preFlightsChecks.stdOut("urllib3 module Successfully installed!")
@@ -2470,7 +2440,7 @@ class preFlightsChecks:
logging.InstallLog.writeToFile(
"Unable to install requests module, exiting installer! [install_python_requests]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Requests module Successfully installed!")
preFlightsChecks.stdOut("Requests module Successfully installed!")
@@ -2513,7 +2483,7 @@ class preFlightsChecks:
logging.InstallLog.writeToFile(
"Failed to install pyOpenSSL, exiting installer! [installCertBot]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("pyOpenSSL successfully installed! [pip]")
preFlightsChecks.stdOut("pyOpenSSL successfully installed! [pip]")
@@ -2533,7 +2503,7 @@ class preFlightsChecks:
logging.InstallLog.writeToFile(
"Failed to install CertBot, exiting installer! [installCertBot]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("CertBot successfully installed! [pip]")
preFlightsChecks.stdOut("CertBot successfully installed! [pip]")
@@ -2739,7 +2709,7 @@ milter_default_action = accept
logging.InstallLog.writeToFile(
"Failed to install project dependant modules! [setupVirtualEnv]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Project dependant modules installed successfully!")
preFlightsChecks.stdOut("Project dependant modules installed successfully!!")
@@ -2761,7 +2731,7 @@ milter_default_action = accept
logging.InstallLog.writeToFile(
"Failed install virtualenv! [setupVirtualEnv]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("virtualenv installed successfully!")
preFlightsChecks.stdOut("virtualenv installed successfully!")
@@ -2771,7 +2741,7 @@ milter_default_action = accept
count = 0
while (1):
command = "virtualenv /usr/local/CyberCP"
command = "virtualenv --system-site-packages /usr/local/CyberCP"
res = subprocess.call(shlex.split(command))
if res == 1:
@@ -2782,7 +2752,7 @@ milter_default_action = accept
logging.InstallLog.writeToFile(
"Failed to setup virtualenv! [setupVirtualEnv]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("virtualenv setuped successfully!")
preFlightsChecks.stdOut("virtualenv setuped successfully!")
@@ -2799,7 +2769,7 @@ milter_default_action = accept
count = 0
while (1):
command = "pip install -r /usr/local/CyberCP/requirments.txt"
command = "pip install --ignore-installed -r /usr/local/CyberCP/requirments.txt"
res = subprocess.call(shlex.split(command))
if res == 1:
@@ -2809,8 +2779,7 @@ milter_default_action = accept
if count == 3:
logging.InstallLog.writeToFile(
"Failed to install project dependant modules! [setupVirtualEnv]")
preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
break
else:
logging.InstallLog.writeToFile("Project dependant modules installed successfully!")
preFlightsChecks.stdOut("Project dependant modules installed successfully!!")
@@ -2819,6 +2788,9 @@ milter_default_action = accept
command = "systemctl restart gunicorn.socket"
res = subprocess.call(shlex.split(command))
command = "virtualenv --system-site-packages /usr/local/CyberCP"
res = subprocess.call(shlex.split(command))
except OSError, msg:

View File

@@ -44,7 +44,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to install OpenLiteSpeed, exiting installer! [installLiteSpeed]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("OpenLiteSpeed successfully installed!")
InstallCyberPanel.stdOut("OpenLiteSpeed successfully installed!")
@@ -98,7 +98,7 @@ class InstallCyberPanel:
## cache module settings
cacheStart = "module cache {\n"
param = " param <<<END_param\n"
ls_enabled = "ls_enabled 1\n"
enableCache = "enableCache 0\n"
qsCache = "qsCache 1\n"
reqCookieCache = "reqCookieCache 1\n"
@@ -111,13 +111,12 @@ class InstallCyberPanel:
storagePath = "storagePath cachedata\n"
checkPrivateCache = "checkPrivateCache 1\n"
checkPublicCache = "checkPublicCache 1\n"
END_param = " END_param\n"
cacheEnd = "}\n"
writeDataToFile = open(self.server_root_path+"conf/httpd_config.conf", 'a')
writeDataToFile.writelines(cacheStart)
writeDataToFile.writelines(param)
writeDataToFile.writelines(ls_enabled)
writeDataToFile.writelines(enableCache)
writeDataToFile.writelines(qsCache)
writeDataToFile.writelines(reqCookieCache)
@@ -130,7 +129,6 @@ class InstallCyberPanel:
writeDataToFile.writelines(storagePath)
writeDataToFile.writelines(checkPrivateCache)
writeDataToFile.writelines(checkPublicCache)
writeDataToFile.writelines(END_param)
writeDataToFile.writelines(cacheEnd)
writeDataToFile.writelines("\n")
writeDataToFile.writelines("\n")
@@ -236,7 +234,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to install LiteSpeed PHPs, exiting installer! [installAllPHPVersions]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("LiteSpeed PHPs successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHPs successfully installed!")
@@ -253,7 +251,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to install LiteSpeed PHP 7.1, exiting installer! [installAllPHPVersions]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("LiteSpeed PHP 7.1 successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHP 7.1 successfully installed!")
@@ -273,7 +271,7 @@ class InstallCyberPanel:
logging.InstallLog.writeToFile(
"Failed to install LiteSpeed PHP 7.1, exiting installer! [installAllPHPVersions]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("LiteSpeed PHP 7.1 successfully installed!")
InstallCyberPanel.stdOut("LiteSpeed PHP 7.1 successfully installed!")
@@ -331,7 +329,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to install MariaDB, exiting installer! [installMySQL]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("MariaDB successfully installed!")
InstallCyberPanel.stdOut("MariaDB successfully installed!")
@@ -378,7 +376,7 @@ class InstallCyberPanel:
logging.InstallLog.writeToFile(
"Failed to create data directories for second MariaDB instance, exiting installer! [installMySQL]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("Data directories created for second MariaDB instance!")
InstallCyberPanel.stdOut("Data directories created for second MariaDB instance!")
@@ -400,7 +398,7 @@ class InstallCyberPanel:
logging.InstallLog.writeToFile(
"Failed to start first MariaDB instance, exiting installer! [installMySQL]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("First MariaDB instance successfully started!")
InstallCyberPanel.stdOut("First MariaDB instance successfully started!")
@@ -421,7 +419,7 @@ class InstallCyberPanel:
logging.InstallLog.writeToFile(
"Failed to enable first MariaDB instance to run at system restart, exiting installer! [installMySQL]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("First MariaDB instance successfully enabled at system restart!")
InstallCyberPanel.stdOut("First MariaDB instance successfully enabled at system restart!")
@@ -580,7 +578,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to start MariaDB instance, exiting installer! [startMariaDB]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("MariaDB instance successfully started!")
InstallCyberPanel.stdOut("MariaDB instance successfully started!")
@@ -610,7 +608,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to install PureFTPD, exiting installer! [installPureFTPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("PureFTPD successfully installed!")
InstallCyberPanel.stdOut("PureFTPD successfully installed!")
@@ -632,7 +630,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to enable PureFTPD to run at system restart, exiting installer! [installPureFTPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("PureFTPD successfully enabled at system restart!")
InstallCyberPanel.stdOut("PureFTPD successfully enabled at system restart!")
@@ -660,7 +658,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to create group for FTP, exiting installer! [installPureFTPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("System group for FTP successfully created!")
InstallCyberPanel.stdOut("System group for FTP successfully created!")
@@ -694,7 +692,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to create user for FTP, exiting installer! [installPureFTPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("System user for FTP successfully created!")
InstallCyberPanel.stdOut("System user for FTP successfully created!")
@@ -835,7 +833,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to install PowerDNS Repositories, exiting installer! [installPowerDNS]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("PowerDNS Repositories successfully installed!")
InstallCyberPanel.stdOut("PowerDNS Repositories successfully installed!")
@@ -857,7 +855,7 @@ class InstallCyberPanel:
logging.InstallLog.writeToFile(
"Failed to install PowerDNS Repositories, exiting installer! [installPowerDNS]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("PowerDNS Repositories successfully installed!")
InstallCyberPanel.stdOut("PowerDNS Repositories successfully installed!")
@@ -876,7 +874,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to install PowerDNS, exiting installer! [installPowerDNS]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("PowerDNS successfully installed!")
InstallCyberPanel.stdOut("PowerDNS successfully installed!")
@@ -979,7 +977,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to start PowerDNS instance, exiting installer! [startPowerDNS]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("PowerDNS instance successfully started!")
InstallCyberPanel.stdOut("PowerDNS instance successfully started!")
@@ -1016,7 +1014,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to install LSCPD prerequisites, exiting installer! [installLSCPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("LSCPD prerequisites successfully installed!")
InstallCyberPanel.stdOut("LSCPD prerequisites successfully installed!")
@@ -1035,7 +1033,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to install LSCPD prerequisites, exiting installer! [installLSCPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("LSCPD prerequisites successfully installed!")
InstallCyberPanel.stdOut("LSCPD prerequisites successfully installed!")
@@ -1055,7 +1053,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to extract LSCPD, exiting installer! [installLSCPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("LSCPD successfully extracted!")
InstallCyberPanel.stdOut("LSCPD successfully extracted!")
@@ -1077,7 +1075,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to configure LSCPD, exiting installer! [installLSCPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("LSCPD successfully configured!")
InstallCyberPanel.stdOut("LSCPD successfully extracted!")
@@ -1099,7 +1097,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to compile LSCPD, exiting installer! [installLSCPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("LSCPD successfully complied!")
InstallCyberPanel.stdOut("LSCPD successfully compiled!")
@@ -1121,7 +1119,7 @@ class InstallCyberPanel:
if count == 3:
logging.InstallLog.writeToFile("Failed to compile LSCPD, exiting installer! [installLSCPD]")
InstallCyberPanel.stdOut("Installation failed, consult: /var/log/installLogs.txt")
sys.exit()
os._exit(0)
else:
logging.InstallLog.writeToFile("LSCPD successfully complied!")
InstallCyberPanel.stdOut("LSCPD successfully compiled!")

Binary file not shown.

View File

@@ -10,7 +10,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "DKIM Manager" %}</h2>
<h2>{% trans "DKIM Manager" %} - <a target="_blank" href="http://go.cyberpanel.net/dkim" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "DKIM Docs" %}</span></a></h2>
<p>{% trans "This page can be used to generate and view DKIM keys for Domains" %}</p>
</div>

View File

@@ -9,7 +9,7 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Setup Email Forwarding" %}</h2>
<h2>{% trans "Setup Email Forwarding" %} - <a target="_blank" href="http://go.cyberpanel.net/email-forwarding" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Forwarding Docs" %}</span></a></h2>
<p>{% trans "This page help you setup email forwarding for your emails." %}</p>
</div>

View File

@@ -31,7 +31,7 @@ from backup.models import DBUsers
from mailServer.models import Domains as eDomains
from random import randint
import time
from plogical.mailUtilities import mailUtilities
## I am not the monster that you think I am..
@@ -614,21 +614,9 @@ class backupUtilities:
username = email.split("@")[0]
password = emailAccount.find('password').text
finalData = json.dumps({'domain': masterDomain, 'username': username, 'password': password})
r = requests.post("http://localhost:5003/email/submitEmailCreation", data=finalData,verify=False)
data = json.loads(r.text)
if data['createEmailStatus'] == 1:
continue
else:
status = open(os.path.join(completPath,'status'), "w")
status.write("Error Message: " + data[
'error_message'] + ". Not able to create email accounts, aborting. [5009]")
status.close()
return 0
result = mailUtilities.createEmailAccount(masterDomain, username, password)
if result[0] == 0:
raise BaseException(result[1])
except BaseException, msg:
status = open(os.path.join(completPath,'status'), "w")

View File

@@ -309,7 +309,6 @@ class vhost:
## File Manager defination
context = "context /.filemanager {\n"
type = " type NULL\n"
location = " location /usr/local/lsws/Example/html/FileManager\n"
allowBrowse = " allowBrowse 1\n"
autoIndex = " autoIndex 1\n\n"
@@ -319,8 +318,17 @@ class vhost:
deny = " deny 0.0.0.0/0\n"
accessControlEnds = " }\n"
rewriteInherit = """ rewrite {
inherit 0
}
"""
phpIniOverride = "phpIniOverride {\n"
php_admin_value = 'php_admin_value open_basedir "/tmp:/usr/local/lsws/Example/html/FileManager:$VH_ROOT"\n'
php_value = 'php_value display_errors "Off"\n'
php_value_upload_max_size = 'php_value upload_max_filesize "200M"\n'
php_value_post_max_size = 'php_value post_max_size "250M"\n'
endPHPIniOverride = "}\n"
@@ -328,7 +336,6 @@ class vhost:
contextEnds = "}\n"
confFile.writelines(context)
confFile.writelines(type)
confFile.writelines(location)
confFile.writelines(allowBrowse)
confFile.writelines(autoIndex)
@@ -336,10 +343,16 @@ class vhost:
confFile.writelines(allow)
confFile.writelines(deny)
confFile.writelines(accessControlEnds)
confFile.write(rewriteInherit)
confFile.writelines(phpIniOverride)
if openBasedir == 1:
confFile.writelines(phpIniOverride)
confFile.writelines(php_admin_value)
confFile.writelines(endPHPIniOverride)
confFile.write(php_value)
confFile.write(php_value_upload_max_size)
confFile.write(php_value_post_max_size)
confFile.writelines(endPHPIniOverride)
confFile.writelines(defaultCharSet)
confFile.writelines(contextEnds)
@@ -349,10 +362,26 @@ class vhost:
php_admin_value = 'php_admin_value open_basedir "/tmp:$VH_ROOT"\n'
endPHPIniOverride = "}\n"
confFile.writelines(phpIniOverride)
if openBasedir == 1:
confFile.writelines(phpIniOverride)
confFile.writelines(php_admin_value)
confFile.writelines(endPHPIniOverride)
confFile.writelines(endPHPIniOverride)
slashContext = """
context / {
location $DOC_ROOT/
allowBrowse 1
rewrite {
enable 1
RewriteFile .htaccess
}
addDefaultCharset off
}
"""
confFile.write(slashContext)
confFile.close()
@@ -584,40 +613,7 @@ class vhost:
def addRewriteRules(virtualHostName, fileName=None):
try:
path = vhost.Server_root + "/conf/vhosts/" + virtualHostName + "/vhost.conf"
data = open(path, "r").readlines()
if fileName == None:
dataToWritten = "rewriteFile /home/" + virtualHostName + "/public_html/.htaccess" + "\n"
else:
dataToWritten = "rewriteFile " + fileName + "\n"
### Data if re-writes are not already enabled
rewrite = "rewrite {\n"
enables = " enable 1\n"
rules = " rules <<<END_rules\n"
endRules = " END_rules\n"
end = "}\n\n"
if vhost.checkIfRewriteEnabled(data) == 1:
pass
else:
writeDataToFile = open(path, "a")
writeDataToFile.writelines("\n")
writeDataToFile.writelines("\n")
writeDataToFile.writelines(rewrite)
writeDataToFile.writelines(enables)
writeDataToFile.writelines(rules)
writeDataToFile.writelines(dataToWritten)
writeDataToFile.writelines(endRules)
writeDataToFile.writelines(end)
writeDataToFile.close()
pass
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [IO Error with per host config file [changePHP]]")
return 0
@@ -898,10 +894,10 @@ class vhost:
php_admin_value = 'php_admin_value open_basedir "/tmp:/usr/local/lsws/Example/html/FileManager:$VH_ROOT"\n'
endPHPIniOverride = "}\n"
confFile.writelines(phpIniOverride)
if openBasedir == 1:
confFile.writelines(phpIniOverride)
confFile.writelines(php_admin_value)
confFile.writelines(endPHPIniOverride)
confFile.writelines(endPHPIniOverride)
# php settings
@@ -972,6 +968,21 @@ class vhost:
confFile.writelines(procHardLimit)
confFile.writelines(extprocessorEnd)
slashContext = """
context / {
location $DOC_ROOT/
allowBrowse 1
rewrite {
enable 1
RewriteFile .htaccess
}
addDefaultCharset off
}
"""
confFile.write(slashContext)
confFile.close()
except BaseException, msg:

View File

@@ -832,54 +832,43 @@ class virtualHostUtilities:
completePathToConfigFile = confPath + "/vhost.conf"
data = open(completePathToConfigFile, 'r').readlines()
skip = 0
if openBasedirValue == 'Disable':
writeToFile = open(completePathToConfigFile, 'w')
for items in data:
if items.find('phpIniOverride') > -1:
skip = 1
if skip == 1 and items.find('}') > -1:
skip = 0
if items.find('php_admin_value') > -1:
continue
if skip == 1:
continue
writeToFile.writelines(items)
writeToFile.close()
else:
## Check if phpini already active
inistatus = 0
fileManagerCheck = 0
writeToFile = open(completePathToConfigFile, 'w')
for items in data:
if items.find('context /.filemanager') > -1:
writeToFile.writelines(items)
fileManagerCheck = 1
continue
if items.find('phpIniOverride') > -1:
inistatus = 1
if inistatus == 0:
writeToFile = open(completePathToConfigFile, 'w')
for items in data:
if items.find('context /.filemanager') > -1:
writeToFile.writelines(items)
phpIniOverride = "phpIniOverride {\n"
php_admin_value = 'php_admin_value open_basedir "/tmp:/usr/local/lsws/Example/html/FileManager:$VH_ROOT"\n'
endPHPIniOverride = "}\n"
writeToFile.writelines(phpIniOverride)
writeToFile.writelines(php_admin_value)
writeToFile.writelines(endPHPIniOverride)
writeToFile.writelines(items)
if fileManagerCheck == 1:
writeToFile.writelines('php_admin_value open_basedir "/tmp:/usr/local/lsws/Example/html/FileManager:$VH_ROOT"\n')
fileManagerCheck = 0
continue
else:
writeToFile.writelines(items)
writeToFile.writelines('php_admin_value open_basedir "/tmp:$VH_ROOT"\n')
continue
phpIniOverride = "\nphpIniOverride {\n"
php_admin_value = 'php_admin_value open_basedir "/tmp:$VH_ROOT"\n'
endPHPIniOverride = "}\n"
writeToFile.writelines(items)
writeToFile.writelines(phpIniOverride)
writeToFile.writelines(php_admin_value)
writeToFile.writelines(endPHPIniOverride)
writeToFile.close()
writeToFile.close()
installUtilities.installUtilities.reStartLiteSpeed()
print "1,None"

View File

@@ -7,7 +7,7 @@ django.setup()
import threading as multi
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
from policyConstraint import policyConstraints
from emailPremium.models import DomainLimits, EmailLimits, EmailLogs
from emailPremium.models import DomainLimits, EmailLogs
from mailServer.models import Domains, EUsers
import time
from cacheManager import cacheManager
@@ -20,37 +20,44 @@ class HandleRequest(multi.Thread):
multi.Thread.__init__(self)
self.connection = conn
def __del__(self):
try:
self.connection.close()
except BaseException, msg:
logging.writeToFile(str(msg) + ' [HandleRequest.__del__]')
def run(self):
limitThreads.acquire()
dataComplete = ""
try:
try:
while True:
# Wait for a connection
if os.path.exists(HandleRequest.cleaningPath):
readFromFile = open(HandleRequest.cleaningPath, 'r')
command = readFromFile.read()
cacheManager.handlePurgeRequest(command)
readFromFile.close()
logging.writeToFile(command + 'nCommand')
os.remove(HandleRequest.cleaningPath)
while True:
Data = self.connection.recv(64)
if Data:
if len(Data) < 64:
dataComplete = dataComplete + Data
self.manageRequest(dataComplete)
dataComplete = ''
else:
dataComplete = dataComplete + Data
Data = self.connection.recv(64)
# Wait for a connection
if os.path.exists(HandleRequest.cleaningPath):
readFromFile = open(HandleRequest.cleaningPath, 'r')
command = readFromFile.read()
cacheManager.handlePurgeRequest(command)
readFromFile.close()
os.remove(HandleRequest.cleaningPath)
cacheManager.flushCache()
if Data:
if len(Data) < 64:
dataComplete = dataComplete + Data
self.manageRequest(dataComplete)
dataComplete = ''
else:
self.connection.close()
break
finally:
# Clean up the connection
self.connection.close()
dataComplete = dataComplete + Data
else:
self.connection.close()
break
finally:
limitThreads.release()
except BaseException, msg:
logging.writeToFile(str(msg) + ' [HandleRequest.run]')
limitThreads.release()
def manageRequest(self, completeData):
@@ -69,14 +76,17 @@ class HandleRequest(multi.Thread):
domainObj = cacheManager.domains[domainName]
emailObj = domainObj.findEmailOBJ(emailAddress)
else:
domain = Domains.objects.get(domain=domainName)
domainLTS = DomainLimits.objects.get(domain=domain)
try:
domain = Domains.objects.get(domain=domainName)
domainLTS = DomainLimits.objects.get(domain=domain)
newDomain = policyConstraints(domainName, domainLTS.monthlyLimit, domainLTS.monthlyUsed, domainLTS.limitStatus)
cacheManager.domains[domainName] = newDomain
domainObj = newDomain
newDomain = policyConstraints(domainName, domainLTS.monthlyLimit, domainLTS.monthlyUsed, domainLTS.limitStatus)
cacheManager.domains[domainName] = newDomain
domainObj = newDomain
emailObj = newDomain.findEmailOBJ(emailAddress)
emailObj = newDomain.findEmailOBJ(emailAddress)
except:
raise BaseException
#logging.writeToFile('Domain Limit Status: ' + str(domainObj.limitStatus))
#logging.writeToFile('Email Limit Status: ' + str(domainObj.limitStatus))
@@ -84,7 +94,7 @@ class HandleRequest(multi.Thread):
#logging.writeToFile('Email Monthly Used: ' + str(emailObj.monthlyUsed))
if domainObj.limitStatus == 1 and emailObj.limitStatus == 1:
if domainObj.monthlyLimits <= domainObj.monthlyLimits or emailObj.monthlyLimits <= emailObj.monthlyUsed or emailObj.hourlyLimits <= emailObj.hourlyUsed:
if domainObj.monthlyLimits <= domainObj.monthlyUsed or emailObj.monthlyLimits <= emailObj.monthlyUsed or emailObj.hourlyLimits <= emailObj.hourlyUsed:
logging.writeToFile(emailAddress + ' either exceeded monthly or hourly sending limit.')
self.connection.sendall('action=defer_if_permit Service temporarily unavailable\n\n')
else:
@@ -108,6 +118,6 @@ class HandleRequest(multi.Thread):
except BaseException, msg:
logging.writeToFile(completeData)
self.connection.sendall('action=dunno\n\n')
limitThreads.release()
logging.writeToFile(str(msg))

View File

@@ -38,15 +38,6 @@ class policyCTRL:
except BaseException, msg:
logging.writeToFile(str(msg))
## Cleaning PID
path = policyCTRL.cleaningPID
if os.path.exists(path):
pid = open(path, "r").readlines()[0]
try:
os.kill(int(pid), signal.SIGTERM)
except BaseException, msg:
logging.writeToFile(str(msg))
def main():

View File

@@ -26,7 +26,6 @@ jsonpointer==1.9
kitchen==1.1.1
MarkupSafe==0.11
mock==2.0.0
MySQL-python==1.2.5
parsedatetime==2.4
pbr==4.0.4
perf==0.1

View File

@@ -9,7 +9,7 @@
<div ng-controller="manageCronController" class="container">
<div id="page-title">
<h2>{% trans "Cron Management" %}</h2>
<h2 style="display: inline;">{% trans "Cron Management" %} - <a target="_blank" href="http://go.cyberpanel.net/cron-jobs" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Cron Docs" %}</span></a></h2>
<p>{% trans "Create, edit or delete your cron jobs from this page." %}</p>
</div>

View File

@@ -690,7 +690,7 @@
<div ng-hide="rewriteRulesFetched" class="alert alert-success">
<p>{% trans "Current rewrite rules in the file fetched." %}</p>
<p>{% trans "Current rewrite rules in the file fetched." %} <a target="_blank" href="http://go.cyberpanel.net/cyber9bed2">Click</a> to read more about whats changed in <a target="_blank" href="http://go.cyberpanel.net/rewrite">rewrite rules</a> from v1.7 onwards.</p>
</div>