mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-14 09:16:11 +01:00
Merge branch 'v2.3.2-dev' of https://github.com/usmannasir/cyberpanel into v2.3.2-dev
This commit is contained in:
@@ -401,6 +401,7 @@ EOF
|
|||||||
#enabled=1
|
#enabled=1
|
||||||
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
|
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
|
||||||
#EOF
|
#EOF
|
||||||
|
rm -f /etc/yum.repos.d/CentOS-PowerTools-CyberPanel.repo
|
||||||
|
|
||||||
if [[ "$Server_Country" = "CN" ]] ; then
|
if [[ "$Server_Country" = "CN" ]] ; then
|
||||||
dnf --nogpg install -y https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm
|
dnf --nogpg install -y https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm
|
||||||
|
|||||||
@@ -211,6 +211,9 @@ def FileManagerRoot(request):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
from plogical.processUtilities import ProcessUtilities
|
||||||
|
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||||
|
|
||||||
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
data = {
|
data = {
|
||||||
"name": "Filemanager",
|
"name": "Filemanager",
|
||||||
@@ -225,7 +228,8 @@ def FileManagerRoot(request):
|
|||||||
template = 'baseTemplate/FileManager.html'
|
template = 'baseTemplate/FileManager.html'
|
||||||
else:
|
else:
|
||||||
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
else:
|
||||||
|
template = 'baseTemplate/FileManager.html'
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
template = 'baseTemplate/FileManager.html'
|
template = 'baseTemplate/FileManager.html'
|
||||||
|
|
||||||
|
|||||||
@@ -383,6 +383,8 @@ class IncScheduler(multi.Thread):
|
|||||||
|
|
||||||
#logging.writeToFile('job completed')
|
#logging.writeToFile('job completed')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
data = {
|
data = {
|
||||||
"name": "backups-retention",
|
"name": "backups-retention",
|
||||||
@@ -393,7 +395,7 @@ class IncScheduler(multi.Thread):
|
|||||||
response = requests.post(url, data=json.dumps(data))
|
response = requests.post(url, data=json.dumps(data))
|
||||||
Status = response.json()['status']
|
Status = response.json()['status']
|
||||||
|
|
||||||
if (Status == 1):
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
try:
|
try:
|
||||||
|
|
||||||
page_token = None
|
page_token = None
|
||||||
@@ -457,7 +459,6 @@ class IncScheduler(multi.Thread):
|
|||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
print('An error occurred fetch child: %s' % msg)
|
print('An error occurred fetch child: %s' % msg)
|
||||||
logging.writeToFile('An error occurred fetch child: %s' % msg)
|
logging.writeToFile('An error occurred fetch child: %s' % msg)
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile('job not completed [ERROR:]..%s'%msg)
|
logging.writeToFile('job not completed [ERROR:]..%s'%msg)
|
||||||
|
|
||||||
|
|||||||
@@ -931,4 +931,30 @@ class ACLManager:
|
|||||||
|
|
||||||
return wpsites
|
return wpsites
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def GetServerIP():
|
||||||
|
ipFile = "/etc/cyberpanel/machineIP"
|
||||||
|
f = open(ipFile)
|
||||||
|
ipData = f.read()
|
||||||
|
return ipData.split('\n', 1)[0]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def CheckForPremFeature(feature):
|
||||||
|
try:
|
||||||
|
|
||||||
|
if ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
|
data = {
|
||||||
|
"name": feature,
|
||||||
|
"IP": ACLManager.GetServerIP()
|
||||||
|
}
|
||||||
|
|
||||||
|
import requests
|
||||||
|
response = requests.post(url, data=json.dumps(data))
|
||||||
|
return response.json()['status']
|
||||||
|
except:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2274,7 +2274,6 @@ $parameters = array(
|
|||||||
WPsitepath = wpsite.path
|
WPsitepath = wpsite.path
|
||||||
websitedomain = website.domain
|
websitedomain = website.domain
|
||||||
|
|
||||||
|
|
||||||
php = PHPManager.getPHPString(PhpVersion)
|
php = PHPManager.getPHPString(PhpVersion)
|
||||||
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||||
|
|
||||||
@@ -2283,7 +2282,6 @@ $parameters = array(
|
|||||||
logging.statusWriter(self.tempStatusPath, 'Getting database...,20')
|
logging.statusWriter(self.tempStatusPath, 'Getting database...,20')
|
||||||
|
|
||||||
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path={WPsitepath}'
|
command = f'{FinalPHPPath} -d error_reporting=0 /usr/bin/wp config get DB_NAME --skip-plugins --skip-themes --path={WPsitepath}'
|
||||||
|
|
||||||
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, VHuser, None, None, 1)
|
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, VHuser, None, None, 1)
|
||||||
|
|
||||||
if stdoutput.find('Error:') == -1:
|
if stdoutput.find('Error:') == -1:
|
||||||
@@ -2348,10 +2346,12 @@ $parameters = array(
|
|||||||
config['Webadmin_id'] = website.admin_id
|
config['Webadmin_id'] = website.admin_id
|
||||||
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||||
config['Backuptype'] = "Both Website and DataBase"
|
config['Backuptype'] = "Both Website and DataBase"
|
||||||
|
|
||||||
###############Create config.Json file
|
###############Create config.Json file
|
||||||
#command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
#command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
||||||
#ProcessUtilities.executioner(command)
|
#ProcessUtilities.executioner(command)
|
||||||
###### write into config
|
###### write into config
|
||||||
|
|
||||||
json_object = json.dumps(config, indent=4)
|
json_object = json.dumps(config, indent=4)
|
||||||
configPath = "/home/cyberpanel/" + str(randint(1000, 9999))
|
configPath = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||||
file = open(configPath, "w")
|
file = open(configPath, "w")
|
||||||
@@ -2361,13 +2361,16 @@ $parameters = array(
|
|||||||
os.chmod(configPath, 0o600)
|
os.chmod(configPath, 0o600)
|
||||||
|
|
||||||
command = f"cp -R {configPath} {self.tempPath}"
|
command = f"cp -R {configPath} {self.tempPath}"
|
||||||
if ProcessUtilities.executioner(command, VHuser) == 0:
|
retStatus, stdoutput = ProcessUtilities.outputExecutioner(command, VHuser, None, None, 1)
|
||||||
raise BaseException('Failed to copy config file to temp path.')
|
if retStatus == 0:
|
||||||
|
raise BaseException(stdoutput)
|
||||||
|
|
||||||
|
|
||||||
command = f"rm -r {configPath}"
|
command = f"rm -r {configPath}"
|
||||||
if ProcessUtilities.executioner(command) == 0:
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
raise BaseException('Failed to remove config.')
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
logging.statusWriter(self.tempStatusPath, 'Copying website data.....,50')
|
logging.statusWriter(self.tempStatusPath, 'Copying website data.....,50')
|
||||||
|
|
||||||
@@ -2393,7 +2396,6 @@ $parameters = array(
|
|||||||
logging.statusWriter(self.tempStatusPath, 'Copying database.....,70')
|
logging.statusWriter(self.tempStatusPath, 'Copying database.....,70')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### SQLDUMP database into new directory
|
##### SQLDUMP database into new directory
|
||||||
|
|
||||||
command = "mysqldump %s --result-file %s/%s.sql" % (DataBaseName, self.tempPath, DataBaseName)
|
command = "mysqldump %s --result-file %s/%s.sql" % (DataBaseName, self.tempPath, DataBaseName)
|
||||||
@@ -2409,8 +2411,6 @@ $parameters = array(
|
|||||||
######## Zip backup directory
|
######## Zip backup directory
|
||||||
logging.statusWriter(self.tempStatusPath, 'Compressing backup files.....,80')
|
logging.statusWriter(self.tempStatusPath, 'Compressing backup files.....,80')
|
||||||
|
|
||||||
websitepath = "/home/%s"%websitedomain
|
|
||||||
|
|
||||||
|
|
||||||
command = 'mkdir -p /home/backup/'
|
command = 'mkdir -p /home/backup/'
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
@@ -2424,8 +2424,8 @@ $parameters = array(
|
|||||||
if retStatus == 0:
|
if retStatus == 0:
|
||||||
raise BaseException(result)
|
raise BaseException(result)
|
||||||
|
|
||||||
if os.path.exists(ProcessUtilities.debugPath):
|
#if os.path.exists(ProcessUtilities.debugPath):
|
||||||
logging.writeToFile(result)
|
# logging.writeToFile(result)
|
||||||
|
|
||||||
|
|
||||||
backupobj = WPSitesBackup(owner=Adminobj, WPSiteID=wpsite.id, WebsiteID=website.id, config=json_object)
|
backupobj = WPSitesBackup(owner=Adminobj, WPSiteID=wpsite.id, WebsiteID=website.id, config=json_object)
|
||||||
@@ -2490,6 +2490,7 @@ $parameters = array(
|
|||||||
config['Webadmin_id'] = website.admin_id
|
config['Webadmin_id'] = website.admin_id
|
||||||
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
config['name'] = 'backup-' + websitedomain + "-" + time.strftime("%m.%d.%Y_%H-%M-%S")
|
||||||
config['Backuptype'] = "Website Backup"
|
config['Backuptype'] = "Website Backup"
|
||||||
|
|
||||||
###############Create config.Json file
|
###############Create config.Json file
|
||||||
# command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
# command = "sudo -u %s touch /home/cyberpanel/config.json" % (VHuser)
|
||||||
# ProcessUtilities.executioner(command)
|
# ProcessUtilities.executioner(command)
|
||||||
@@ -2504,13 +2505,16 @@ $parameters = array(
|
|||||||
os.chmod(configPath, 0o600)
|
os.chmod(configPath, 0o600)
|
||||||
|
|
||||||
command = f"cp -R {configPath} {self.tempPath}"
|
command = f"cp -R {configPath} {self.tempPath}"
|
||||||
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
if ProcessUtilities.executioner(command) == 0:
|
if result == 0:
|
||||||
raise BaseException('Failed to copy config file to temp path.')
|
raise BaseException(stdout)
|
||||||
|
|
||||||
command = f"rm -r {configPath}"
|
command = f"rm -r {configPath}"
|
||||||
if ProcessUtilities.executioner(command) == 0:
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
raise BaseException('Failed to remove config temp file.')
|
|
||||||
|
if result == 0:
|
||||||
|
raise BaseException(stdout)
|
||||||
|
|
||||||
logging.statusWriter(self.tempStatusPath, 'Copying website data.....,50')
|
logging.statusWriter(self.tempStatusPath, 'Copying website data.....,50')
|
||||||
|
|
||||||
@@ -2663,10 +2667,6 @@ $parameters = array(
|
|||||||
######## Zip backup directory
|
######## Zip backup directory
|
||||||
logging.statusWriter(self.tempStatusPath, 'Compressing backup files.....,80')
|
logging.statusWriter(self.tempStatusPath, 'Compressing backup files.....,80')
|
||||||
|
|
||||||
websitepath = "/home/%s" % websitedomain
|
|
||||||
|
|
||||||
FinalZipPath = '%s/%s.zip' % (websitepath, RandomPath)
|
|
||||||
|
|
||||||
command = 'mkdir -p /home/backup/'
|
command = 'mkdir -p /home/backup/'
|
||||||
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
result, stdout = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
@@ -2710,6 +2710,7 @@ $parameters = array(
|
|||||||
from managePHP.phpManager import PHPManager
|
from managePHP.phpManager import PHPManager
|
||||||
from websiteFunctions.website import WebsiteManager
|
from websiteFunctions.website import WebsiteManager
|
||||||
from packages.models import Package
|
from packages.models import Package
|
||||||
|
|
||||||
if os.path.exists(ProcessUtilities.debugPath):
|
if os.path.exists(ProcessUtilities.debugPath):
|
||||||
logging.writeToFile("Error Restore WP backup Now ....... start:%s"% self.extraArgs['Domain'])
|
logging.writeToFile("Error Restore WP backup Now ....... start:%s"% self.extraArgs['Domain'])
|
||||||
|
|
||||||
@@ -3991,7 +3992,6 @@ $parameters = array(
|
|||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logging.statusWriter(self.tempStatusPath, 'Completed.[200]')
|
logging.statusWriter(self.tempStatusPath, 'Completed.[200]')
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile("Error RestoreWPbackupNow ....... %s" % str(msg))
|
logging.writeToFile("Error RestoreWPbackupNow ....... %s" % str(msg))
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ pm.max_spare_servers = {pmMaxSpareServers}
|
|||||||
realm {{RealM_Name}} {
|
realm {{RealM_Name}} {
|
||||||
|
|
||||||
userDB {
|
userDB {
|
||||||
location $SERVER_ROOT/conf/vhosts/$VH_NAME/{{wpid}}
|
location {{PassFile}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1246,17 +1246,38 @@ class virtualHostUtilities:
|
|||||||
return DiskUsage, DiskUsagePercentage, bwInMB, bwUsage
|
return DiskUsage, DiskUsagePercentage, bwInMB, bwUsage
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def EnableDisablePP(vhostName, username=None, password=None, path=None, wpid=None):
|
def EnableDisablePP(vhostName, username=None, password=None, path=None, wpid=None, externalApp = None):
|
||||||
try:
|
try:
|
||||||
|
vhostPassDir = f'/home/{vhostName}'
|
||||||
|
|
||||||
|
uBuntuPath = '/etc/lsb-release'
|
||||||
|
|
||||||
|
if os.path.exists(uBuntuPath):
|
||||||
|
group = 'nogroup'
|
||||||
|
else:
|
||||||
|
group = 'nobody'
|
||||||
|
|
||||||
|
|
||||||
confPath = f'{virtualHostUtilities.vhostConfPath}/vhosts/{vhostName}/vhost.conf'
|
confPath = f'{virtualHostUtilities.vhostConfPath}/vhosts/{vhostName}/vhost.conf'
|
||||||
htpassword = f'{virtualHostUtilities.vhostConfPath}/vhosts/{vhostName}/{wpid}'
|
htpassword = f'{vhostPassDir}/{wpid}'
|
||||||
|
htpasstemp = f'/usr/local/CyberCP/{wpid}'
|
||||||
|
|
||||||
|
command = f'touch {htpasstemp}'
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
command = f'chown {externalApp}:{group} {htpasstemp}'
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
FindLine = f'PASSWORD PROTECTION CONF STARTS {path}'
|
FindLine = f'PASSWORD PROTECTION CONF STARTS {path}'
|
||||||
FindLineEnd = f'PASSWORD PROTECTION CONF ENDS {path}'
|
FindLineEnd = f'PASSWORD PROTECTION CONF ENDS {path}'
|
||||||
|
|
||||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||||
if os.path.exists(htpassword):
|
if os.path.exists(htpassword):
|
||||||
os.remove(htpassword)
|
|
||||||
|
command = f'rm -f {htpassword}'
|
||||||
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
|
#os.remove(htpassword)
|
||||||
removeCheck = 0
|
removeCheck = 0
|
||||||
|
|
||||||
data = open(confPath, 'r').readlines()
|
data = open(confPath, 'r').readlines()
|
||||||
@@ -1279,6 +1300,7 @@ class virtualHostUtilities:
|
|||||||
OLSPPConf = OLSPPConf.replace('{{RealM_Name}}', str(randint(1000, 9999)))
|
OLSPPConf = OLSPPConf.replace('{{RealM_Name}}', str(randint(1000, 9999)))
|
||||||
OLSPPConf = OLSPPConf.replace('{{path}}', path)
|
OLSPPConf = OLSPPConf.replace('{{path}}', path)
|
||||||
OLSPPConf = OLSPPConf.replace('{{wpid}}', wpid)
|
OLSPPConf = OLSPPConf.replace('{{wpid}}', wpid)
|
||||||
|
OLSPPConf = OLSPPConf.replace('{{PassFile}}', htpassword)
|
||||||
|
|
||||||
writeToFile.write(OLSPPConf)
|
writeToFile.write(OLSPPConf)
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
@@ -1288,26 +1310,30 @@ class virtualHostUtilities:
|
|||||||
password = password.encode()
|
password = password.encode()
|
||||||
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
|
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
|
||||||
UserPass = f'{username}:{hashed.decode()}:{username}'
|
UserPass = f'{username}:{hashed.decode()}:{username}'
|
||||||
writeToFile = open(htpassword, 'w')
|
|
||||||
|
writeToFile = open(htpasstemp, 'w')
|
||||||
writeToFile.write(UserPass)
|
writeToFile.write(UserPass)
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
os.chmod(htpassword, 0o644)
|
command = f'cp {htpasstemp} {htpassword}'
|
||||||
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
uBuntuPath = '/etc/lsb-release'
|
os.remove(htpasstemp)
|
||||||
|
|
||||||
if os.path.exists(uBuntuPath):
|
command = f'chmod 640 {htpassword}'
|
||||||
group = 'nogroup'
|
ProcessUtilities.executioner(command, externalApp, True)
|
||||||
else:
|
|
||||||
group = 'nobody'
|
|
||||||
|
|
||||||
command = f'chown lsadm:{group} {htpassword}'
|
command = f'sudo -u {externalApp} -g {group} chown {externalApp}:{group} {htpassword}'
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
else:
|
else:
|
||||||
RealmName = str(randint(1000, 9999))
|
RealmName = str(randint(1000, 9999))
|
||||||
htaccesspath = f'{path}/.htaccess'
|
htaccesspath = f'{path}/.htaccess'
|
||||||
if os.path.exists(htpassword):
|
if os.path.exists(htpassword):
|
||||||
os.remove(htpassword)
|
|
||||||
|
command = f'rm -f {htpassword}'
|
||||||
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
|
#os.remove(htpassword)
|
||||||
removeCheck = 0
|
removeCheck = 0
|
||||||
|
|
||||||
if os.path.exists(htaccesspath):
|
if os.path.exists(htaccesspath):
|
||||||
@@ -1340,20 +1366,22 @@ class virtualHostUtilities:
|
|||||||
password = password.encode()
|
password = password.encode()
|
||||||
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
|
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
|
||||||
UserPass = f'{username}:{hashed.decode()}:{username}'
|
UserPass = f'{username}:{hashed.decode()}:{username}'
|
||||||
writeToFile = open(htpassword, 'w')
|
|
||||||
|
|
||||||
|
writeToFile = open(htpasstemp, 'w')
|
||||||
writeToFile.write(UserPass)
|
writeToFile.write(UserPass)
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
os.chmod(htpassword, 0o644)
|
command = f'cp {htpasstemp} {htpassword}'
|
||||||
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
uBuntuPath = '/etc/lsb-release'
|
os.remove(htpasstemp)
|
||||||
|
|
||||||
if os.path.exists(uBuntuPath):
|
command = f'chmod 640 {htpassword}'
|
||||||
group = 'nogroup'
|
ProcessUtilities.executioner(command, externalApp, True)
|
||||||
else:
|
|
||||||
group = 'nobody'
|
|
||||||
|
|
||||||
command = f'chown lsadm:{group} {htpassword}'
|
|
||||||
|
command = f'sudo -u {externalApp} -g {group} chown {externalApp}:{group} {htpassword}'
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
installUtilities.installUtilities.reStartLiteSpeed()
|
installUtilities.installUtilities.reStartLiteSpeed()
|
||||||
@@ -1534,7 +1562,7 @@ def main():
|
|||||||
elif args.function == 'switchServer':
|
elif args.function == 'switchServer':
|
||||||
virtualHostUtilities.switchServer(args.virtualHostName, args.phpVersion, int(args.server), args.tempStatusPath)
|
virtualHostUtilities.switchServer(args.virtualHostName, args.phpVersion, int(args.server), args.tempStatusPath)
|
||||||
elif args.function == 'EnableDisablePP':
|
elif args.function == 'EnableDisablePP':
|
||||||
virtualHostUtilities.EnableDisablePP(args.virtualHostName, args.username, args.password, args.path, args.wpid)
|
virtualHostUtilities.EnableDisablePP(args.virtualHostName, args.username, args.password, args.path, args.wpid, args.virtualHostUser)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/local/CyberCP/bin/python
|
#!/usr/local/CyberCP/bin/python
|
||||||
import os,sys
|
import os,sys
|
||||||
|
import time
|
||||||
sys.path.append('/usr/local/CyberCP')
|
sys.path.append('/usr/local/CyberCP')
|
||||||
import django
|
import django
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
@@ -15,12 +16,21 @@ from plogical.virtualHostUtilities import virtualHostUtilities
|
|||||||
from plogical.sslUtilities import sslUtilities
|
from plogical.sslUtilities import sslUtilities
|
||||||
from plogical.vhost import vhost
|
from plogical.vhost import vhost
|
||||||
from shutil import ignore_patterns
|
from shutil import ignore_patterns
|
||||||
|
import threading as multi
|
||||||
|
|
||||||
|
|
||||||
class ServerStatusUtil:
|
class ServerStatusUtil(multi.Thread):
|
||||||
|
|
||||||
lswsInstallStatusPath = '/home/cyberpanel/switchLSWSStatus'
|
lswsInstallStatusPath = '/home/cyberpanel/switchLSWSStatus'
|
||||||
serverRootPath = '/usr/local/lsws/'
|
serverRootPath = '/usr/local/lsws/'
|
||||||
|
|
||||||
|
def __init__(self, key):
|
||||||
|
multi.Thread.__init__(self)
|
||||||
|
self.key = key
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.switchTOLSWS(self.key)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def executioner(command, statusFile):
|
def executioner(command, statusFile):
|
||||||
try:
|
try:
|
||||||
@@ -383,11 +393,12 @@ class ServerStatusUtil:
|
|||||||
def switchTOLSWSCLI(licenseKey):
|
def switchTOLSWSCLI(licenseKey):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
ServerStatusUtil.switchTOLSWS(licenseKey)
|
ssu = ServerStatusUtil(licenseKey)
|
||||||
|
ssu.start()
|
||||||
|
|
||||||
|
while(True):
|
||||||
command = 'sudo cat ' + ServerStatusUtil.lswsInstallStatusPath
|
command = 'sudo cat ' + ServerStatusUtil.lswsInstallStatusPath
|
||||||
output = ProcessUtilities.outputExecutioner(command)
|
output = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
if output.find('[404]') > -1:
|
if output.find('[404]') > -1:
|
||||||
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
|
command = "sudo rm -f " + ServerStatusUtil.lswsInstallStatusPath
|
||||||
ProcessUtilities.popenExecutioner(command)
|
ProcessUtilities.popenExecutioner(command)
|
||||||
@@ -402,7 +413,8 @@ class ServerStatusUtil:
|
|||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
data_ret = {'status': 1, 'abort': 0, 'requestStatus': output, 'installed': 0}
|
data_ret = {'status': 1, 'abort': 0, 'requestStatus': output, 'installed': 0}
|
||||||
print(output)
|
#print(output)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
</th>
|
</th>
|
||||||
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Website
|
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Website
|
||||||
</th>
|
</th>
|
||||||
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">BackUp Tpye
|
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Type
|
||||||
</th>
|
</th>
|
||||||
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Action
|
<th style="padding: 18px; color: white; width: 161px; font-size: 12px;">Action
|
||||||
</th>
|
</th>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from plogical.virtualHostUtilities import virtualHostUtilities
|
|||||||
import subprocess
|
import subprocess
|
||||||
import shlex
|
import shlex
|
||||||
from plogical.installUtilities import installUtilities
|
from plogical.installUtilities import installUtilities
|
||||||
from django.shortcuts import HttpResponse, render
|
from django.shortcuts import HttpResponse, render, redirect
|
||||||
from loginSystem.models import Administrator, ACL
|
from loginSystem.models import Administrator, ACL
|
||||||
from packages.models import Package
|
from packages.models import Package
|
||||||
from plogical.mailUtilities import mailUtilities
|
from plogical.mailUtilities import mailUtilities
|
||||||
@@ -60,6 +60,17 @@ class WebsiteManager:
|
|||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
def WPCreate(self, request=None, userID=None, data=None):
|
def WPCreate(self, request=None, userID=None, data=None):
|
||||||
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
|
data = {
|
||||||
|
"name": "wp-manager",
|
||||||
|
"IP": ACLManager.GetServerIP()
|
||||||
|
}
|
||||||
|
|
||||||
|
import requests
|
||||||
|
response = requests.post(url, data=json.dumps(data))
|
||||||
|
Status = response.json()['status']
|
||||||
|
|
||||||
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
adminNames = ACLManager.loadAllUsers(userID)
|
adminNames = ACLManager.loadAllUsers(userID)
|
||||||
packagesName = ACLManager.loadPackages(userID, currentACL)
|
packagesName = ACLManager.loadPackages(userID, currentACL)
|
||||||
@@ -85,6 +96,8 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/WPCreate.html',
|
proc = httpProc(request, 'websiteFunctions/WPCreate.html',
|
||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def ListWPSites(self, request=None, userID=None, DeleteID=None):
|
def ListWPSites(self, request=None, userID=None, DeleteID=None):
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
@@ -126,6 +139,17 @@ class WebsiteManager:
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
|
data = {
|
||||||
|
"name": "wp-manager",
|
||||||
|
"IP": ACLManager.GetServerIP()
|
||||||
|
}
|
||||||
|
|
||||||
|
import requests
|
||||||
|
response = requests.post(url, data=json.dumps(data))
|
||||||
|
Status = response.json()['status']
|
||||||
|
|
||||||
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
Data['wpsite'] = WPobj
|
Data['wpsite'] = WPobj
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -141,12 +165,15 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
|
proc = httpProc(request, 'websiteFunctions/WPsiteHome.html',
|
||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def RestoreHome(self, request=None, userID=None, BackupID=None ):
|
def RestoreHome(self, request=None, userID=None, BackupID=None ):
|
||||||
Data = {}
|
Data = {}
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if ACLManager.CheckForPremFeature('wp-manager'):
|
||||||
|
|
||||||
Data['backupobj'] = WPSitesBackup.objects.get(pk=BackupID)
|
Data['backupobj'] = WPSitesBackup.objects.get(pk=BackupID)
|
||||||
|
|
||||||
config = json.loads(Data['backupobj'].config)
|
config = json.loads(Data['backupobj'].config)
|
||||||
@@ -159,12 +186,26 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/WPRestoreHome.html',
|
proc = httpProc(request, 'websiteFunctions/WPRestoreHome.html',
|
||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def RestoreBackups(self, request=None, userID=None, DeleteID=None):
|
def RestoreBackups(self, request=None, userID=None, DeleteID=None):
|
||||||
Data = {}
|
Data = {}
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
|
data = {
|
||||||
|
"name": "wp-manager",
|
||||||
|
"IP": ACLManager.GetServerIP()
|
||||||
|
}
|
||||||
|
|
||||||
|
import requests
|
||||||
|
response = requests.post(url, data=json.dumps(data))
|
||||||
|
Status = response.json()['status']
|
||||||
|
|
||||||
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
|
|
||||||
backobj = WPSitesBackup.objects.filter(owner=admin).order_by('-id')
|
backobj = WPSitesBackup.objects.filter(owner=admin).order_by('-id')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -203,12 +244,11 @@ class WebsiteManager:
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
proc = httpProc(request, 'websiteFunctions/RestoreBackups.html',
|
proc = httpProc(request, 'websiteFunctions/RestoreBackups.html',
|
||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def AutoLogin(self, request=None, userID=None):
|
def AutoLogin(self, request=None, userID=None):
|
||||||
|
|
||||||
@@ -225,6 +265,18 @@ class WebsiteManager:
|
|||||||
#php = VirtualHost.getPHPString(self.data['PHPVersion'])
|
#php = VirtualHost.getPHPString(self.data['PHPVersion'])
|
||||||
#FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
#FinalPHPPath = '/usr/local/lsws/lsphp%s/bin/php' % (php)
|
||||||
|
|
||||||
|
url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission"
|
||||||
|
data = {
|
||||||
|
"name": "wp-manager",
|
||||||
|
"IP": ACLManager.GetServerIP()
|
||||||
|
}
|
||||||
|
|
||||||
|
import requests
|
||||||
|
response = requests.post(url, data=json.dumps(data))
|
||||||
|
Status = response.json()['status']
|
||||||
|
|
||||||
|
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||||
|
|
||||||
## Get title
|
## Get title
|
||||||
|
|
||||||
password = randomPassword.generate_pass(10)
|
password = randomPassword.generate_pass(10)
|
||||||
@@ -249,10 +301,12 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/AutoLogin.html',
|
proc = httpProc(request, 'websiteFunctions/AutoLogin.html',
|
||||||
data, 'createWebsite')
|
data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def ConfigurePlugins(self, request=None, userID=None, data=None):
|
def ConfigurePlugins(self, request=None, userID=None, data=None):
|
||||||
|
|
||||||
DataPass ={}
|
if ACLManager.CheckForPremFeature('wp-manager'):
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
userobj = Administrator.objects.get(pk=userID)
|
userobj = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
@@ -264,8 +318,11 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/WPConfigurePlugins.html',
|
proc = httpProc(request, 'websiteFunctions/WPConfigurePlugins.html',
|
||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
else:
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def Addnewplugin(self, request=None, userID=None, data=None):
|
def Addnewplugin(self, request=None, userID=None, data=None):
|
||||||
|
if ACLManager.CheckForPremFeature('wp-manager'):
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
adminNames = ACLManager.loadAllUsers(userID)
|
adminNames = ACLManager.loadAllUsers(userID)
|
||||||
packagesName = ACLManager.loadPackages(userID, currentACL)
|
packagesName = ACLManager.loadPackages(userID, currentACL)
|
||||||
@@ -275,9 +332,11 @@ class WebsiteManager:
|
|||||||
proc = httpProc(request, 'websiteFunctions/WPAddNewPlugin.html',
|
proc = httpProc(request, 'websiteFunctions/WPAddNewPlugin.html',
|
||||||
Data, 'createWebsite')
|
Data, 'createWebsite')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
return redirect("https://cyberpanel.net/cyberpanel-addons")
|
||||||
|
|
||||||
def SearchOnkeyupPlugin(self, userID=None, data=None):
|
def SearchOnkeyupPlugin(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
|
if ACLManager.CheckForPremFeature('wp-manager'):
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
pluginname = data['pluginname']
|
pluginname = data['pluginname']
|
||||||
@@ -295,6 +354,10 @@ class WebsiteManager:
|
|||||||
|
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
else:
|
||||||
|
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': 'Premium feature not available.'}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': str(msg)}
|
||||||
@@ -715,7 +778,6 @@ class WebsiteManager:
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def DeploytoProduction(self, userID=None, data=None):
|
def DeploytoProduction(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -762,7 +824,6 @@ class WebsiteManager:
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def WPCreateBackup(self, userID=None, data=None):
|
def WPCreateBackup(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -802,7 +863,6 @@ class WebsiteManager:
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
def RestoreWPbackupNow(self, userID=None, data=None):
|
def RestoreWPbackupNow(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@@ -812,6 +872,20 @@ class WebsiteManager:
|
|||||||
backupid = data['backupid']
|
backupid = data['backupid']
|
||||||
DesSiteID = data['DesSite']
|
DesSiteID = data['DesSite']
|
||||||
|
|
||||||
|
# bwp = WPSites.objects.get(pk=int(backupid))
|
||||||
|
# dwp = WPSites.objects.get(pk=int(DesSiteID))
|
||||||
|
#
|
||||||
|
# if ACLManager.checkOwnership(bwp.owner.domain, admin, currentACL) == 1:
|
||||||
|
# pass
|
||||||
|
# else:
|
||||||
|
# return ACLManager.loadError()
|
||||||
|
#
|
||||||
|
# if ACLManager.checkOwnership(dwp.owner.domain, admin, currentACL) == 1:
|
||||||
|
# pass
|
||||||
|
# else:
|
||||||
|
# return ACLManager.loadError()
|
||||||
|
|
||||||
|
|
||||||
Domain = data['Domain']
|
Domain = data['Domain']
|
||||||
|
|
||||||
|
|
||||||
@@ -1286,7 +1360,8 @@ class WebsiteManager:
|
|||||||
stdoutput = ProcessUtilities.outputExecutioner(command)
|
stdoutput = ProcessUtilities.outputExecutioner(command)
|
||||||
elif setting == 'PasswordProtection':
|
elif setting == 'PasswordProtection':
|
||||||
execPath = f"/usr/local/CyberCP/bin/python {virtualHostUtilities.cyberPanel}/plogical/virtualHostUtilities.py"
|
execPath = f"/usr/local/CyberCP/bin/python {virtualHostUtilities.cyberPanel}/plogical/virtualHostUtilities.py"
|
||||||
execPath = f"{execPath} EnableDisablePP --username '{PPUsername}' --password '{PPPassword}' --virtualHostName {Webobj.domain} --path {path} --wpid {str(wpsite.id)}"
|
execPath = f"{execPath} EnableDisablePP --username '{PPUsername}' --password '{PPPassword}' " \
|
||||||
|
f"--virtualHostName {Webobj.domain} --path {path} --wpid {str(wpsite.id)} --virtualHostUser {Webobj.externalApp}"
|
||||||
ProcessUtilities.executioner(execPath)
|
ProcessUtilities.executioner(execPath)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user