Merge branch 'v2.3.4' into v2.3.5-dev

This commit is contained in:
usman@cyberpersons.com
2023-05-15 12:19:52 +05:00
30 changed files with 776 additions and 403 deletions

View File

@@ -4,6 +4,7 @@ import subprocess
import shlex
import plogical.CyberCPLogFileWriter as logging
from ApachController.ApacheVhosts import ApacheVhost
from plogical.processUtilities import ProcessUtilities
class ApacheController:
@@ -102,57 +103,96 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
def InstallApache():
try:
command = "yum install -y httpd httpd-tools mod_ssl php-fpm"
if ApacheController.executioner(command) == 0:
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
command = "yum install -y httpd httpd-tools mod_ssl php-fpm"
else:
command = "apt update -y && sudo apt upgrade -y && apt install apache2 -y"
if ProcessUtilities.executioner(command, None, True) == 0:
return "Failed to install Apache and PHP-FPM."
command = "yum -y install centos-release-scl yum-utils"
if ApacheController.executioner(command) == 0:
return "Failed to centos-release-scl and yum-utils"
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
command = "yum-config-manager --enable rhel-server-rhscl-7-rpms"
if ApacheController.executioner(command) == 0:
return "Failed to --enable rhel-server-rhscl-7-rpms"
command = "yum -y install centos-release-scl yum-utils"
if ProcessUtilities.executioner(command) == 0:
return "Failed to centos-release-scl and yum-utils"
command = "yum-config-manager --enable rhel-server-rhscl-7-rpms"
if ProcessUtilities.executioner(command) == 0:
return "Failed to --enable rhel-server-rhscl-7-rpms"
sslPath = "/etc/apache2/conf.d/ssl.conf"
if os.path.exists(sslPath):
os.remove(sslPath)
confPath = ApacheVhost.serverRootPath + "/conf/httpd.conf"
data = open(confPath, 'r').readlines()
writeToFile = open(confPath, 'w')
for items in data:
if items.find("Listen") > -1 and items.find("80") > -1 and items.find('#') == -1:
writeToFile.writelines("Listen 8081\nListen 8082\n")
elif items.find("User") > -1 and items.find('#') == -1:
writeToFile.writelines("User nobody\n")
elif items.find("Group") > -1 and items.find('#') == -1:
writeToFile.writelines("Group nobody\n")
writeToFile.writelines('SetEnv LSWS_EDITION Openlitespeed\nSetEnv X-LSCACHE on\n')
elif items[0] == "#":
continue
else:
writeToFile.writelines(items)
writeToFile.close()
# MPM Module Configurations
writeToFile = open(ApacheController.mpmConfigsPath, 'w')
writeToFile.write(ApacheController.mpmConfigs)
writeToFile.close()
## Minor Configuration changes.
else:
sslPath = "/etc/httpd/conf.d/ssl.conf"
if os.path.exists(sslPath):
os.remove(sslPath)
sslPath = "/etc/httpd/conf.d/ssl.conf"
confPath = ApacheVhost.serverRootPath + "/apache2.conf"
confPath = ApacheVhost.serverRootPath + "/conf/httpd.conf"
portsPath = '/etc/apache2/ports.conf'
data = open(confPath, 'r').readlines()
writeToFile = open(confPath, 'w')
WriteToFile = open(portsPath, 'w')
WriteToFile.write('Listen 8081\nListen 8082\n')
WriteToFile.close()
for items in data:
if items.find("Listen") > -1 and items.find("80") > -1 and items.find('#') == -1:
writeToFile.writelines("Listen 8081\nListen 8082\n")
elif items.find("User") > -1 and items.find('#') == -1:
writeToFile.writelines("User nobody\n")
elif items.find("Group") > -1 and items.find('#') == -1:
writeToFile.writelines("Group nobody\n")
writeToFile.writelines('SetEnv LSWS_EDITION Openlitespeed\nSetEnv X-LSCACHE on\n')
elif items[0] == "#":
continue
else:
writeToFile.writelines(items)
writeToFile.close()
# MPM Module Configurations
command = f"sed -i 's/User ${{APACHE_RUN_USER}}/User nobody/g' {confPath}"
if ProcessUtilities.executioner(command, None, True) == 0:
return "Apache run user change failed"
writeToFile = open(ApacheController.mpmConfigsPath , 'w')
writeToFile.write(ApacheController.mpmConfigs)
writeToFile.close()
command = f"sed -i 's/Group ${{APACHE_RUN_GROUP}}/Group nogroup/g' {confPath}"
if ProcessUtilities.executioner(command, None, True) == 0:
return "Apache run group change failed"
command = 'apt-get install apache2-suexec-pristine -y'
if ProcessUtilities.executioner(command, None, True) == 0:
return "Apache run apache2-suexec-pristine"
command = 'a2enmod suexec proxy ssl proxy_fcgi proxy'
if ProcessUtilities.executioner(command, None, True) == 0:
return "Apache run suexec proxy ssl"
###
command = "systemctl start httpd.service"
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
serviceName = 'httpd'
else:
serviceName = 'apache2'
command = f"systemctl start {serviceName}.service"
ApacheController.executioner(command)
command = "systemctl enable httpd.service"
command = f"systemctl enable {serviceName}.service"
ApacheController.executioner(command)
return 1
@@ -164,83 +204,100 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
def phpVersions():
# Version 5.4
command = 'yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm'
ApacheController.executioner(command)
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
command = 'yum-config-manager --enable remi-php'
ApacheController.executioner(command)
command = 'yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm'
ApacheController.executioner(command)
command = 'yum-config-manager --enable remi-php'
ApacheController.executioner(command)
command = 'yum install -y php54-php-fpm php54-php-gd php54-php-xml php54-php-twig php54-php-zstd php54-php-tidy' \
'php54-php-suhosin php54-php-soap php54-php-snmp php54-php-snappy php54-php-smbclient' \
'php54-php-process php54-php-pimple php54-php-pgsql php54-php-pear.noarch php54-php-pdo' \
'php54-php-mysqlnd php54-php-mssql php54-php-mcrypt php54-php-mbstring php54-php-maxminddb' \
'php54-php-common php54-php-imap php54-php-intl php54-php-tarantool php54-php-pspell php54-php-oci8' \
'php54-php-bcmath php54-php-litespeed php54-php-recode php54-php-odbc'
if ApacheController.executioner(command) == 0:
return "Failed to install php54-fpm"
command = 'yum install -y php54-php-fpm php54-php-gd php54-php-xml php54-php-twig php54-php-zstd php54-php-tidy' \
'php54-php-suhosin php54-php-soap php54-php-snmp php54-php-snappy php54-php-smbclient' \
'php54-php-process php54-php-pimple php54-php-pgsql php54-php-pear.noarch php54-php-pdo' \
'php54-php-mysqlnd php54-php-mssql php54-php-mcrypt php54-php-mbstring php54-php-maxminddb' \
'php54-php-common php54-php-imap php54-php-intl php54-php-tarantool php54-php-pspell php54-php-oci8' \
'php54-php-bcmath php54-php-litespeed php54-php-recode php54-php-odbc'
if ApacheController.executioner(command) == 0:
return "Failed to install php54-fpm"
# Version 5.5
command = 'yum install -y php55-php-fpm php55-php-gd php55-php-xml php55-php-twig php55-php-zstd php55-php-tidy' \
'php55-php-suhosin php55-php-soap php55-php-snmp php55-php-snappy php55-php-smbclient ' \
'php55-php-process php55-php-pimple php55-php-pgsql php55-php-pear.noarch php55-php-pdo' \
'php55-php-mysqlnd php55-php-mssql php55-php-mcrypt php55-php-mbstring php55-php-maxminddb' \
'php55-php-common php55-php-imap php55-php-intl php55-php-tarantool php55-php-pspell php55-php-oci8' \
'php55-php-litespeed php55-php-bcmath php55-php-odbc php55-php-recode'
if ApacheController.executioner(command) == 0:
return "Failed to install php55-fpm"
# Version 5.5
command = 'yum install -y php55-php-fpm php55-php-gd php55-php-xml php55-php-twig php55-php-zstd php55-php-tidy' \
'php55-php-suhosin php55-php-soap php55-php-snmp php55-php-snappy php55-php-smbclient ' \
'php55-php-process php55-php-pimple php55-php-pgsql php55-php-pear.noarch php55-php-pdo' \
'php55-php-mysqlnd php55-php-mssql php55-php-mcrypt php55-php-mbstring php55-php-maxminddb' \
'php55-php-common php55-php-imap php55-php-intl php55-php-tarantool php55-php-pspell php55-php-oci8' \
'php55-php-litespeed php55-php-bcmath php55-php-odbc php55-php-recode'
if ApacheController.executioner(command) == 0:
return "Failed to install php55-fpm"
# Version 5.6
command = 'yum install -y php56-php-fpm php56-php-gd php56-php-xml php56-php-twig php56-php-zstd php56-php-tidy' \
'php56-php-suhosin php56-php-soap php56-php-snmp php56-php-snappy php56-php-smbclient' \
'php56-php-process php56-php-pimple php56-php-pgsql php56-php-pear.noarch php56-php-pdo ' \
'php56-php-mysqlnd php56-php-mssql php56-php-mcrypt php56-php-mbstring php56-php-maxminddb' \
'php56-php-common php56-php-imap php56-php-intl php56-php-tarantool php56-php-recode' \
'php56-php-odbc php56-php-oci8 php56-php-litespeed php56-php-bcmath php56-php-pspell'
if ApacheController.executioner(command) == 0:
return "Failed to install php56-fpm"
# Version 5.6
command = 'yum install -y php56-php-fpm php56-php-gd php56-php-xml php56-php-twig php56-php-zstd php56-php-tidy' \
'php56-php-suhosin php56-php-soap php56-php-snmp php56-php-snappy php56-php-smbclient' \
'php56-php-process php56-php-pimple php56-php-pgsql php56-php-pear.noarch php56-php-pdo ' \
'php56-php-mysqlnd php56-php-mssql php56-php-mcrypt php56-php-mbstring php56-php-maxminddb' \
'php56-php-common php56-php-imap php56-php-intl php56-php-tarantool php56-php-recode' \
'php56-php-odbc php56-php-oci8 php56-php-litespeed php56-php-bcmath php56-php-pspell'
if ApacheController.executioner(command) == 0:
return "Failed to install php56-fpm"
# Version 7.0
command = 'yum install -y php70-php-fpm php70-php-gd php70-php-xml php70-php-twig php70-php-zstd php70-php-tidy' \
'php70-php-suhosin php70-php-soap php70-php-snmp php70-php-snappy php70-php-smbclient' \
'php70-php-process php70-php-pimple php70-php-pgsql php70-php-pear.noarch php70-php-pdo ' \
'php70-php-mysqlnd php70-php-mssql php70-php-mcrypt php70-php-mbstring php70-php-maxminddb' \
'php70-php-common php70-php-imap php70-php-intl php70-php-tarantool php70-php-recode' \
'php70-php-odbc php70-php-oci8 php70-php-litespeed php70-php-bcmath php70-php-pspell'
if ApacheController.executioner(command) == 0:
return "Failed to install php70-fpm"
# Version 7.0
command = 'yum install -y php70-php-fpm php70-php-gd php70-php-xml php70-php-twig php70-php-zstd php70-php-tidy' \
'php70-php-suhosin php70-php-soap php70-php-snmp php70-php-snappy php70-php-smbclient' \
'php70-php-process php70-php-pimple php70-php-pgsql php70-php-pear.noarch php70-php-pdo ' \
'php70-php-mysqlnd php70-php-mssql php70-php-mcrypt php70-php-mbstring php70-php-maxminddb' \
'php70-php-common php70-php-imap php70-php-intl php70-php-tarantool php70-php-recode' \
'php70-php-odbc php70-php-oci8 php70-php-litespeed php70-php-bcmath php70-php-pspell'
if ApacheController.executioner(command) == 0:
return "Failed to install php70-fpm"
# Version 7.1
command = 'yum install -y php71-php-fpm php71-php-gd php71-php-xml php71-php-twig php71-php-zstd php71-php-tidy' \
'php71-php-suhosin php71-php-soap php71-php-snmp php71-php-snappy php71-php-smbclient' \
'php71-php-process php71-php-pimple php71-php-pgsql php71-php-pear.noarch php71-php-pdo ' \
'php71-php-mysqlnd php71-php-mssql php71-php-mcrypt php71-php-mbstring php71-php-maxminddb' \
'php71-php-common php71-php-imap php71-php-intl php71-php-tarantool php71-php-recode' \
'php71-php-odbc php71-php-oci8 php71-php-litespeed php71-php-bcmath php71-php-pspell'
if ApacheController.executioner(command) == 0:
return "Failed to install php71-fpm"
# Version 7.1
command = 'yum install -y php71-php-fpm php71-php-gd php71-php-xml php71-php-twig php71-php-zstd php71-php-tidy' \
'php71-php-suhosin php71-php-soap php71-php-snmp php71-php-snappy php71-php-smbclient' \
'php71-php-process php71-php-pimple php71-php-pgsql php71-php-pear.noarch php71-php-pdo ' \
'php71-php-mysqlnd php71-php-mssql php71-php-mcrypt php71-php-mbstring php71-php-maxminddb' \
'php71-php-common php71-php-imap php71-php-intl php71-php-tarantool php71-php-recode' \
'php71-php-odbc php71-php-oci8 php71-php-litespeed php71-php-bcmath php71-php-pspell'
if ApacheController.executioner(command) == 0:
return "Failed to install php71-fpm"
# Version 7.2
command = 'yum install -y php72-php-fpm php72-php-gd php72-php-xml php72-php-twig php72-php-zstd php72-php-tidy' \
'php72-php-suhosin php72-php-soap php72-php-snmp php72-php-snappy php72-php-smbclient' \
'php72-php-process php72-php-pimple php72-php-pgsql php72-php-pear.noarch php72-php-pdo ' \
'php72-php-mysqlnd php72-php-mssql php72-php-mcrypt php72-php-mbstring php72-php-maxminddb' \
'php72-php-common php72-php-imap php72-php-intl php72-php-tarantool php72-php-recode' \
'php72-php-odbc php72-php-oci8 php72-php-litespeed php72-php-bcmath php72-php-pspell'
if ApacheController.executioner(command) == 0:
return "Failed to install php72-fpm"
# Version 7.2
command = 'yum install -y php72-php-fpm php72-php-gd php72-php-xml php72-php-twig php72-php-zstd php72-php-tidy' \
'php72-php-suhosin php72-php-soap php72-php-snmp php72-php-snappy php72-php-smbclient' \
'php72-php-process php72-php-pimple php72-php-pgsql php72-php-pear.noarch php72-php-pdo ' \
'php72-php-mysqlnd php72-php-mssql php72-php-mcrypt php72-php-mbstring php72-php-maxminddb' \
'php72-php-common php72-php-imap php72-php-intl php72-php-tarantool php72-php-recode' \
'php72-php-odbc php72-php-oci8 php72-php-litespeed php72-php-bcmath php72-php-pspell'
if ApacheController.executioner(command) == 0:
return "Failed to install php72-fpm"
# Version 7.3
command = 'yum install -y php73-php-fpm php73-php-gd php73-php-xml php73-php-twig php73-php-zstd php73-php-tidy' \
'php73-php-suhosin php73-php-soap php73-php-snmp php73-php-snappy php73-php-smbclient' \
'php73-php-process php73-php-pimple php73-php-pgsql php73-php-pear.noarch php73-php-pdo ' \
'php73-php-mysqlnd php73-php-mssql php73-php-mcrypt php73-php-mbstring php73-php-maxminddb' \
'php73-php-common php73-php-imap php73-php-intl php73-php-tarantool php73-php-recode' \
'php73-php-odbc php73-php-oci8 php73-php-litespeed php73-php-bcmath php73-php-pspell'
# Version 7.3
command = 'yum install -y php73-php-fpm php73-php-gd php73-php-xml php73-php-twig php73-php-zstd php73-php-tidy' \
'php73-php-suhosin php73-php-soap php73-php-snmp php73-php-snappy php73-php-smbclient' \
'php73-php-process php73-php-pimple php73-php-pgsql php73-php-pear.noarch php73-php-pdo ' \
'php73-php-mysqlnd php73-php-mssql php73-php-mcrypt php73-php-mbstring php73-php-maxminddb' \
'php73-php-common php73-php-imap php73-php-intl php73-php-tarantool php73-php-recode' \
'php73-php-odbc php73-php-oci8 php73-php-litespeed php73-php-bcmath php73-php-pspell'
if ApacheController.executioner(command) == 0:
return "Failed to install php73-fpm"
if ApacheController.executioner(command) == 0:
return "Failed to install php73-fpm"
else:
command = 'apt install python-software-properties -y'
if ProcessUtilities.executioner(command, None, True) == 0:
return "Failed to install python-software-properties"
command = 'add-apt-repository ppa:ondrej/php -y'
if ProcessUtilities.executioner(command, None, True) == 0:
return "Failed to ppa:ondrej/php"
command = "sudo apt-get install -y php-fpm php7.4-fpm php8.0-fpm php7.4-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-zip php8.0-mysql php8.0-curl php8.0-gd php8.0-mbstring php8.0-xml php8.0-zip"
if ProcessUtilities.executioner(command, None, True) == 0:
return "Failed to install Apache and PHP-FPM."
try:
wwwConfPath = ApacheVhost.php54Path + "/www.conf"

View File

@@ -16,18 +16,45 @@ import re
class ApacheVhost:
apacheInstallStatusPath = '/home/cyberpanel/apacheInstallStatus'
serverRootPath = '/etc/httpd'
configBasePath = '/etc/httpd/conf.d/'
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
serverRootPath = '/etc/httpd'
configBasePath = '/etc/httpd/conf.d/'
php54Path = '/opt/remi/php54/root/etc/php-fpm.d/'
php55Path = '/opt/remi/php55/root/etc/php-fpm.d/'
php56Path = '/etc/opt/remi/php56/php-fpm.d/'
php70Path = '/etc/opt/remi/php70/php-fpm.d/'
php71Path = '/etc/opt/remi/php71/php-fpm.d/'
php72Path = '/etc/opt/remi/php72/php-fpm.d/'
php73Path = '/etc/opt/remi/php73/php-fpm.d/'
else:
serverRootPath = '/etc/apache2'
configBasePath = '/etc/apache2/sites-enabled/'
php54Path = '/etc/php/5.4/fpm/pool.d/'
php55Path = '/etc/php/5.5/fpm/pool.d/'
php56Path = '/etc/php/5.6/fpm/pool.d/'
php70Path = '/etc/php/7.0/fpm/pool.d/'
php71Path = '/etc/php/7.1/fpm/pool.d/'
php72Path = '/etc/php/7.2/fpm/pool.d/'
php73Path = '/etc/php/7.3/fpm/pool.d/'
php74Path = '/etc/php/7.4/fpm/pool.d/'
php80Path = '/etc/php/8.0/fpm/pool.d/'
php81Path = '/etc/php/8.1/fpm/pool.d/'
php82Path = '/etc/php/8.2/fpm/pool.d/'
lswsMainConf = "/usr/local/lsws/conf/httpd_config.conf"
php54Path = '/opt/remi/php54/root/etc/php-fpm.d/'
php55Path = '/opt/remi/php55/root/etc/php-fpm.d/'
php56Path = '/etc/opt/remi/php56/php-fpm.d/'
php70Path = '/etc/opt/remi/php70/php-fpm.d/'
php71Path = '/etc/opt/remi/php71/php-fpm.d/'
php72Path = '/etc/opt/remi/php72/php-fpm.d/'
php73Path = '/etc/opt/remi/php73/php-fpm.d/'
count = 0
sslBasePath = "/etc/httpd/conf.d/ssl/"
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
sslBasePath = "/etc/httpd/conf.d/ssl/"
else:
sslBasePath = "/etc/apache2/conf-enabled/"
@staticmethod
def DecidePHPPath(php, virtualHostName):
@@ -45,6 +72,14 @@ class ApacheVhost:
finalConfPath = ApacheVhost.php72Path + virtualHostName
elif php == '73':
finalConfPath = ApacheVhost.php73Path + virtualHostName
elif php == '74':
finalConfPath = ApacheVhost.php74Path + virtualHostName
elif php == '80':
finalConfPath = ApacheVhost.php80Path + virtualHostName
elif php == '81':
finalConfPath = ApacheVhost.php81Path + virtualHostName
elif php == '82':
finalConfPath = ApacheVhost.php82Path + virtualHostName
return finalConfPath + '.conf'
@@ -74,6 +109,18 @@ class ApacheVhost:
if os.path.exists(ApacheVhost.php73Path + virtualHostName):
return ApacheVhost.php73Path + virtualHostName
if os.path.exists(ApacheVhost.php74Path + virtualHostName):
return ApacheVhost.php74Path + virtualHostName
if os.path.exists(ApacheVhost.php80Path + virtualHostName):
return ApacheVhost.php80Path + virtualHostName
if os.path.exists(ApacheVhost.php81Path + virtualHostName):
return ApacheVhost.php81Path + virtualHostName
if os.path.exists(ApacheVhost.php82Path + virtualHostName):
return ApacheVhost.php82Path + virtualHostName
@staticmethod
def GenerateSelfSignedSSL(virtualHostName):
if os.path.exists(ApacheVhost.sslBasePath):
@@ -90,6 +137,11 @@ class ApacheVhost:
def perHostVirtualConf(administratorEmail,externalApp, virtualHostUser, phpVersion, virtualHostName):
try:
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
sockPath = '/var/run/php-fpm/'
else:
sockPath = '/var/run/php/'
## Non-SSL Conf
finalConfPath = ApacheVhost.configBasePath + virtualHostName + '.conf'
@@ -104,6 +156,7 @@ class ApacheVhost:
currentConf = currentConf.replace('{php}', php)
currentConf = currentConf.replace('{adminEmails}', administratorEmail)
currentConf = currentConf.replace('{externalApp}', virtualHostUser)
currentConf = currentConf.replace('{sockPath}', sockPath)
confFile.write(currentConf)
confFile.close()
@@ -122,6 +175,8 @@ class ApacheVhost:
currentConf = currentConf.replace('{php}', php)
currentConf = currentConf.replace('{adminEmails}', administratorEmail)
currentConf = currentConf.replace('{externalApp}', virtualHostUser)
currentConf = currentConf.replace('{SSLBase}', ApacheVhost.sslBasePath)
currentConf = currentConf.replace('{sockPath}', sockPath)
confFile.write(currentConf)
confFile.close()
@@ -135,6 +190,7 @@ class ApacheVhost:
currentConf = currentConf.replace('{www}', virtualHostUser)
currentConf = currentConf.replace('{Sock}', virtualHostName)
currentConf = currentConf.replace('{externalApp}', externalApp)
currentConf = currentConf.replace('{sockPath}', sockPath)
confFile.write(currentConf)
@@ -204,6 +260,11 @@ class ApacheVhost:
## Non - SSL Conf
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
sockPath = '/var/run/php-fpm/'
else:
sockPath = '/var/run/php/'
finalConfPath = ApacheVhost.configBasePath + virtualHostName + '.conf'
confFile = open(finalConfPath, "w+")
@@ -216,6 +277,7 @@ class ApacheVhost:
currentConf = currentConf.replace('{adminEmails}', administratorEmail)
currentConf = currentConf.replace('{externalApp}', virtualHostUser)
currentConf = currentConf.replace('{path}', path)
currentConf = currentConf.replace('{sockPath}', sockPath)
confFile.write(currentConf)
confFile.close()
@@ -234,6 +296,8 @@ class ApacheVhost:
currentConf = currentConf.replace('{adminEmails}', administratorEmail)
currentConf = currentConf.replace('{externalApp}', virtualHostUser)
currentConf = currentConf.replace('{path}', path)
currentConf = currentConf.replace('{sockPath}', sockPath)
currentConf = currentConf.replace('{SSLBase}', ApacheVhost.sslBasePath)
confFile.write(currentConf)
confFile.close()
@@ -247,6 +311,7 @@ class ApacheVhost:
currentConf = currentConf.replace('{www}', "".join(re.findall("[a-zA-Z]+", virtualHostName))[:7])
currentConf = currentConf.replace('{Sock}', virtualHostName)
currentConf = currentConf.replace('{externalApp}', externalApp)
currentConf = currentConf.replace('{sockPath}', sockPath)
confFile.write(currentConf)

View File

@@ -164,13 +164,20 @@ pattern_to_watch = ^/home/.+?/(public_html|public_ftp|private_html)(/.*)?$
##
command = 'pkill -f "bash i360deploy.sh"'
ServerStatusUtil.executioner(command, statusFile)
if not os.path.exists('i360deploy.sh'):
command = 'wget https://repo.imunify360.cloudlinux.com/defence360/i360deploy.sh'
ServerStatusUtil.executioner(command, statusFile)
command = 'bash i360deploy.sh --key %s --beta' % (key)
command = 'bash i360deploy.sh --uninstall --yes'
ServerStatusUtil.executioner(command, statusFile)
command = 'bash i360deploy.sh --key %s --yes' % (key)
ServerStatusUtil.executioner(command, statusFile)
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
"Imunify reinstalled..\n", 1)
@@ -211,11 +218,17 @@ ui_path_owner = lscpd:lscpd
##
command = 'pkill -f "bash imav-deploy.sh"'
ServerStatusUtil.executioner(command, statusFile)
if not os.path.exists('imav-deploy.sh'):
command = 'wget https://repo.imunify360.cloudlinux.com/defence360/imav-deploy.sh'
ServerStatusUtil.executioner(command, statusFile)
command = 'bash imav-deploy.sh'
command = 'bash imav-deploy.sh --uninstall --yes'
ServerStatusUtil.executioner(command, statusFile)
command = 'bash imav-deploy.sh --yes'
ServerStatusUtil.executioner(command, statusFile)
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,

View File

@@ -5,7 +5,7 @@ class CLMain():
self.path = '/usr/local/CyberCP/version.txt'
#versionInfo = json.loads(open(self.path, 'r').read())
self.version = '2.3'
self.build = '3'
self.build = '4'
ipFile = "/etc/cyberpanel/machineIP"
f = open(ipFile)

View File

@@ -1212,7 +1212,7 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compil
$scope.goBackDisable = true;
$scope.selectwebsite = function () {
document.getElementById('reposelectbox').innerHTML = "";
//document.getElementById('reposelectbox').innerHTML = "";
$scope.backupLoading = false;
var url = "/IncrementalBackups/selectwebsiteRetorev2";
@@ -1237,38 +1237,42 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compil
$scope.backupLoading = true;
if (response.data.status === 1) {
$scope.repos = response.data.data;
const selectBox = document.getElementById('reposelectbox');
console.log($scope.repos);
const options = response.data.data;
const option = document.createElement('option');
option.value = 1;
option.text = 'Choose Repo';
selectBox.appendChild(option);
if (options.length >= 1) {
for (let i = 0; i < options.length; i++) {
const option = document.createElement('option');
option.value = options[i];
option.text = options[i];
selectBox.appendChild(option);
}
} else {
new PNotify({
title: 'Error!',
text: 'file empty',
type: 'error'
});
}
// const selectBox = document.getElementById('reposelectbox');
//
//
// const options = response.data.data;
// const option = document.createElement('option');
//
//
// option.value = 1;
// option.text = 'Choose Repo';
//
// selectBox.appendChild(option);
//
// if (options.length >= 1) {
// for (let i = 0; i < options.length; i++) {
//
// const option = document.createElement('option');
//
//
// option.value = options[i];
// option.text = options[i];
//
// selectBox.appendChild(option);
// }
//
// } else {
// new PNotify({
// title: 'Error!',
// text: 'file empty',
// type: 'error'
// });
// }
} else {
@@ -1393,7 +1397,7 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compil
snapshotid: SnapshotId,
path: Path,
selwebsite: $scope.selwebsite,
selectedrepo: $('#reposelectbox').val()
selectedrepo: $scope.testhabbi
}
var config = {
@@ -1446,7 +1450,7 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compil
var url = "/IncrementalBackups/selectreporestorev2";
var data = {
Selectedrepo: $('#reposelectbox').val(),
Selectedrepo: $scope.testhabbi,
Selectedwebsite: $scope.selwebsite,
}
//alert( $scope.selwebsite);

View File

@@ -47,9 +47,9 @@
<label class="col-sm-3 control-label">{% trans "Select Repo" %} </label>
<div class="col-sm-6">
<select id="reposelectbox" ng-change="selectrepo()" ng-model="testhabbi"
<select ng-change="selectrepo()" ng-model="testhabbi"
class="form-control">
<option ng-repeat="repo in repos track by $index">{$ repo $}</option>
</select>
</div>
</div>
@@ -201,9 +201,9 @@
</div>
<p align="center">
<iframe width="788.54" height="443" src="https://www.youtube.com/embed/7dI1013xvUc"
title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>
title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>
</p>
<div style="margin-top: 2%">
<stripe-pricing-table pricing-table-id="prctbl_1MQtdYJMfY1fWGMszc4tx78j"

View File

@@ -809,6 +809,7 @@ def CreateV2BackupButton(request):
background = CPBackupsV2(extra_args)
background.start()
# background = CPBackupsV2({'domain': Selectedwebsite, 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1,
# 'BackupEmails': 1, 'BackendName': Selectedrepo, 'function': 'InitiateBackup', })
# background.start()
@@ -981,7 +982,7 @@ def selectwebsiteCreatev2(request):
else:
return ACLManager.loadError()
obj = Websites.objects.get(domain = str(Selectedwebsite), admin = admin)
obj = Websites.objects.get(domain = str(Selectedwebsite))
#/home/cyberpanel.net/.config/rclone/rclone.conf
path = '/home/%s/.config/rclone/rclone.conf' %(obj.domain)

View File

@@ -1820,6 +1820,13 @@ class BackupManager:
def CreateV2BackupStatus(self, userID=None, data=None):
try:
domain = data['domain']
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
if ACLManager.checkOwnership(domain, admin, currentACL) == 1:
pass
else:
return ACLManager.loadError()
statusFile = f'/home/cyberpanel/{domain}_rustic_backup_log'

View File

@@ -77,7 +77,7 @@
<!-- HELPERS -->
{% with version="2.3.2.3.1" %}
{% with version="2.3.4" %}
<link rel="stylesheet" type="text/css" href="{% static 'baseTemplate/assets/finalBase/finalBase.css' %}">

View File

@@ -19,7 +19,7 @@ from plogical.httpProc import httpProc
# Create your views here.
VERSION = '2.3'
BUILD = 3
BUILD = 4
@ensure_csrf_cookie

View File

@@ -1974,8 +1974,8 @@ class CloudManager:
except:
path = '/home/%s/public_html' % (self.data['domain'])
command = 'wp core version --skip-plugins --skip-themes --path=%s' % (path)
finalDic['version'] = str(ProcessUtilities.outputExecutioner(command, website.externalApp))
command = 'wp core version --skip-plugins --skip-themes --path=%s 2>/dev/null' % (path)
finalDic['version'] = str(ProcessUtilities.outputExecutioner(command, website.externalApp, True))
## LSCache
@@ -2633,8 +2633,8 @@ class CloudManager:
path = '/home/%s/public_html' % (self.data['domainName'])
command = 'wp core version --allow-root --skip-plugins --skip-themes --path=%s' % (path)
result = ProcessUtilities.outputExecutioner(command)
command = 'wp core version --allow-root --skip-plugins --skip-themes --path=%s 2>/dev/null' % (path)
result = ProcessUtilities.outputExecutioner(command, None, True)
if result.find('Error:') > -1:
final_dic = {'status': 0, 'fetchStatus': 0,

View File

@@ -130,60 +130,67 @@ class ContainerManager(multi.Thread):
return proc.render()
def loadContainerHome(self, request=None, userID=None, data=None):
name = self.name
if ACLManager.checkContainerOwnership(name, userID) != 1:
return ACLManager.loadError()
client = docker.from_env()
dockerAPI = docker.APIClient()
try:
container = client.containers.get(name)
except docker.errors.NotFound as err:
return HttpResponse("Container not found")
name = self.name
data = {}
con = Containers.objects.get(name=name)
data['name'] = name
data['image'] = con.image + ":" + con.tag
data['ports'] = json.loads(con.ports)
data['cid'] = con.cid
data['envList'] = json.loads(con.env)
data['volList'] = json.loads(con.volumes)
if ACLManager.checkContainerOwnership(name, userID) != 1:
return ACLManager.loadError()
stats = container.stats(decode=False, stream=False)
logs = container.logs(stream=True)
client = docker.from_env()
dockerAPI = docker.APIClient()
data['status'] = container.status
data['memoryLimit'] = con.memory
if con.startOnReboot == 1:
data['startOnReboot'] = 'true'
data['restartPolicy'] = "Yes"
else:
data['startOnReboot'] = 'false'
data['restartPolicy'] = "No"
try:
container = client.containers.get(name)
except docker.errors.NotFound as err:
return HttpResponse("Container not found")
if 'usage' in stats['memory_stats']:
# Calculate Usage
# Source: https://github.com/docker/docker/blob/28a7577a029780e4533faf3d057ec9f6c7a10948/api/client/stats.go#L309
data['memoryUsage'] = (stats['memory_stats']['usage'] / stats['memory_stats']['limit']) * 100
data = {}
con = Containers.objects.get(name=name)
data['name'] = name
data['image'] = con.image + ":" + con.tag
data['ports'] = json.loads(con.ports)
data['cid'] = con.cid
data['envList'] = json.loads(con.env)
data['volList'] = json.loads(con.volumes)
cpu_count = len(stats["cpu_stats"]["cpu_usage"]["percpu_usage"])
data['cpuUsage'] = 0.0
cpu_delta = float(stats["cpu_stats"]["cpu_usage"]["total_usage"]) - \
float(stats["precpu_stats"]["cpu_usage"]["total_usage"])
system_delta = float(stats["cpu_stats"]["system_cpu_usage"]) - \
float(stats["precpu_stats"]["system_cpu_usage"])
if system_delta > 0.0:
data['cpuUsage'] = round(cpu_delta / system_delta * 100.0 * cpu_count, 3)
else:
data['memoryUsage'] = 0
data['cpuUsage'] = 0
stats = container.stats(decode=False, stream=False)
logs = container.logs(stream=True)
template = 'dockerManager/viewContainer.html'
proc = httpProc(request, template, data, 'admin')
return proc.render()
data['status'] = container.status
data['memoryLimit'] = con.memory
if con.startOnReboot == 1:
data['startOnReboot'] = 'true'
data['restartPolicy'] = "Yes"
else:
data['startOnReboot'] = 'false'
data['restartPolicy'] = "No"
if 'usage' in stats['memory_stats']:
# Calculate Usage
# Source: https://github.com/docker/docker/blob/28a7577a029780e4533faf3d057ec9f6c7a10948/api/client/stats.go#L309
data['memoryUsage'] = (stats['memory_stats']['usage'] / stats['memory_stats']['limit']) * 100
try:
cpu_count = len(stats["cpu_stats"]["cpu_usage"]["percpu_usage"])
except:
cpu_count = 0
data['cpuUsage'] = 0.0
cpu_delta = float(stats["cpu_stats"]["cpu_usage"]["total_usage"]) - \
float(stats["precpu_stats"]["cpu_usage"]["total_usage"])
system_delta = float(stats["cpu_stats"]["system_cpu_usage"]) - \
float(stats["precpu_stats"]["system_cpu_usage"])
if system_delta > 0.0:
data['cpuUsage'] = round(cpu_delta / system_delta * 100.0 * cpu_count, 3)
else:
data['memoryUsage'] = 0
data['cpuUsage'] = 0
template = 'dockerManager/viewContainer.html'
proc = httpProc(request, template, data, 'admin')
return proc.render()
except BaseException as msg:
return HttpResponse(str(msg))
def listContainers(self, request=None, userID=None, data=None):
client = docker.from_env()

View File

@@ -11,10 +11,10 @@
<div class="container">
<div id="page-title">
<h2>{% trans "Imunify" %} - <a target="_blank"
href="https://go.cyberpanel.net/imunify"
style="height: 23px;line-height: 21px;"
class="btn btn-border btn-alt border-red btn-link font-red"
title=""><span>{% trans "Imunify Docs" %}</span></a></h2>
href="https://go.cyberpanel.net/imunify"
style="height: 23px;line-height: 21px;"
class="btn btn-border btn-alt border-red btn-link font-red"
title=""><span>{% trans "Imunify Docs" %}</span></a></h2>
<p>{% trans "Access Imunify" %}</p>
</div>
@@ -25,7 +25,7 @@
</h3>
<div class="example-box-wrapper">
<p>{% trans "Imunify is now integrated via their new API. You can manage Imunify by clicking below. You can use your server root credentials to access Imunify." %}</p>
<p>{% trans "Imunify is now integrated via their new API. You can manage Imunify by clicking below. You can use your server root credentials to access Imunify. Login details for Imunify360 is your server root and its password." %}</p>
<br>
<a target="_blank" href="/imunify">
<button class="btn btn-primary">Access Now
@@ -35,6 +35,79 @@
</div>
</div>
</div>
<div ng-controller="installImunify" class="panel">
<div class="panel-body">
<h3 class="title-hero">
{% trans "Imunify360 Not working?" %} <img ng-hide="installDockerStatus"
src="{% static 'images/loading.gif' %}">
</h3>
<div class="example-box-wrapper">
<br>
<p>{% trans "If for some reason Imunify360 is not working, you can re-install it using the form below." %}</p>
<br>
<!------ LSWS Switch box ----------------->
<div class="alert alert-info">
<div class="bg-black alert-icon">
<i class="glyph-icon icon-comment"></i>
</div>
<div class="alert-content">
<h4 class="alert-title">We will run following commands again:</h4>
<br>
<p><code>wget https://repo.imunify360.cloudlinux.com/defence360/i360deploy.sh -O
i360deploy.sh</code></p>
<br>
<p><code>bash i360deploy.sh --key YOUR_KEY --yes</code></p>
<br>
<p>If you can still not access Imunify360 after re-installation, just run
the above commands on your server terminal, make sure to replace <code>YOUR_KEY</code>
with your
Imunify360 Key.</p>
</div>
</div>
<div style="margin-top: 2%" ng-hide="installBoxGen" class="col-md-12">
<form action="/" id="" class="form-horizontal bordered-row">
<div class="form-group">
<div style="margin-top: 2%;" class="col-sm-12">
<textarea ng-model="requestData" rows="15"
class="form-control">{{ requestData }}</textarea>
</div>
</div>
</form>
</div>
<!----- LSWS Switch box ----------------->
<br>
<form action="/" id="" class="form-horizontal bordered-row">
<div ng-hide="dockerInstallBTN" class="form-group">
<label class="col-sm-3 control-label">{% trans "Imunify Key" %}</label>
<div class="col-sm-6">
<input name="key" type="text" class="form-control" ng-model="key" required>
</div>
</div>
<div ng-hide="dockerInstallBTN" ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-6">
<button type="button" class="btn btn-primary"
ng-click="submitinstallImunify()">
Re-Install Now
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -36,6 +36,69 @@
</div>
</div>
<div ng-controller="installImunifyAV" class="panel">
<div class="panel-body">
<h3 class="title-hero">
{% trans "ImunifyAV Not Working?" %} <img ng-hide="installDockerStatus"
src="{% static 'images/loading.gif' %}">
</h3>
<div class="example-box-wrapper">
<p>{% trans "If for some reason ImunifyAV is not working, you can re-install it using the form below." %}</p><br>
<!------ LSWS Switch box ----------------->
<div class="alert alert-info">
<div class="bg-black alert-icon">
<i class="glyph-icon icon-comment"></i>
</div>
<div class="alert-content">
<h4 class="alert-title">We will run following commands again:</h4>
<br>
<p><code>wget https://repo.imunify360.cloudlinux.com/defence360/imav-deploy.sh</code></p>
<br>
<p><code>bash imav-deploy.sh</code></p>
<br>
<p>If you can still not access ImunifyAV after re-installation, just run
the above commands on your server terminal.</p>
</div>
</div>
<div style="margin-top: 2%" ng-hide="installBoxGen" class="col-md-12">
<form action="/" id="" class="form-horizontal bordered-row">
<div class="form-group">
<div style="margin-top: 2%;" class="col-sm-12">
<textarea ng-model="requestData" rows="15"
class="form-control">{{ requestData }}</textarea>
</div>
</div>
</form>
</div>
<!----- LSWS Switch box ----------------->
<br>
<form action="/" id="" class="form-horizontal bordered-row">
<div ng-hide="dockerInstallBTN" ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-6">
<button type="button" class="btn btn-primary"
ng-click="submitinstallImunify()">
Install Now
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -15,7 +15,7 @@ from stat import *
import stat
VERSION = '2.3'
BUILD = 3
BUILD = 4
char_set = {'small': 'abcdefghijklmnopqrstuvwxyz', 'nums': '0123456789', 'big': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}

View File

@@ -19,7 +19,7 @@ from django.utils import translation
# Create your views here.
VERSION = '2.3'
BUILD = 3
BUILD = 4
def verifyLogin(request):

View File

@@ -1086,8 +1086,13 @@ team_drive =
finalConfigPath = f'/home/cyberpanel/v2backups/{website}'
if not os.path.exists('/home/cyberpanel/v2backups/'):
command = 'mkdir -p /home/cyberpanel/v2backups/'
ProcessUtilities.executioner(command, 'cyberpanel')
if os.path.exists(finalConfigPath):
logging.CyberCPLogFileWriter.writeToFile('22222')
command = f'cat {finalConfigPath}'
RetResult = ProcessUtilities.outputExecutioner(command)

View File

@@ -13,7 +13,7 @@ from packages.models import Package
from baseTemplate.models import version
VERSION = '2.3'
BUILD = 3
BUILD = 4
if not os.geteuid() == 0:
sys.exit("\nOnly root can run this script\n")

View File

@@ -49,7 +49,7 @@ except:
pass
VERSION = '2.3'
BUILD = 3
BUILD = 4
## I am not the monster that you think I am..

View File

@@ -815,7 +815,10 @@ PDNS_Token='{APIKey}'
command = f'echo "{PDNSContent}" >> {path}'
ProcessUtilities.executioner(command,None, True)
PDNSPath = '/etc/pdns/pdns.conf'
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
PDNSPath = '/etc/pdns/pdns.conf'
else:
PDNSPath = '/etc/powerdns/pdns.conf'
PDNSConf = f"""

View File

@@ -155,6 +155,7 @@ class FTPUtilities:
admin = Administrator.objects.get(userName=owner)
if api == '0':
userName = admin.userName + "_" + userName

View File

@@ -167,8 +167,9 @@ class ProcessUtilities(multi.Thread):
distroPath = '/etc/lsb-release'
if os.path.exists(distroPath):
## this is check only
if open(distroPath, 'r').read().find('22.04'):
if open(distroPath, 'r').read().find('22.04') > -1:
ProcessUtilities.ubuntu22Check = 1
if open(distroPath, 'r').read().find('20.04') > -1 or open(distroPath, 'r').read().find('22.04'):

View File

@@ -41,23 +41,34 @@ class Renew:
if int(diff.days) >= 15 and SSLProvider!='Denial':
logging.writeToFile(
'SSL exists for %s and is not ready to renew, skipping..' % (website.domain), 0)
print(
f'SSL exists for %s and is not ready to renew, skipping..' % (website.domain))
elif SSLProvider == 'Denial':
logging.writeToFile(
'SSL exists for %s and ready to renew..' % (website.domain), 0)
logging.writeToFile(
'Renewing SSL for %s..' % (website.domain), 0)
print(
f'SSL exists for %s and ready to renew..' % (website.domain))
virtualHostUtilities.issueSSL(website.domain, '/home/%s/public_html' % (website.domain),
website.adminEmail)
elif SSLProvider != "Let's Encrypt":
logging.writeToFile(
'Custom SSL exists for %s and ready to renew..' % (website.domain), 1)
print(
'Custom SSL exists for %s and ready to renew..' % (website.domain))
else:
logging.writeToFile(
'SSL exists for %s and ready to renew..' % (website.domain), 0)
logging.writeToFile(
'Renewing SSL for %s..' % (website.domain), 0)
print(
'SSL exists for %s and ready to renew..' % (website.domain))
virtualHostUtilities.issueSSL(website.domain, '/home/%s/public_html' % (website.domain), website.adminEmail)
else:
logging.writeToFile(

View File

@@ -17,7 +17,7 @@ import random
import string
VERSION = '2.3'
BUILD = 3
BUILD = 4
CENTOS7 = 0
CENTOS8 = 1
@@ -50,23 +50,23 @@ class Upgrade:
'"hostnameSSL": 1, "mailServerSSL": 1 }'
ResellerACL = '{"adminStatus":0, "versionManagement": 1, "createNewUser": 1, "listUsers": 1, "deleteUser": 1 , "resellerCenter": 1, ' \
'"changeUserACL": 0, "createWebsite": 1, "modifyWebsite": 1, "suspendWebsite": 1, "deleteWebsite": 1, ' \
'"createPackage": 1, "listPackages": 1, "deletePackage": 1, "modifyPackage": 1, "createDatabase": 1, "deleteDatabase": 1, ' \
'"listDatabases": 1, "createNameServer": 1, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"createEmail": 1, "listEmails": 1, "deleteEmail": 1, "emailForwarding": 1, "changeEmailPassword": 1, ' \
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
' "restoreBackup": 1, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
'"hostnameSSL": 0, "mailServerSSL": 0 }'
UserACL = '{"adminStatus":0, "versionManagement": 1, "createNewUser": 0, "listUsers": 0, "deleteUser": 0 , "resellerCenter": 0, ' \
'"changeUserACL": 0, "createWebsite": 0, "modifyWebsite": 0, "suspendWebsite": 0, "deleteWebsite": 0, ' \
'"createPackage": 0, "listPackages": 0, "deletePackage": 0, "modifyPackage": 0, "createDatabase": 1, "deleteDatabase": 1, ' \
'"listDatabases": 1, "createNameServer": 0, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"changeUserACL": 0, "createWebsite": 1, "modifyWebsite": 1, "suspendWebsite": 1, "deleteWebsite": 1, ' \
'"createPackage": 1, "listPackages": 1, "deletePackage": 1, "modifyPackage": 1, "createDatabase": 1, "deleteDatabase": 1, ' \
'"listDatabases": 1, "createNameServer": 1, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"createEmail": 1, "listEmails": 1, "deleteEmail": 1, "emailForwarding": 1, "changeEmailPassword": 1, ' \
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
' "restoreBackup": 0, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
' "restoreBackup": 1, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
'"hostnameSSL": 0, "mailServerSSL": 0 }'
UserACL = '{"adminStatus":0, "versionManagement": 1, "createNewUser": 0, "listUsers": 0, "deleteUser": 0 , "resellerCenter": 0, ' \
'"changeUserACL": 0, "createWebsite": 0, "modifyWebsite": 0, "suspendWebsite": 0, "deleteWebsite": 0, ' \
'"createPackage": 0, "listPackages": 0, "deletePackage": 0, "modifyPackage": 0, "createDatabase": 1, "deleteDatabase": 1, ' \
'"listDatabases": 1, "createNameServer": 0, "createDNSZone": 1, "deleteZone": 1, "addDeleteRecords": 1, ' \
'"createEmail": 1, "listEmails": 1, "deleteEmail": 1, "emailForwarding": 1, "changeEmailPassword": 1, ' \
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
' "restoreBackup": 0, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
'"hostnameSSL": 0, "mailServerSSL": 0 }'
@staticmethod
def decideCentosVersion():
@@ -424,7 +424,8 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
count = 1
while (1):
command = 'wget https://github.com/the-djmaze/snappymail/releases/download/v%s/snappymail-%s.zip' % (Upgrade.SnappyVersion, Upgrade.SnappyVersion)
command = 'wget https://github.com/the-djmaze/snappymail/releases/download/v%s/snappymail-%s.zip' % (
Upgrade.SnappyVersion, Upgrade.SnappyVersion)
cmd = shlex.split(command)
res = subprocess.call(cmd)
if res != 0:
@@ -515,16 +516,16 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
command = f'/usr/local/lsws/lsphp74/bin/php /usr/local/CyberCP/snappymail_cyberpanel.php'
Upgrade.executioner(command, 'verify certificate', 0)
#labsPath = '/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/application.ini'
# labsPath = '/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/application.ini'
# labsData = """[labs]
# imap_folder_list_limit = 0
# autocreate_system_folders = On
# """
#
# writeToFile = open(labsPath, 'a')
# writeToFile.write(labsData)
# writeToFile.close()
# labsData = """[labs]
# imap_folder_list_limit = 0
# autocreate_system_folders = On
# """
#
# writeToFile = open(labsPath, 'a')
# writeToFile.write(labsData)
# writeToFile.close()
includeFileOldPath = '/usr/local/CyberCP/public/snappymail/_include.php'
includeFileNewPath = '/usr/local/CyberCP/public/snappymail/include.php'
@@ -541,9 +542,8 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
## Disable local cert verification
#command = "sed -i 's|verify_certificate = On|verify_certificate = Off|g' %s" % (labsPath)
#Upgrade.executioner(command, 'verify certificate', 0)
# command = "sed -i 's|verify_certificate = On|verify_certificate = Off|g' %s" % (labsPath)
# Upgrade.executioner(command, 'verify certificate', 0)
# labsData = open(labsPath, 'r').read()
# labsDataLines = open(labsPath, 'r').readlines()
@@ -577,64 +577,63 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
### now download and install actual plugin
# command = f'mkdir /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chmod 700 /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chown lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'wget -O /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect/index.php https://raw.githubusercontent.com/the-djmaze/snappymail/master/plugins/mailbox-detect/index.php'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chmod 644 /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect/index.php'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chown lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect/index.php'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# ### Enable plugins and enable mailbox creation plugin
#
# labsDataLines = open(labsPath, 'r').readlines()
# PluginsActivator = 0
# WriteToFile = open(labsPath, 'w')
#
#
# for lines in labsDataLines:
# if lines.find('[plugins]') > -1:
# PluginsActivator = 1
# WriteToFile.write(lines)
# elif PluginsActivator and lines.find('enable = ') > -1:
# WriteToFile.write(f'enable = On\n')
# elif PluginsActivator and lines.find('enabled_list = ') > -1:
# WriteToFile.write(f'enabled_list = "mailbox-detect"\n')
# elif PluginsActivator == 1 and lines.find('[defaults]') > -1:
# PluginsActivator = 0
# WriteToFile.write(lines)
# else:
# WriteToFile.write(lines)
# WriteToFile.close()
#
# ## enable auto create in the enabled plugin
# PluginsFilePath = '/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/plugin-mailbox-detect.json'
#
# WriteToFile = open(PluginsFilePath, 'w')
# WriteToFile.write("""{
# "plugin": {
# "autocreate_system_folders": true
# }
# }
# """)
# WriteToFile.close()
#
# command = f'chown lscpd:lscpd {PluginsFilePath}'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chmod 600 {PluginsFilePath}'
# Upgrade.executioner(command, 'verify certificate', 0)
# command = f'mkdir /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chmod 700 /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chown lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'wget -O /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect/index.php https://raw.githubusercontent.com/the-djmaze/snappymail/master/plugins/mailbox-detect/index.php'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chmod 644 /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect/index.php'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chown lscpd:lscpd /usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/plugins/mailbox-detect/index.php'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# ### Enable plugins and enable mailbox creation plugin
#
# labsDataLines = open(labsPath, 'r').readlines()
# PluginsActivator = 0
# WriteToFile = open(labsPath, 'w')
#
#
# for lines in labsDataLines:
# if lines.find('[plugins]') > -1:
# PluginsActivator = 1
# WriteToFile.write(lines)
# elif PluginsActivator and lines.find('enable = ') > -1:
# WriteToFile.write(f'enable = On\n')
# elif PluginsActivator and lines.find('enabled_list = ') > -1:
# WriteToFile.write(f'enabled_list = "mailbox-detect"\n')
# elif PluginsActivator == 1 and lines.find('[defaults]') > -1:
# PluginsActivator = 0
# WriteToFile.write(lines)
# else:
# WriteToFile.write(lines)
# WriteToFile.close()
#
# ## enable auto create in the enabled plugin
# PluginsFilePath = '/usr/local/lscp/cyberpanel/rainloop/data/_data_/_default_/configs/plugin-mailbox-detect.json'
#
# WriteToFile = open(PluginsFilePath, 'w')
# WriteToFile.write("""{
# "plugin": {
# "autocreate_system_folders": true
# }
# }
# """)
# WriteToFile.close()
#
# command = f'chown lscpd:lscpd {PluginsFilePath}'
# Upgrade.executioner(command, 'verify certificate', 0)
#
# command = f'chmod 600 {PluginsFilePath}'
# Upgrade.executioner(command, 'verify certificate', 0)
os.chdir(cwd)
@@ -757,7 +756,8 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
connection, cursor = Upgrade.setupConnection('cyberpanel')
try:
cursor.execute('CREATE TABLE `baseTemplate_cyberpanelcosmetic` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `MainDashboardCSS` longtext NOT NULL)')
cursor.execute(
'CREATE TABLE `baseTemplate_cyberpanelcosmetic` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `MainDashboardCSS` longtext NOT NULL)')
except:
pass
@@ -846,7 +846,8 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
sleep(10)
try:
cursor.execute("UPDATE loginSystem_acl SET config = '%s' where name = 'reseller'" % (Upgrade.ResellerACL))
cursor.execute(
"UPDATE loginSystem_acl SET config = '%s' where name = 'reseller'" % (Upgrade.ResellerACL))
except:
pass
@@ -992,47 +993,56 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
pass
try:
cursor.execute('CREATE TABLE `websiteFunctions_wpplugins` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `Name` varchar(255) NOT NULL, `config` longtext NOT NULL, `owner_id` integer NOT NULL)')
cursor.execute(
'CREATE TABLE `websiteFunctions_wpplugins` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `Name` varchar(255) NOT NULL, `config` longtext NOT NULL, `owner_id` integer NOT NULL)')
except:
pass
try:
cursor.execute('ALTER TABLE `websiteFunctions_wpplugins` ADD CONSTRAINT `websiteFunctions_wpp_owner_id_493a02c7_fk_loginSyst` FOREIGN KEY (`owner_id`) REFERENCES `loginSystem_administrator` (`id`)')
cursor.execute(
'ALTER TABLE `websiteFunctions_wpplugins` ADD CONSTRAINT `websiteFunctions_wpp_owner_id_493a02c7_fk_loginSyst` FOREIGN KEY (`owner_id`) REFERENCES `loginSystem_administrator` (`id`)')
except:
pass
try:
cursor.execute('CREATE TABLE `websiteFunctions_wpsites` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `title` varchar(255) NOT NULL, `path` varchar(255) NOT NULL, `FinalURL` varchar(255) NOT NULL, `AutoUpdates` varchar(100) NOT NULL, `PluginUpdates` varchar(15) NOT NULL, `ThemeUpdates` varchar(15) NOT NULL, `date` datetime(6) NOT NULL, `WPLockState` integer NOT NULL, `owner_id` integer NOT NULL)')
cursor.execute(
'CREATE TABLE `websiteFunctions_wpsites` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `title` varchar(255) NOT NULL, `path` varchar(255) NOT NULL, `FinalURL` varchar(255) NOT NULL, `AutoUpdates` varchar(100) NOT NULL, `PluginUpdates` varchar(15) NOT NULL, `ThemeUpdates` varchar(15) NOT NULL, `date` datetime(6) NOT NULL, `WPLockState` integer NOT NULL, `owner_id` integer NOT NULL)')
except:
pass
try:
cursor.execute('ALTER TABLE `websiteFunctions_wpsites` ADD CONSTRAINT `websiteFunctions_wps_owner_id_6d67df2a_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_websites` (`id`)')
cursor.execute(
'ALTER TABLE `websiteFunctions_wpsites` ADD CONSTRAINT `websiteFunctions_wps_owner_id_6d67df2a_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_websites` (`id`)')
except:
pass
try:
cursor.execute('CREATE TABLE `websiteFunctions_wpstaging` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `owner_id` integer NOT NULL, `wpsite_id` integer NOT NULL)')
cursor.execute(
'CREATE TABLE `websiteFunctions_wpstaging` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `owner_id` integer NOT NULL, `wpsite_id` integer NOT NULL)')
except:
pass
try:
cursor.execute('ALTER TABLE `websiteFunctions_wpstaging` ADD CONSTRAINT `websiteFunctions_wps_owner_id_543d8aec_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_wpsites` (`id`);')
cursor.execute(
'ALTER TABLE `websiteFunctions_wpstaging` ADD CONSTRAINT `websiteFunctions_wps_owner_id_543d8aec_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_wpsites` (`id`);')
except:
pass
try:
cursor.execute('ALTER TABLE `websiteFunctions_wpstaging` ADD CONSTRAINT `websiteFunctions_wps_wpsite_id_82843593_fk_websiteFu` FOREIGN KEY (`wpsite_id`) REFERENCES `websiteFunctions_wpsites` (`id`)')
cursor.execute(
'ALTER TABLE `websiteFunctions_wpstaging` ADD CONSTRAINT `websiteFunctions_wps_wpsite_id_82843593_fk_websiteFu` FOREIGN KEY (`wpsite_id`) REFERENCES `websiteFunctions_wpsites` (`id`)')
except:
pass
try:
cursor.execute("CREATE TABLE `websiteFunctions_wpsitesbackup` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `WPSiteID` integer NOT NULL, `WebsiteID` integer NOT NULL, `config` longtext NOT NULL, `owner_id` integer NOT NULL); ")
cursor.execute(
"CREATE TABLE `websiteFunctions_wpsitesbackup` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `WPSiteID` integer NOT NULL, `WebsiteID` integer NOT NULL, `config` longtext NOT NULL, `owner_id` integer NOT NULL); ")
except:
pass
try:
cursor.execute("ALTER TABLE `websiteFunctions_wpsitesbackup` ADD CONSTRAINT `websiteFunctions_wps_owner_id_8a8dd0c5_fk_loginSyst` FOREIGN KEY (`owner_id`) REFERENCES `loginSystem_administrator` (`id`); ")
cursor.execute(
"ALTER TABLE `websiteFunctions_wpsitesbackup` ADD CONSTRAINT `websiteFunctions_wps_owner_id_8a8dd0c5_fk_loginSyst` FOREIGN KEY (`owner_id`) REFERENCES `loginSystem_administrator` (`id`); ")
except:
pass
@@ -1079,21 +1089,58 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
except:
pass
query = """
CREATE TABLE `websiteFunctions_backupsv2` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `fileName` varchar(255) NOT NULL, `status` integer NOT NULL, `timeStamp` varchar(255) NOT NULL, `BasePath` longtext NOT NULL, `website_id` integer NOT NULL);
"""
try:
cursor.execute(query)
except:
pass
query = "ALTER TABLE `websiteFunctions_backupsv2` ADD CONSTRAINT `websiteFunctions_bac_website_id_3a777e68_fk_websiteFu` FOREIGN KEY (`website_id`) REFERENCES `websiteFunctions_websites` (`id`);"
try:
cursor.execute(query)
except:
pass
query = "ALTER TABLE `websiteFunctions_backupslogsv2` ADD CONSTRAINT `websiteFunctions_bac_owner_id_9e884ff9_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_backupsv2` (`id`);"
try:
cursor.execute(query)
except:
pass
query = "CREATE TABLE `websiteFunctions_backupslogsv2` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `timeStamp` varchar(255) NOT NULL, `message` longtext NOT NULL, `owner_id` integer NOT NULL);"
try:
cursor.execute(query)
except:
pass
query = "ALTER TABLE `websiteFunctions_backupslogsv2` ADD CONSTRAINT `websiteFunctions_bac_owner_id_9e884ff9_fk_websiteFu` FOREIGN KEY (`owner_id`) REFERENCES `websiteFunctions_backupsv2` (`id`);"
try:
cursor.execute(query)
except:
pass
try:
cursor.execute("ALTER TABLE websiteFunctions_websites ADD COLUMN BackupLock INT DEFAULT 0;")
except:
pass
### update ftp issue for ubuntu 22
if Upgrade.FindOperatingSytem() == Ubuntu22:
try:
cursor.execute(
'ALTER TABLE `users` CHANGE `Password` `Password` VARCHAR(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; ')
except:
pass
try:
cursor.execute('ALTER TABLE `users` CHANGE `Password` `Password` VARCHAR(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; ')
except:
pass
if Upgrade.FindOperatingSytem() == Ubuntu22:
command = "sed -i 's/MYSQLCrypt md5/MYSQLCrypt crypt/g' /etc/pure-ftpd/db/mysql.conf"
Upgrade.executioner(command, command, 1)
@@ -1794,10 +1841,8 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
except:
pass
query = 'ALTER TABLE IncBackups_backupjob ADD retention integer DEFAULT 0'
try:
cursor.execute(query)
except:
@@ -2116,8 +2161,6 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
if os.path.exists(lscpdPath):
os.remove(lscpdPath)
lscpdSelection = 'lscpd-0.3.1'
if os.path.exists(Upgrade.UbuntuPath):
result = open(Upgrade.UbuntuPath, 'r').read()
@@ -2463,9 +2506,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
#if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
#command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/'
#Upgrade.executioner(command, 'Set default PHP 7.0, 0')
# if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
# command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/'
# Upgrade.executioner(command, 'Set default PHP 7.0, 0')
@staticmethod
def someDirectories():
@@ -2582,7 +2625,6 @@ echo $oConfig->Save() ? 'Done' : 'Error';
# command = 'DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade -y'
# subprocess.call(command, shell=True)
dovecotConf = '/etc/dovecot/dovecot.conf'
dovecotContent = open(dovecotConf, 'r').read()
@@ -2636,7 +2678,7 @@ echo $oConfig->Save() ? 'Done' : 'Error';
command = 'apt-get install restic -y'
Upgrade.executioner(command, 'Install Restic')
command = 'restic self-update'
Upgrade.executioner(command, 'Install Restic')
@@ -2801,7 +2843,6 @@ vmail
writeToFile.close()
if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
command = 'chmod 600 %s' % (cronPath)
Upgrade.executioner(command, 0)
@@ -2819,14 +2860,22 @@ vmail
elif acl.config == '{}':
acl.config = '{"adminStatus":%s, "versionManagement": %s, "createNewUser": %s, "listUsers": %s, "deleteUser": %s, "resellerCenter": %s, "changeUserACL": %s, "createWebsite": %s, "modifyWebsite": %s, "suspendWebsite": %s, "deleteWebsite": %s, "createPackage": %s, "listPackages": %s, "deletePackage": %s, "modifyPackage": %s, "createDatabase": %s, "deleteDatabase": %s, "listDatabases": %s, "createNameServer": %s, "createDNSZone": %s, "deleteZone": %s, "addDeleteRecords": %s, "createEmail": %s, "listEmails": %s, "deleteEmail": %s, "emailForwarding": %s, "changeEmailPassword": %s, "dkimManager": %s, "createFTPAccount": %s, "deleteFTPAccount": %s, "listFTPAccounts": %s, "createBackup": %s, "restoreBackup": %s, "addDeleteDestinations": %s, "scheduleBackups": %s, "remoteBackups": %s, "googleDriveBackups": %s, "manageSSL": %s, "hostnameSSL": %s, "mailServerSSL": %s }' \
% (str(acl.adminStatus), str(acl.versionManagement), str(acl.createNewUser),
str(acl.listUsers), str(acl.deleteUser), str(acl.resellerCenter), str(acl.changeUserACL),
str(acl.createWebsite), str(acl.modifyWebsite), str(acl.suspendWebsite), str(acl.deleteWebsite),
str(acl.createPackage), str(acl.listPackages), str(acl.deletePackage), str(acl.modifyPackage),
str(acl.createDatabase), str(acl.deleteDatabase), str(acl.listDatabases), str(acl.createNameServer),
str(acl.createDNSZone), str(acl.deleteZone), str(acl.addDeleteRecords), str(acl.createEmail),
str(acl.listEmails), str(acl.deleteEmail), str(acl.emailForwarding), str(acl.changeEmailPassword),
str(acl.dkimManager), str(acl.createFTPAccount), str(acl.deleteFTPAccount), str(acl.listFTPAccounts),
str(acl.createBackup), str(acl.restoreBackup), str(acl.addDeleteDestinations), str(acl.scheduleBackups), str(acl.remoteBackups), '1',
str(acl.listUsers), str(acl.deleteUser), str(acl.resellerCenter),
str(acl.changeUserACL),
str(acl.createWebsite), str(acl.modifyWebsite), str(acl.suspendWebsite),
str(acl.deleteWebsite),
str(acl.createPackage), str(acl.listPackages), str(acl.deletePackage),
str(acl.modifyPackage),
str(acl.createDatabase), str(acl.deleteDatabase), str(acl.listDatabases),
str(acl.createNameServer),
str(acl.createDNSZone), str(acl.deleteZone), str(acl.addDeleteRecords),
str(acl.createEmail),
str(acl.listEmails), str(acl.deleteEmail), str(acl.emailForwarding),
str(acl.changeEmailPassword),
str(acl.dkimManager), str(acl.createFTPAccount), str(acl.deleteFTPAccount),
str(acl.listFTPAccounts),
str(acl.createBackup), str(acl.restoreBackup), str(acl.addDeleteDestinations),
str(acl.scheduleBackups), str(acl.remoteBackups), '1',
str(acl.manageSSL), str(acl.hostnameSSL), str(acl.mailServerSSL))
acl.save()
@@ -2936,7 +2985,6 @@ vmail
# if os.path.exists(postfixPath):
# Upgrade.upgradeDovecot()
## Upgrade version
Upgrade.fixPermissions()
@@ -2993,13 +3041,10 @@ vmail
# command = 'chmod +x /usr/local/CyberCP/public/imunifyav/bin/execute.py'
# Upgrade.executioner(command, command, 1)
Upgrade.stdOut("Upgrade Completed.")
def main():
def main():
parser = argparse.ArgumentParser(description='CyberPanel Installer')
parser.add_argument('branch', help='Install from branch name.')

View File

@@ -221,12 +221,12 @@ context /.well-known/acme-challenge {
ServerAdmin {administratorEmail}
SuexecUserGroup {externalApp} {externalApp}
DocumentRoot /home/{virtualHostName}/public_html/
<Proxy "unix:/var/run/php-fpm/{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
<Proxy "unix:{sockPath}{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
ProxySet disablereuse=off
</proxy>
<FilesMatch \.php$>
SetHandler proxy:fcgi://php-fpm-{externalApp}
</FilesMatch>
</FilesMatch>
#CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined
#AddHandler application/x-httpd-php{php} .php .php7 .phtml
@@ -246,7 +246,7 @@ context /.well-known/acme-challenge {
ServerAdmin {administratorEmail}
SuexecUserGroup {externalApp} {externalApp}
DocumentRoot /home/{virtualHostName}/public_html/
<Proxy "unix:/var/run/php-fpm/{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
<Proxy "unix:{sockPath}{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
ProxySet disablereuse=off
</proxy>
<FilesMatch \.php$>
@@ -264,8 +264,8 @@ context /.well-known/acme-challenge {
SSLEngine on
SSLVerifyClient none
SSLCertificateFile /etc/httpd/conf.d/ssl/{virtualHostName}.fullchain.pem
SSLCertificateKeyFile /etc/httpd/conf.d/ssl/{virtualHostName}.privkey.pem
SSLCertificateFile {SSLBase}{virtualHostName}.fullchain.pem
SSLCertificateKeyFile {SSLBase}{virtualHostName}.privkey.pem
</VirtualHost>
"""
@@ -276,12 +276,12 @@ context /.well-known/acme-challenge {
ServerAdmin {administratorEmail}
SuexecUserGroup {externalApp} {externalApp}
DocumentRoot {path}
<Proxy "unix:/var/run/php-fpm/{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
<Proxy "unix:{sockPath}{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
ProxySet disablereuse=off
</proxy>
<FilesMatch \.php$>
SetHandler proxy:fcgi://php-fpm-{externalApp}
</FilesMatch>
</FilesMatch>
#CustomLog /home/{virtualHostName}/logs/{virtualHostName}.access_log combined
#AddHandler application/x-httpd-php{php} .php .php7 .phtml
@@ -301,7 +301,7 @@ context /.well-known/acme-challenge {
ServerAdmin {administratorEmail}
SuexecUserGroup {externalApp} {externalApp}
DocumentRoot {path}
<Proxy "unix:/var/run/php-fpm/{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
<Proxy "unix:{sockPath}{virtualHostName}.sock|fcgi://php-fpm-{externalApp}">
ProxySet disablereuse=off
</proxy>
<FilesMatch \.php$>
@@ -318,8 +318,8 @@ context /.well-known/acme-challenge {
</Directory>
SSLEngine on
SSLVerifyClient none
SSLCertificateFile /etc/httpd/conf.d/ssl/{virtualHostName}.fullchain.pem
SSLCertificateKeyFile /etc/httpd/conf.d/ssl/{virtualHostName}.privkey.pem
SSLCertificateFile {SSLBase}{virtualHostName}.fullchain.pem
SSLCertificateKeyFile {SSLBase}{virtualHostName}.privkey.pem
</VirtualHost>
"""
@@ -383,7 +383,7 @@ REWRITERULE ^(.*)$ HTTP://proxyApacheBackendSSL/$1 [P,L]
"""
phpFpmPool = """[{www}]
listen = /var/run/php-fpm/{Sock}.sock
listen = {sockPath}{Sock}.sock
listen.owner = nobody
listen.group = nobody
listen.mode = 0660
@@ -396,7 +396,7 @@ pm.min_spare_servers = 1
pm.max_spare_servers = 1
"""
phpFpmPoolReplace = """[{www}]
listen = /var/run/php-fpm/{Sock}.sock
listen = {sockPath}{Sock}.sock
listen.owner = nobody
listen.group = nobody
listen.mode = 0660

View File

@@ -62,7 +62,7 @@ class virtualHostUtilities:
admin.userName, 0, "/home/cyberpanel/" + str(randint(1000, 9999)))
if result[0] == 0:
sslUtilities.issueSSLForDomain(virtualHostName, admin.email, childPath)
sslUtilities.issueSSLForDomain(childDomain, admin.email, childPath)
## update dovecot conf to enable auto-discover

View File

@@ -26,7 +26,7 @@ EXPIRE = 3
### Version
VERSION = '2.3'
BUILD = 3
BUILD = 4
def serverStatusHome(request):
proc = httpProc(request, 'serverStatus/index.html',

View File

@@ -2405,7 +2405,7 @@ app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
$scope.currentStatus = "Starting creation..";
var ssl, dkimCheck, openBasedir, mailDomain;
var ssl, dkimCheck, openBasedir, mailDomain, apacheBackend;
if ($scope.sslCheck === true) {
ssl = 1;
@@ -2413,6 +2413,12 @@ app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
ssl = 0
}
if ($scope.apacheBackend === true) {
apacheBackend = 1;
} else {
apacheBackend = 0
}
if ($scope.dkimCheck === true) {
dkimCheck = 1;
} else {
@@ -2461,9 +2467,11 @@ app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
websiteOwner: websiteOwner,
dkimCheck: dkimCheck,
openBasedir: openBasedir,
mailDomain: mailDomain
mailDomain: mailDomain,
apacheBackend: apacheBackend
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')

View File

@@ -254,6 +254,15 @@
</div>
</div>
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9">
<div class="checkbox">
<label>
<input ng-model="apacheBackend" type="checkbox" value="">
Apache as Backend
</label>
</div>
</div>
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9">
<div class="checkbox">
<label>

View File

@@ -53,16 +53,21 @@ class WebsiteManager:
self.childDomain = childDomain
def createWebsite(self, request=None, userID=None, data=None):
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
test_domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
data = {
"name": "all",
"IP": ACLManager.GetServerIP()
}
import requests
response = requests.post(url, data=json.dumps(test_domain_data))
test_domain_status = response.json()['status']
response = requests.post(url, data=json.dumps(data))
Status = response.json()['status']
test_domain_status = 0
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
test_domain_status = 1
currentACL = ACLManager.loadedACL(userID)
adminNames = ACLManager.loadAllUsers(userID)
@@ -114,14 +119,7 @@ class WebsiteManager:
##
test_domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
}
import requests
response = requests.post(url, data=json.dumps(test_domain_data))
test_domain_status = response.json()['status']
test_domain_status = 1
Data = {'packageList': packagesName, "owernList": adminNames, 'WPVersions': FinalVersions,
'Plugins': Plugins, 'Randam_String': rnpss.lower(), 'test_domain_data': test_domain_status}
@@ -184,17 +182,6 @@ class WebsiteManager:
response = requests.post(url, data=json.dumps(data))
Status = response.json()['status']
test_domain_url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
test_domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
}
import requests
response = requests.post(test_domain_url, data=json.dumps(test_domain_data))
test_domain_status = response.json()['status']
Data['test_domain_data'] = test_domain_status
rnpss = randomPassword.generate_pass(10)
@@ -202,6 +189,7 @@ class WebsiteManager:
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
Data['wpsite'] = WPobj
Data['test_domain_data'] = 1
try:
DeleteID = request.GET.get('DeleteID', None)
@@ -706,16 +694,20 @@ class WebsiteManager:
currentACL = ACLManager.loadedACL(userID)
websitesName = ACLManager.findAllSites(currentACL, userID)
test_domain_url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
test_domain_data = {
"name": "test-domain",
"IP": ACLManager.GetServerIP(),
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
data = {
"name": "all",
"IP": ACLManager.GetServerIP()
}
import requests
response = requests.post(test_domain_url, data=json.dumps(test_domain_data))
test_domain_status = response.json()['status']
response = requests.post(url, data=json.dumps(data))
Status = response.json()['status']
test_domain_status = 0
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
test_domain_status = 1
rnpss = randomPassword.generate_pass(10)
proc = httpProc(request, 'websiteFunctions/createDomain.html',
@@ -807,9 +799,9 @@ class WebsiteManager:
php = ACLManager.getPHPString(PHPVersion)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s 2>/dev/null' % (
Vhuser, FinalPHPPath, path)
version = ProcessUtilities.outputExecutioner(command)
version = ProcessUtilities.outputExecutioner(command, None, True)
version = html.escape(version)
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp plugin status litespeed-cache --skip-plugins --skip-themes --path=%s' % (
@@ -1004,8 +996,8 @@ class WebsiteManager:
php = PHPManager.getPHPString(wpsite.owner.phpSelection)
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path={wpsite.path}'
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, wpsite.owner.externalApp, None, None, 1)
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path={wpsite.path} 2>/dev/null'
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, wpsite.owner.externalApp, True, None, 1)
if stdoutput.find('Error:') == -1:
DataBaseName = stdoutput.rstrip("\n")
@@ -1015,8 +1007,8 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path={wpsite.path}'
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, wpsite.owner.externalApp, None, None, 1)
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_USER --skip-plugins --skip-themes --path={wpsite.path} 2>/dev/null'
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, wpsite.owner.externalApp, True, None, 1)
if stdoutput.find('Error:') == -1:
DataBaseUser = stdoutput.rstrip("\n")
@@ -1026,8 +1018,8 @@ class WebsiteManager:
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get table_prefix --skip-plugins --skip-themes --path={wpsite.path}'
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, wpsite.owner.externalApp, None, None, 1)
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get table_prefix --skip-plugins --skip-themes --path={wpsite.path} 2>/dev/null'
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, wpsite.owner.externalApp, True, None, 1)
if stdoutput.find('Error:') == -1:
tableprefix = stdoutput.rstrip("\n")
@@ -1418,6 +1410,7 @@ class WebsiteManager:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
allweb = Websites.objects.all()
childdomain = ChildDomains.objects.all()
@@ -1425,9 +1418,13 @@ class WebsiteManager:
for web in allweb:
webpath = "/home/%s/public_html/" % web.domain
command = "cat %swp-config.php" % webpath
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
result = ProcessUtilities.outputExecutioner(command, web.externalApp)
if result == 1:
if os.path.exists(ProcessUtilities.debugPath):
logging.CyberCPLogFileWriter.writeToFile(result)
if result.find('No such file or directory') == -1:
try:
WPSites.objects.get(path=webpath)
except:
@@ -1440,9 +1437,12 @@ class WebsiteManager:
childPath = chlid.path.rstrip('/')
command = "cat %s/wp-config.php" % childPath
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
result = ProcessUtilities.outputExecutioner(command, chlid.master.externalApp)
if result == 1:
if os.path.exists(ProcessUtilities.debugPath):
logging.CyberCPLogFileWriter.writeToFile(result)
if result.find('No such file or directory') == -1:
fChildPath = f'{childPath}/'
try:
WPSites.objects.get(path=fChildPath)
@@ -1488,9 +1488,9 @@ class WebsiteManager:
###fetch WP version
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s' % (
command = 'sudo -u %s %s -d error_reporting=0 /usr/bin/wp core version --skip-plugins --skip-themes --path=%s 2>/dev/null' % (
Vhuser, FinalPHPPath, path)
version = ProcessUtilities.outputExecutioner(command)
version = ProcessUtilities.outputExecutioner(command, None, True)
version = version.rstrip("\n")
###install wp core