mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-03-14 00:00:16 +01:00
v1.9.3
Set Python 3 to a stable tier.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,5 @@
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
*.pyc
|
||||
.idea
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import os
|
||||
import subprocess
|
||||
import shlex
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from ApacheVhosts import ApacheVhost
|
||||
from ApachController.ApacheVhosts import ApacheVhost
|
||||
|
||||
|
||||
class ApacheController:
|
||||
@@ -81,7 +81,7 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
message = "%s. [%s]" % (str(msg), '[ApacheController.checkIfApacheInstalled]')
|
||||
logging.CyberCPLogFileWriter.writeToFile(message)
|
||||
|
||||
@@ -94,7 +94,7 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@@ -157,7 +157,7 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
|
||||
|
||||
return 1
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return str(msg)
|
||||
|
||||
@staticmethod
|
||||
@@ -302,5 +302,5 @@ LoadModule mpm_event_module modules/mod_mpm_event.so
|
||||
return [0,result]
|
||||
|
||||
return [1, 'None']
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return [0, str(msg)]
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
@@ -144,7 +144,7 @@ class ApacheVhost:
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
return [1, 'None']
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return [0, str(msg)]
|
||||
|
||||
@staticmethod
|
||||
@@ -172,7 +172,7 @@ class ApacheVhost:
|
||||
confFile.close()
|
||||
|
||||
return [1, 'None']
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return [0, str(msg)]
|
||||
|
||||
@staticmethod
|
||||
@@ -183,7 +183,7 @@ class ApacheVhost:
|
||||
confFile.write("REWRITERULE ^(.*)$ HTTP://apachebackend/$1 [P]")
|
||||
confFile.close()
|
||||
return [1, 'None']
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return [0, str(msg)]
|
||||
|
||||
@staticmethod
|
||||
@@ -256,7 +256,7 @@ class ApacheVhost:
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
return [1, 'None']
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return [0, str(msg)]
|
||||
|
||||
@staticmethod
|
||||
@@ -285,7 +285,7 @@ class ApacheVhost:
|
||||
command = "systemctl restart httpd"
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
|
||||
@staticmethod
|
||||
@@ -300,7 +300,7 @@ class ApacheVhost:
|
||||
confFile.write(currentConf)
|
||||
confFile.close()
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(
|
||||
str(msg) + " [IO Error with per host config file [ApacheVhosts.perHostVirtualConf]]")
|
||||
|
||||
@@ -383,6 +383,6 @@ class ApacheVhost:
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return 1
|
||||
@@ -14,7 +14,7 @@ class BackupUtil:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
@@ -25,9 +25,9 @@ class BackupUtil:
|
||||
try:
|
||||
smtpObj = smtplib.SMTP('127.0.0.1')
|
||||
smtpObj.sendmail(sender, receivers, message)
|
||||
print "Successfully sent email"
|
||||
except BaseException, msg:
|
||||
print "Error: unable to send email %s" % str(msg)
|
||||
print("Successfully sent email")
|
||||
except BaseException as msg:
|
||||
print("Error: unable to send email %s" % str(msg))
|
||||
|
||||
@staticmethod
|
||||
def SyncHome():
|
||||
|
||||
@@ -9,7 +9,7 @@ import json
|
||||
from django.shortcuts import HttpResponse
|
||||
from math import ceil
|
||||
from websiteFunctions.models import Websites
|
||||
from .models import CLPackages
|
||||
from CLManager.models import CLPackages
|
||||
|
||||
|
||||
class CLManagerMain(multi.Thread):
|
||||
@@ -28,7 +28,7 @@ class CLManagerMain(multi.Thread):
|
||||
elif self.function == 'enableOrDisable':
|
||||
self.enableOrDisable()
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + ' [ContainerManager.run]')
|
||||
|
||||
def renderC(self):
|
||||
@@ -41,24 +41,30 @@ class CLManagerMain(multi.Thread):
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
ipFile = "/etc/cyberpanel/machineIP"
|
||||
f = open(ipFile)
|
||||
ipData = f.read()
|
||||
ipAddress = ipData.split('\n', 1)[0]
|
||||
|
||||
data = {}
|
||||
data['CL'] = 0
|
||||
data['CAGEFS'] = 0
|
||||
data['activatedPath'] = 0
|
||||
data['ipAddress'] = ipAddress
|
||||
CLPath = '/etc/sysconfig/cloudlinux'
|
||||
CageFSPath = '/usr/sbin/cagefsctl'
|
||||
activatedPath = '/home/cyberpanel/cloudlinux'
|
||||
|
||||
if os.path.exists(CLPath):
|
||||
data['CL'] = 1
|
||||
|
||||
if os.path.exists(CageFSPath):
|
||||
data['CAGEFS'] = 1
|
||||
if os.path.exists(activatedPath):
|
||||
data['activatedPath'] = 1
|
||||
|
||||
if data['CL'] == 0:
|
||||
return render(self.request, 'CLManager/notAvailable.html', data)
|
||||
elif data['CAGEFS'] == 0:
|
||||
elif data['activatedPath'] == 0:
|
||||
return render(self.request, 'CLManager/notAvailable.html', data)
|
||||
else:
|
||||
return render(self.request, self.templateName, self.data)
|
||||
return render(self.request, 'CLManager/cloudLinux.html', data)
|
||||
|
||||
def submitCageFSInstall(self):
|
||||
try:
|
||||
@@ -73,11 +79,11 @@ class CLManagerMain(multi.Thread):
|
||||
1)
|
||||
return 0
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/CLManager/CageFS.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/CLManager/CageFS.py"
|
||||
execPath = execPath + " --function submitCageFSInstall"
|
||||
ProcessUtilities.outputExecutioner(execPath)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
|
||||
|
||||
def findWebsitesJson(self, currentACL, userID, pageNumber):
|
||||
@@ -144,7 +150,7 @@ class CLManagerMain(multi.Thread):
|
||||
'pagination': pagination, 'default': default}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
dic = {'status': 1, 'listWebSiteStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(dic)
|
||||
return HttpResponse(json_data)
|
||||
@@ -160,7 +166,7 @@ class CLManagerMain(multi.Thread):
|
||||
for items in websites:
|
||||
command = '/usr/sbin/cagefsctl --disable %s' % (items.externalApp)
|
||||
ProcessUtilities.executioner(command)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
|
||||
def fetchPackages(self, currentACL):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
@@ -20,7 +20,7 @@ class CLinuxPackages:
|
||||
try:
|
||||
clPackage = CLPackages.objects.get(owner=itemPackage)
|
||||
statement = '%s %s' % (pwd.getpwnam(items.externalApp).pw_uid, clPackage.name)
|
||||
print statement
|
||||
print(statement)
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -28,7 +28,7 @@ class CLinuxPackages:
|
||||
@staticmethod
|
||||
def listPackages():
|
||||
for items in CLPackages.objects.all():
|
||||
print items.name
|
||||
print(items.name)
|
||||
|
||||
@staticmethod
|
||||
def userIDPackage(user):
|
||||
@@ -36,7 +36,7 @@ class CLinuxPackages:
|
||||
itemPackage = website.package
|
||||
try:
|
||||
clPackage = CLPackages.objects.get(owner=itemPackage)
|
||||
print clPackage
|
||||
print(clPackage)
|
||||
except:
|
||||
pass
|
||||
|
||||
@@ -48,7 +48,7 @@ class CLinuxPackages:
|
||||
try:
|
||||
clPackage = CLPackages.objects.get(owner=itemPackage)
|
||||
if clPackage.name == package:
|
||||
print pwd.getpwnam(items.externalApp).pw_uid
|
||||
print(pwd.getpwnam(items.externalApp).pw_uid)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import sys
|
||||
import os
|
||||
import django
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
|
||||
django.setup()
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
import argparse
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from plogical.firewallUtilities import FirewallUtilities
|
||||
from firewall.models import FirewallRules
|
||||
from serverStatus.serverStatusUtil import ServerStatusUtil
|
||||
|
||||
|
||||
@@ -11,6 +20,39 @@ class CageFS:
|
||||
packages = ['talksho']
|
||||
users = ['5001']
|
||||
|
||||
@staticmethod
|
||||
def EnableCloudLinux():
|
||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||
confPath = '/usr/local/lsws/conf/httpd_config.conf'
|
||||
data = open(confPath, 'r').readlines()
|
||||
|
||||
writeToFile = open(confPath, 'w')
|
||||
|
||||
for items in data:
|
||||
if items.find('priority') > -1:
|
||||
writeToFile.writelines(items)
|
||||
writeToFile.writelines('enableLVE 2\n')
|
||||
else:
|
||||
writeToFile.writelines(items)
|
||||
|
||||
writeToFile.close()
|
||||
else:
|
||||
confPath = '/usr/local/lsws/conf/httpd_config.xml'
|
||||
data = open(confPath, 'r').readlines()
|
||||
|
||||
writeToFile = open(confPath, 'w')
|
||||
|
||||
for items in data:
|
||||
if items.find('<enableChroot>') > -1:
|
||||
writeToFile.writelines(items)
|
||||
writeToFile.writelines(' <enableLVE>2</enableLVE>\n')
|
||||
else:
|
||||
writeToFile.writelines(items)
|
||||
|
||||
writeToFile.close()
|
||||
|
||||
ProcessUtilities.restartLitespeed()
|
||||
|
||||
@staticmethod
|
||||
def submitCageFSInstall():
|
||||
try:
|
||||
@@ -20,24 +62,57 @@ class CageFS:
|
||||
statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w')
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Starting Packages Installation..\n", 1)
|
||||
"Checking if LVE Kernel is loaded ..\n", 1)
|
||||
|
||||
command = 'sudo yum install cagefs -y'
|
||||
if ProcessUtilities.outputExecutioner('uname -a').find('lve') == -1:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"CloudLinux is installed but kernel is not loaded, please reboot your server to load appropriate kernel. [404]\n", 1)
|
||||
return 0
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"CloudLinux Kernel detected..\n", 1)
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Enabling CloudLinux in web server ..\n", 1)
|
||||
|
||||
CageFS.EnableCloudLinux()
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"CloudLinux enabled in server ..\n", 1)
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Adding LVEManager port ..\n", 1)
|
||||
try:
|
||||
FirewallUtilities.addRule('tcp', '9000', '0.0.0.0/0')
|
||||
|
||||
newFWRule = FirewallRules(name='lvemanager', proto='tcp', port='9000', ipAddress='0.0.0.0/0')
|
||||
newFWRule.save()
|
||||
except:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"LVEManager port added ..\n", 1)
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Reinstalling important components ..\n", 1)
|
||||
|
||||
command = 'yum install -y lvemanager'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
command = 'sudo /usr/sbin/cagefsctl --init'
|
||||
command = 'yum reinstall -y lvemanager lve-utils cagefs alt-python27-cllib'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
command = 'sudo /usr/sbin/cagefsctl --update-etc'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Important components reinstalled..\n", 1)
|
||||
|
||||
command = 'sudo /usr/sbin/cagefsctl --force-update'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
activatedPath = '/home/cyberpanel/cloudlinux'
|
||||
|
||||
writeToFile = open(activatedPath, 'a')
|
||||
writeToFile.write('CLInstalled')
|
||||
writeToFile.close()
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Packages successfully installed.[200]\n", 1)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
|
||||
|
||||
def main():
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
from packages.models import Package
|
||||
@@ -7,7 +7,7 @@ from packages.models import Package
|
||||
# Create your models here.
|
||||
|
||||
class CLPackages(models.Model):
|
||||
owner = models.ForeignKey(Package)
|
||||
owner = models.ForeignKey(Package, on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=50,unique=True)
|
||||
speed = models.CharField(max_length=50)
|
||||
vmem = models.CharField(max_length=50)
|
||||
|
||||
@@ -50,7 +50,7 @@ app.controller('installCageFS', function ($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
function getRequestStatus() {
|
||||
$scope.cyberPanelLoading = false;
|
||||
$scope.installDockerStatus = false;
|
||||
|
||||
url = "/serverstatus/switchTOLSWSStatus";
|
||||
|
||||
@@ -72,7 +72,7 @@ app.controller('installCageFS', function ($scope, $http, $timeout, $window) {
|
||||
$timeout(getRequestStatus, 1000);
|
||||
} else {
|
||||
// Notifications
|
||||
$scope.cyberPanelLoading = true;
|
||||
$scope.installDockerStatus = true;
|
||||
$timeout.cancel();
|
||||
$scope.requestData = response.data.requestStatus;
|
||||
if (response.data.installed === 1) {
|
||||
@@ -85,7 +85,7 @@ app.controller('installCageFS', function ($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.cyberPanelLoading = true;
|
||||
$scope.installDockerStatus = true;
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: 'Could not connect to server, please refresh this page',
|
||||
|
||||
37
CLManager/templates/CLManager/cloudLinux.html
Executable file
37
CLManager/templates/CLManager/cloudLinux.html
Executable file
@@ -0,0 +1,37 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "CloudLinux - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "CloudLinux" %}</h2>
|
||||
<p>{% trans "Access LVEManager" %}</p>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
{% trans "CloudLinux" %}
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<p>{% trans "CloudLinux is now integrated via their new API. You can manage CageFS and Package limits directly from LVEManager by clicking below. You can use your server root credentials to access LVEManager." %}</p>
|
||||
<br>
|
||||
<a target="_blank" href="http://{{ ipAddress }}:9000">
|
||||
<button class="btn btn-primary">Access Now
|
||||
</button>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="alert alert-danger">
|
||||
<p>{% trans "CageFS is only available with CloudLinux OS. " %} <a target="_blank"
|
||||
<p>{% trans "CloudLinux is not installed on your server." %} <a target="_blank"
|
||||
href="https://go.cyberpanel.net/CLConvert">Click
|
||||
Here</a> {% trans " for conversion details." %}</p>
|
||||
</div>
|
||||
@@ -31,12 +31,12 @@
|
||||
<div ng-controller="installCageFS" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
{% trans "Install Packages" %} <img ng-hide="installDockerStatus"
|
||||
{% trans "Activate Now" %} <img ng-hide="installDockerStatus"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<p>{% trans "CageFS is not installed on this server. Please proceed to installation." %}</p>
|
||||
<p>{% trans "CloudLinux is installed, but not activated." %}</p>
|
||||
<!------ LSWS Switch box ----------------->
|
||||
|
||||
<div style="margin-top: 2%" ng-hide="installBoxGen" class="col-md-12">
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
<!----- LSWS Switch box ----------------->
|
||||
<br>
|
||||
<button ng-hide="dockerInstallBTN" class="btn btn-primary" ng-click="submitCageFSInstall()">Install Now</button>
|
||||
<button ng-hide="dockerInstallBTN" class="btn btn-primary" ng-click="submitCageFSInstall()">Activate Now</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^CageFS$', views.CageFS, name='CageFS'),
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.shortcuts import redirect, HttpResponse
|
||||
from loginSystem.views import loadLoginPage
|
||||
from plogical.acl import ACLManager
|
||||
from CLManagerMain import CLManagerMain
|
||||
from .CLManagerMain import CLManagerMain
|
||||
import json
|
||||
from websiteFunctions.models import Websites
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
@@ -43,7 +42,7 @@ def submitCageFSInstall(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -104,7 +103,7 @@ def enableOrDisable(request):
|
||||
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -169,7 +168,7 @@ def submitCreatePackage(request):
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -213,7 +212,7 @@ def deleteCLPackage(request):
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -266,7 +265,7 @@ def saveSettings(request):
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -352,7 +351,7 @@ def getUsageData(request):
|
||||
final_json = json.dumps(finalData)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg), 'cpu': 0, 'memory':0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
17
CLScript/CLMain.py
Normal file
17
CLScript/CLMain.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import json
|
||||
|
||||
class CLMain():
|
||||
def __init__(self):
|
||||
self.path = '/usr/local/CyberCP/version.txt'
|
||||
#versionInfo = json.loads(open(self.path, 'r').read())
|
||||
self.version = '1.9'
|
||||
self.build = '3'
|
||||
|
||||
ipFile = "/etc/cyberpanel/machineIP"
|
||||
f = open(ipFile)
|
||||
ipData = f.read()
|
||||
self.ipAddress = ipData.split('\n', 1)[0]
|
||||
|
||||
self.initialMeta = {
|
||||
"result": "ok"
|
||||
}
|
||||
70
CLScript/CloudLinuxAdmins.py
Executable file
70
CLScript/CloudLinuxAdmins.py
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import sys
|
||||
import os.path
|
||||
import django
|
||||
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
try:
|
||||
django.setup()
|
||||
except:
|
||||
pass
|
||||
from loginSystem.models import Administrator, ACL
|
||||
import argparse
|
||||
import json
|
||||
from CLScript.CLMain import CLMain
|
||||
|
||||
|
||||
class CloudLinuxAdmins(CLMain):
|
||||
|
||||
def __init__(self, name, isMain):
|
||||
CLMain.__init__(self)
|
||||
self.name = name
|
||||
if isMain == 'true':
|
||||
self.isMain = 1
|
||||
else:
|
||||
self.isMain = 0
|
||||
|
||||
def listAll(self):
|
||||
users = []
|
||||
acl = ACL.objects.get(name='admin')
|
||||
for items in Administrator.objects.filter(acl=acl):
|
||||
|
||||
if items.userName == 'admin':
|
||||
isMain = True
|
||||
else:
|
||||
isMain = False
|
||||
|
||||
if self.isMain:
|
||||
if isMain == False:
|
||||
continue
|
||||
|
||||
if self.name != None:
|
||||
if self.name != items.userName:
|
||||
continue
|
||||
|
||||
user = {'name': items.userName,
|
||||
"locale_code": "EN_us",
|
||||
"unix_user": None,
|
||||
"email": items.email,
|
||||
"is_main": isMain
|
||||
}
|
||||
|
||||
users.append(user)
|
||||
|
||||
final = {'data': users, 'metadata': self.initialMeta}
|
||||
print(json.dumps(final))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='CyberPanel CloudLinux Manager')
|
||||
parser.add_argument('-n','--name', help='Owner')
|
||||
parser.add_argument('-m', '--is-main', help='Owner')
|
||||
|
||||
args = vars(parser.parse_args())
|
||||
|
||||
pi = CloudLinuxAdmins(args['name'], args['is_main'])
|
||||
try:
|
||||
pi.listAll()
|
||||
except:
|
||||
pi.listAll()
|
||||
25
CLScript/CloudLinuxDB.py
Executable file
25
CLScript/CloudLinuxDB.py
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import json
|
||||
from CLScript.CLMain import CLMain
|
||||
|
||||
|
||||
class PanelInfo(CLMain):
|
||||
def __init__(self):
|
||||
CLMain.__init__(self)
|
||||
|
||||
def emit(self):
|
||||
|
||||
initial = {
|
||||
"mysql": None
|
||||
}
|
||||
|
||||
final = {'data': initial, 'metadata': self.initialMeta}
|
||||
|
||||
print(json.dumps(final))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pi = PanelInfo()
|
||||
pi.emit()
|
||||
61
CLScript/CloudLinuxDomains.py
Executable file
61
CLScript/CloudLinuxDomains.py
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import sys
|
||||
import os.path
|
||||
import django
|
||||
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
try:
|
||||
django.setup()
|
||||
except:
|
||||
pass
|
||||
from websiteFunctions.models import Websites
|
||||
import argparse
|
||||
import json
|
||||
from CLScript.CLMain import CLMain
|
||||
|
||||
|
||||
class CloudLinuxDomains(CLMain):
|
||||
|
||||
def __init__(self, name, owner):
|
||||
CLMain.__init__(self)
|
||||
self.owner = owner
|
||||
self.name = name
|
||||
|
||||
def listAll(self):
|
||||
data = {}
|
||||
|
||||
if self.owner !=None:
|
||||
websites = Websites.objects.filter(externalApp=self.owner)
|
||||
else:
|
||||
websites = Websites.objects.all()
|
||||
|
||||
|
||||
for webs in websites:
|
||||
if self.name != None:
|
||||
if self.name != webs.domain:
|
||||
continue
|
||||
data[webs.domain] = {"owner": webs.externalApp,
|
||||
"document_root": "/home/%s/public_html/" % (webs.domain),
|
||||
"is_main": True}
|
||||
for webs in webs.childdomains_set.all():
|
||||
data[webs.domain] = {"owner": webs.master.externalApp,
|
||||
"document_root": webs.path,
|
||||
"is_main": False}
|
||||
|
||||
final = {'data': data, 'metadata': self.initialMeta}
|
||||
print(json.dumps(final))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='CyberPanel CloudLinux Manager')
|
||||
parser.add_argument('-o', '--owner', help='Owner')
|
||||
parser.add_argument('-n', '--name', help='Owner')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
pi = CloudLinuxDomains(args.owner, args.name)
|
||||
try:
|
||||
pi.listAll()
|
||||
except:
|
||||
pi.listAll()
|
||||
53
CLScript/CloudLinuxPackages.py
Executable file
53
CLScript/CloudLinuxPackages.py
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import sys
|
||||
import os.path
|
||||
import django
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
try:
|
||||
django.setup()
|
||||
except:
|
||||
pass
|
||||
from packages.models import Package
|
||||
import argparse
|
||||
import json
|
||||
from CLScript.CLMain import CLMain
|
||||
from loginSystem.models import Administrator
|
||||
|
||||
|
||||
class CloudLinuxPackages(CLMain):
|
||||
def __init__(self):
|
||||
CLMain.__init__(self)
|
||||
|
||||
def listAll(self, owner=None):
|
||||
packages = []
|
||||
|
||||
if owner == None:
|
||||
for items in Package.objects.all():
|
||||
try:
|
||||
packages.append({'name': items.packageName, 'owner': items.admin.userName})
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
admin = Administrator.objects.get(userName=owner)
|
||||
for items in Package.objects.filter(admin=admin):
|
||||
try:
|
||||
packages.append({'name': items.packageName, 'owner': items.admin.userName})
|
||||
except:
|
||||
pass
|
||||
|
||||
final = {'data': packages, 'metadata': self.initialMeta}
|
||||
print(json.dumps(final))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='CyberPanel CloudLinux Manager')
|
||||
parser.add_argument('-o', '--owner', help='Owner')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
pi = CloudLinuxPackages()
|
||||
try:
|
||||
pi.listAll(args.owner)
|
||||
except:
|
||||
pi.listAll()
|
||||
56
CLScript/CloudLinuxResellers.py
Executable file
56
CLScript/CloudLinuxResellers.py
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import sys
|
||||
import os.path
|
||||
import django
|
||||
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
try:
|
||||
django.setup()
|
||||
except:
|
||||
pass
|
||||
from loginSystem.models import Administrator, ACL
|
||||
import argparse
|
||||
import json
|
||||
from CLScript.CLMain import CLMain
|
||||
|
||||
|
||||
class CloudLinuxResellers(CLMain):
|
||||
|
||||
def __init__(self, id, name):
|
||||
CLMain.__init__(self)
|
||||
self.id = id
|
||||
self.name = name
|
||||
|
||||
def listAll(self, owner=None):
|
||||
users = []
|
||||
acl = ACL.objects.get(name='reseller')
|
||||
for items in Administrator.objects.filter(acl=acl):
|
||||
if self.name != None:
|
||||
if self.name != items.userName:
|
||||
continue
|
||||
|
||||
user = {'name': items.userName,
|
||||
"locale_code": "EN_us",
|
||||
"email": items.email,
|
||||
"id": None
|
||||
}
|
||||
|
||||
users.append(user)
|
||||
|
||||
final = {'data': users, 'metadata': self.initialMeta}
|
||||
print(json.dumps(final))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='CyberPanel CloudLinux Manager')
|
||||
parser.add_argument('--id', help='Owner')
|
||||
parser.add_argument('-n', '--name', help='Owner')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
pi = CloudLinuxResellers(args.id, args.name)
|
||||
try:
|
||||
pi.listAll()
|
||||
except:
|
||||
pi.listAll()
|
||||
@@ -10,7 +10,6 @@ try:
|
||||
except:
|
||||
pass
|
||||
from websiteFunctions.models import Websites
|
||||
from CLManager.CLPackages import CLPackages
|
||||
import argparse
|
||||
import pwd
|
||||
import json
|
||||
@@ -19,40 +18,141 @@ from CLScript.CLMain import CLMain
|
||||
|
||||
class CloudLinuxUsers(CLMain):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, owner, username, packageName, packageOwner, fields, uid):
|
||||
|
||||
CLMain.__init__(self)
|
||||
self.owner = owner
|
||||
self.username = username
|
||||
self.packageName = packageName
|
||||
self.packageOwner = packageOwner
|
||||
self.fields = fields
|
||||
if uid!=None:
|
||||
self.uid = int(uid)
|
||||
else:
|
||||
self.uid = uid
|
||||
|
||||
def listAll(self, owner=None):
|
||||
if self.fields == None:
|
||||
self.id = 1
|
||||
self.un = 1
|
||||
self.ow = 1
|
||||
self.domain = 1
|
||||
self.package = 1
|
||||
self.email = 1
|
||||
self.localecode = 1
|
||||
else:
|
||||
if self.fields.find('id') > -1:
|
||||
self.id = 1
|
||||
else:
|
||||
self.id = 0
|
||||
if self.fields.find('username') > -1:
|
||||
self.un = 1
|
||||
else:
|
||||
self.un = 0
|
||||
|
||||
if self.fields.find('owner') > -1:
|
||||
self.ow = 1
|
||||
else:
|
||||
self.ow = 0
|
||||
|
||||
if self.fields.find('domain') > -1:
|
||||
self.domain = 1
|
||||
else:
|
||||
self.domain = 0
|
||||
|
||||
if self.fields.find('package') > -1:
|
||||
self.package = 1
|
||||
else:
|
||||
self.package = 0
|
||||
|
||||
if self.fields.find('email') > -1:
|
||||
self.email = 1
|
||||
else:
|
||||
self.email = 0
|
||||
|
||||
if self.fields.find('locale_code') > -1:
|
||||
self.localecode = 1
|
||||
else:
|
||||
self.localecode = 0
|
||||
|
||||
|
||||
|
||||
def fetchJson(self, websites):
|
||||
users = []
|
||||
|
||||
for webs in Websites.objects.all():
|
||||
for webs in websites:
|
||||
itemPackage = webs.package
|
||||
clPackage = CLPackages.objects.get(owner=itemPackage)
|
||||
package = {'name': clPackage.name, 'owner': webs.externalApp}
|
||||
package = {'name': itemPackage.packageName, 'owner': webs.externalApp}
|
||||
|
||||
user = {'id': pwd.getpwnam(webs.externalApp).pw_uid,
|
||||
'username': webs.externalApp,
|
||||
'owner': webs.externalApp,
|
||||
'domain': webs.domain,
|
||||
'package': package,
|
||||
'email': webs.adminEmail,
|
||||
"locale_code": "EN_us"
|
||||
}
|
||||
user = {}
|
||||
|
||||
users.append(user)
|
||||
if self.id:
|
||||
user['id'] = pwd.getpwnam(webs.externalApp).pw_uid
|
||||
|
||||
if self.un:
|
||||
user['username'] = webs.externalApp
|
||||
|
||||
if self.ow:
|
||||
user['owner'] = webs.externalApp
|
||||
|
||||
if self.domain:
|
||||
user['domain'] = webs.domain
|
||||
|
||||
if self.package:
|
||||
user['package'] = package
|
||||
|
||||
if self.email:
|
||||
user['email'] = webs.adminEmail
|
||||
|
||||
if self.localecode:
|
||||
user['locale_code'] = "EN_us"
|
||||
|
||||
|
||||
if self.packageName != None:
|
||||
if self.package:
|
||||
if self.packageName == user['package']['name'] and self.packageOwner == user['package']['owner']:
|
||||
pass
|
||||
else:
|
||||
continue
|
||||
|
||||
if self.uid !=None:
|
||||
if self.id:
|
||||
if self.uid == user['id']:
|
||||
users.append(user)
|
||||
else:
|
||||
users.append(user)
|
||||
else:
|
||||
users.append(user)
|
||||
|
||||
final = {'data': users, 'metadata': self.initialMeta}
|
||||
print(json.dumps(final))
|
||||
|
||||
def listAll(self):
|
||||
|
||||
if self.owner == None:
|
||||
websites = Websites.objects.all()
|
||||
else:
|
||||
websites = Websites.objects.filter(externalApp=self.owner)
|
||||
|
||||
if self.username != None:
|
||||
websites = websites.filter(externalApp=self.username)
|
||||
|
||||
self.fetchJson(websites)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='CyberPanel CloudLinux Manager')
|
||||
parser.add_argument('-o', '--owner', help='Owner')
|
||||
parser.add_argument('--fields', help='Fields to output!')
|
||||
parser.add_argument('--username', help='Fields to output!')
|
||||
parser.add_argument('--package-name', help='Fields to output!')
|
||||
parser.add_argument('--package-owner', help='Fields to output!')
|
||||
parser.add_argument('--unix-id', help='Fields to output!')
|
||||
|
||||
args = vars(parser.parse_args())
|
||||
|
||||
pi = CloudLinuxUsers(args['owner'], args['username'], args['package_name'], args['package_owner'], args['fields'], args['unix_id'])
|
||||
pi.listAll()
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='CyberPanel CloudLinux Manager')
|
||||
parser.add_argument('--owner', help='Owner')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
pi = CloudLinuxUsers()
|
||||
try:
|
||||
pi.listAll(args.owner)
|
||||
except:
|
||||
pi.listAll()
|
||||
main()
|
||||
|
||||
22
CLScript/UserInfo.py
Executable file
22
CLScript/UserInfo.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import getpass
|
||||
|
||||
def main():
|
||||
if getpass.getuser() == 'root':
|
||||
userType = "admin"
|
||||
else:
|
||||
userType = "user"
|
||||
|
||||
data = """{
|
||||
"userName": "%s",
|
||||
"userType": "%s",
|
||||
"lang": "en",
|
||||
"assetsUri": "/usr/local/lvemanager",
|
||||
"baseUri": "/usr/local/lvemanager",
|
||||
"defaultDomain": "cyberpanel.net"
|
||||
}""" % (getpass.getuser(), userType)
|
||||
|
||||
print(data)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
0
CLScript/__init__.py
Normal file
0
CLScript/__init__.py
Normal file
27
CLScript/panel_info.py
Executable file
27
CLScript/panel_info.py
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import json
|
||||
from CLScript.CLMain import CLMain
|
||||
|
||||
|
||||
class PanelInfo(CLMain):
|
||||
def __init__(self):
|
||||
CLMain.__init__(self)
|
||||
|
||||
def emit(self):
|
||||
|
||||
initial = {
|
||||
"name": "CyberPanel",
|
||||
"version": "%s.%s" % (self.version, self.build),
|
||||
"user_login_url": "https://%s:8090/" % (self.ipAddress)
|
||||
}
|
||||
|
||||
final = {'data': initial, 'metadata': self.initialMeta}
|
||||
|
||||
print(json.dumps(final))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pi = PanelInfo()
|
||||
pi.emit()
|
||||
@@ -49,7 +49,7 @@ class secMiddleware:
|
||||
try:
|
||||
#logging.writeToFile(request.body)
|
||||
data = json.loads(request.body)
|
||||
for key, value in data.iteritems():
|
||||
for key, value in data.items():
|
||||
if request.path.find('gitNotify') > -1:
|
||||
break
|
||||
|
||||
@@ -60,7 +60,7 @@ class secMiddleware:
|
||||
# final_json = json.dumps(final_dic)
|
||||
# return HttpResponse(final_json)
|
||||
|
||||
if type(value) == str or type(value) == unicode:
|
||||
if type(value) == str or type(value) == bytes:
|
||||
pass
|
||||
else:
|
||||
continue
|
||||
@@ -94,7 +94,7 @@ class secMiddleware:
|
||||
final_dic = {'error_message': "Data supplied is not accepted.", "errorMessage": "Data supplied is not accepted following characters are not allowed in the input ` $ & ( ) [ ] { } ; : ‘ < >."}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
response = self.get_response(request)
|
||||
return response
|
||||
|
||||
@@ -190,4 +190,5 @@ LANGUAGES = (
|
||||
)
|
||||
|
||||
MEDIA_URL = '/home/cyberpanel/media/'
|
||||
MEDIA_ROOT = MEDIA_URL
|
||||
MEDIA_ROOT = MEDIA_URL
|
||||
DATA_UPLOAD_MAX_MEMORY_SIZE = 52428800
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import os,sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import django
|
||||
@@ -155,7 +155,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
metaFileXML.append(dnsRecordsXML)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [158:prepMeta]' % (str(msg)), 1)
|
||||
|
||||
## Email accounts XML
|
||||
@@ -176,7 +176,7 @@ class IncJobs(multi.Thread):
|
||||
emailRecordsXML.append(emailRecordXML)
|
||||
|
||||
metaFileXML.append(emailRecordsXML)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(self.statusPath, '%s. [warning:179:prepMeta]' % (str(msg)), 1)
|
||||
|
||||
## Email meta generated!
|
||||
@@ -196,7 +196,7 @@ class IncJobs(multi.Thread):
|
||||
metaFile = open(metaPath, 'w')
|
||||
metaFile.write(xmlpretty)
|
||||
metaFile.close()
|
||||
os.chmod(metaPath, 0640)
|
||||
os.chmod(metaPath, 0o640)
|
||||
|
||||
## meta generated
|
||||
|
||||
@@ -211,7 +211,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
return 1
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [207][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -239,7 +239,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
logging.statusWriter(self.statusPath, 'Data for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,'%s. [IncJobs.backupData.223][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -271,7 +271,7 @@ class IncJobs(multi.Thread):
|
||||
destination=self.backupDestinations)
|
||||
newSnapshot.save()
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,'%s. [IncJobs.backupDatabases.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -304,7 +304,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
logging.statusWriter(self.statusPath, 'Emails for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,'%s. [IncJobs.backupDatabases.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -323,7 +323,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
logging.statusWriter(self.statusPath, 'Repo %s initiated for %s.' % (self.backupDestinations, self.website.domain), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,'%s. [IncJobs.initiateRepo.47][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
@@ -115,7 +115,7 @@ class IncJobs(multi.Thread):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
|
||||
####
|
||||
@@ -137,7 +137,7 @@ class IncJobs(multi.Thread):
|
||||
snapShotid = result.split(' ')[-2]
|
||||
if bType == 'database':
|
||||
newSnapshot = JobSnapshots(job=self.jobid,
|
||||
type='%s:%s' % (bType, backupPath.split('/')[-1].strip('.sql')),
|
||||
type='%s:%s' % (bType, backupPath.split('/')[-1].rstrip('.sql')),
|
||||
snapshotid=snapShotid,
|
||||
destination=self.backupDestinations)
|
||||
else:
|
||||
@@ -163,7 +163,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath, result, 1)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [88][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -177,7 +177,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
if type == 'database':
|
||||
newSnapshot = JobSnapshots(job=self.jobid,
|
||||
type='%s:%s' % (type, backupPath.split('/')[-1].strip('.sql')),
|
||||
type='%s:%s' % (type, backupPath.split('/')[-1].rstrip('.sql')),
|
||||
snapshotid=snapShotid,
|
||||
destination=self.backupDestinations)
|
||||
else:
|
||||
@@ -202,7 +202,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
if type == 'database':
|
||||
newSnapshot = JobSnapshots(job=self.jobid,
|
||||
type='%s:%s' % (type, backupPath.split('/')[-1].strip('.sql')),
|
||||
type='%s:%s' % (type, backupPath.split('/')[-1].rstrip('.sql')),
|
||||
snapshotid=snapShotid,
|
||||
destination=self.backupDestinations)
|
||||
else:
|
||||
@@ -240,7 +240,7 @@ class IncJobs(multi.Thread):
|
||||
else:
|
||||
self.awsFunction('restore', '', self.jobid.snapshotid)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [138][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -267,17 +267,17 @@ class IncJobs(multi.Thread):
|
||||
|
||||
if mysqlUtilities.mysqlUtilities.restoreDatabaseBackup(self.jobid.type.split(':')[1].rstrip('.sql'),
|
||||
'/home/cyberpanel', 'dummy', 'dummy') == 0:
|
||||
raise BaseException
|
||||
raise BaseException('Can not restore database backup.')
|
||||
|
||||
try:
|
||||
if self.reconstruct == 'remote':
|
||||
os.remove('/home/cyberpanel/%s' % (self.path.split('/')[-1]))
|
||||
else:
|
||||
os.remove('/home/cyberpanel/%s.sql' % (self.jobid.type.split(':')[1]))
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [160][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -297,7 +297,7 @@ class IncJobs(multi.Thread):
|
||||
else:
|
||||
self.awsFunction('restore', '', self.jobid.snapshotid)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [46][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -318,7 +318,7 @@ class IncJobs(multi.Thread):
|
||||
self.awsFunction('restore', '', self.jobid.snapshotid)
|
||||
|
||||
metaPathNew = '/home/%s/meta.xml' % (self.website)
|
||||
execPath = "nice -n 10 /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/IncBackups/restoreMeta.py"
|
||||
execPath = "nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/restoreMeta.py"
|
||||
execPath = execPath + " submitRestore --metaPath %s --statusFile %s" % (metaPathNew, self.statusPath)
|
||||
result = ProcessUtilities.outputExecutioner(execPath)
|
||||
logging.statusWriter(self.statusPath, result, 1)
|
||||
@@ -328,7 +328,7 @@ class IncJobs(multi.Thread):
|
||||
except:
|
||||
pass
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [46][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -400,7 +400,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath, message, 1)
|
||||
|
||||
logging.statusWriter(self.statusPath, 'Completed', 1)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.extraArgs['tempPath'], str(msg), 1)
|
||||
|
||||
### Backup functions
|
||||
@@ -520,7 +520,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
metaFileXML.append(dnsRecordsXML)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [158:prepMeta]' % (str(msg)), 1)
|
||||
|
||||
## Email accounts XML
|
||||
@@ -541,7 +541,7 @@ class IncJobs(multi.Thread):
|
||||
emailRecordsXML.append(emailRecordXML)
|
||||
|
||||
metaFileXML.append(emailRecordsXML)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [warning:179:prepMeta]' % (str(msg)), 1)
|
||||
|
||||
## Email meta generated!
|
||||
@@ -559,9 +559,9 @@ class IncJobs(multi.Thread):
|
||||
|
||||
xmlpretty = prettify(metaFileXML).encode('ascii', 'ignore')
|
||||
metaFile = open(metaPath, 'w')
|
||||
metaFile.write(xmlpretty)
|
||||
metaFile.write(xmlpretty.decode('utf-8'))
|
||||
metaFile.close()
|
||||
os.chmod(metaPath, 0640)
|
||||
os.chmod(metaPath, 0o640)
|
||||
|
||||
## meta generated
|
||||
|
||||
@@ -573,7 +573,7 @@ class IncJobs(multi.Thread):
|
||||
|
||||
return 1
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, "%s [207][5009]" % (str(msg)), 1)
|
||||
return 0
|
||||
|
||||
@@ -592,7 +592,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Data for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.backupData.223][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -617,11 +617,11 @@ class IncJobs(multi.Thread):
|
||||
|
||||
try:
|
||||
os.remove('/home/cyberpanel/%s.sql' % (items.dbName))
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Failed to delete database: %s. [IncJobs.backupDatabases.456]' % str(msg), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.backupDatabases.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -641,7 +641,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Emails for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.emailBackup.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -661,7 +661,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Meta for %s backed to %s.' % (self.website.domain, self.backupDestinations), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.metaBackup.269][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -691,7 +691,7 @@ class IncJobs(multi.Thread):
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Repo %s initiated for %s.' % (self.backupDestinations, self.website.domain), 1)
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath, '%s. [IncJobs.initiateRepo.47][5009]' % str(msg), 1)
|
||||
return 0
|
||||
|
||||
@@ -763,7 +763,7 @@ Subject: %s
|
||||
try:
|
||||
command = 'rm -f %s' % (metaPathNew)
|
||||
ProcessUtilities.executioner(command)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.statusWriter(self.statusPath,
|
||||
'Failed to delete meta file: %s. [IncJobs.createBackup.591]' % str(msg), 1)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
from websiteFunctions.models import Websites
|
||||
from datetime import datetime
|
||||
|
||||
class IncJob(models.Model):
|
||||
website = models.ForeignKey(Websites)
|
||||
website = models.ForeignKey(Websites, on_delete=models.CASCADE)
|
||||
date = models.DateTimeField(default=datetime.now, blank=True)
|
||||
|
||||
class JobSnapshots(models.Model):
|
||||
job = models.ForeignKey(IncJob)
|
||||
job = models.ForeignKey(IncJob, on_delete=models.CASCADE)
|
||||
type = models.CharField(max_length=300)
|
||||
snapshotid = models.CharField(max_length=50)
|
||||
destination = models.CharField(max_length=200, default='')
|
||||
@@ -24,7 +24,7 @@ class BackupJob(models.Model):
|
||||
|
||||
|
||||
class JobSites(models.Model):
|
||||
job = models.ForeignKey(BackupJob)
|
||||
job = models.ForeignKey(BackupJob, on_delete=models.CASCADE)
|
||||
website = models.CharField(max_length=300)
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^createBackup$', views.createBackup, name='createBackupInc'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.shortcuts import render
|
||||
from plogical.acl import ACLManager
|
||||
@@ -48,7 +48,7 @@ def createBackup(request):
|
||||
destinations.append('s3:s3.amazonaws.com/%s' % (items))
|
||||
|
||||
return defRenderer(request, 'IncBackups/createBackup.html', {'websiteList': websitesName, 'destinations': destinations})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -61,7 +61,7 @@ def backupDestinations(request):
|
||||
return ACLManager.loadError()
|
||||
|
||||
return defRenderer(request, 'IncBackups/incrementalDestinations.html', {})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -99,7 +99,7 @@ def addDestination(request):
|
||||
pass
|
||||
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " submitDestinationCreation --ipAddress " + ipAddress + " --password " \
|
||||
+ password + " --port " + port
|
||||
|
||||
@@ -168,7 +168,7 @@ def addDestination(request):
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -235,7 +235,7 @@ def populateCurrentRecords(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -264,7 +264,7 @@ def removeDestination(request):
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'destStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -337,7 +337,7 @@ def fetchCurrentBackups(request):
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -398,7 +398,7 @@ def submitBackupCreation(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", 'tempPath': tempPath})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
@@ -456,7 +456,7 @@ def getBackupStatus(request):
|
||||
final_json = json.dumps({'backupStatus': 1, 'error_message': "None", "status": 1, "abort": 0})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'backupStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
logging.writeToFile(str(msg) + " [backupStatus]")
|
||||
@@ -483,7 +483,7 @@ def deleteBackup(request):
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'destStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -528,7 +528,7 @@ def fetchRestorePoints(request):
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -576,7 +576,7 @@ def restorePoint(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", 'tempPath': tempPath})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
@@ -607,7 +607,7 @@ def scheduleBackups(request):
|
||||
destinations.append('s3:s3.amazonaws.com/%s' % (items))
|
||||
|
||||
return defRenderer(request, 'IncBackups/backupSchedule.html', {'websiteList': websitesName, 'destinations': destinations})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -657,7 +657,7 @@ def submitBackupSchedule(request):
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -690,7 +690,7 @@ def getCurrentBackupSchedules(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -713,7 +713,7 @@ def scheduleDelete(request):
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -741,6 +741,6 @@ def restoreRemoteBackups(request):
|
||||
destinations.append('s3:s3.amazonaws.com/%s' % (items))
|
||||
|
||||
return defRenderer(request, 'IncBackups/restoreRemoteBackups.html', {'websiteList': websitesName, 'destinations': destinations})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
@@ -82,14 +82,14 @@ class SSHServer(multi.Thread):
|
||||
time.sleep(0.01)
|
||||
else:
|
||||
return 0
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
time.sleep(0.1)
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.recvData()
|
||||
except BaseException, msg:
|
||||
print(str(msg))
|
||||
except BaseException as msg:
|
||||
print((str(msg)))
|
||||
|
||||
|
||||
class WebTerminalServer(WebSocket):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ Description = CyberPanel SSH Websocket Daemon
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart = /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/WebTerminal/servCTRL.py start
|
||||
ExecStop = /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/WebTerminal/servCTRL.py stop
|
||||
Restart = /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/WebTerminal/servCTRL.py restart
|
||||
ExecStart = /usr/local/CyberCP/bin/python /usr/local/CyberCP/WebTerminal/servCTRL.py start
|
||||
ExecStop = /usr/local/CyberCP/bin/python /usr/local/CyberCP/WebTerminal/servCTRL.py stop
|
||||
Restart = /usr/local/CyberCP/bin/python /usr/local/CyberCP/WebTerminal/servCTRL.py restart
|
||||
Restart=on-abnormal
|
||||
|
||||
[Install]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class servCTRL:
|
||||
if os.path.exists(servCTRL.pidfile):
|
||||
self.stop()
|
||||
|
||||
command = '/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/WebTerminal/CPWebSocket.py'
|
||||
command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/WebTerminal/CPWebSocket.py'
|
||||
subprocess.Popen(shlex.split(command))
|
||||
|
||||
def stop(self):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.terminal, name='terminal'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.shortcuts import render, redirect, HttpResponse
|
||||
from plogical.acl import ACLManager
|
||||
@@ -49,7 +49,7 @@ def terminal(request):
|
||||
newFWRule.save()
|
||||
|
||||
return render(request, 'WebTerminal/WebTerminal.html', {'verifyPath': verifyPath, 'password': password})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -73,7 +73,7 @@ def restart(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
import json
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^createWebsite', views.createWebsite, name='createWebsiteAPI'),
|
||||
|
||||
34
api/views.py
34
api/views.py
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
from django.shortcuts import redirect
|
||||
from django.http import HttpResponse
|
||||
@@ -46,7 +46,7 @@ def verifyConn(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'verifyConn': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -107,7 +107,7 @@ def getUserInfo(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -150,7 +150,7 @@ def changeUserPassAPI(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'changeStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -195,7 +195,7 @@ def changePackageAPI(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'changePackage': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -240,7 +240,7 @@ def deleteWebsite(request):
|
||||
wm = WebsiteManager()
|
||||
return wm.submitWebsiteDeletion(admin.pk, data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'websiteDeleteStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -271,7 +271,7 @@ def submitWebsiteStatus(request):
|
||||
wm = WebsiteManager()
|
||||
return wm.submitWebsiteStatus(admin.pk, json.loads(request.body))
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'websiteStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -295,7 +295,7 @@ def loginAPI(request):
|
||||
else:
|
||||
return HttpResponse("Invalid Credentials.")
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'userID': 0, 'loginStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -338,7 +338,7 @@ def fetchSSHkey(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'status' : 0, 'pubKeyStatus': 0,'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -378,7 +378,7 @@ def remoteTransfer(request):
|
||||
|
||||
## Accounts to transfer is a path to file, containing accounts.
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
||||
execPath = execPath + " remoteTransfer --ipAddress " + ipAddress + " --dir " + dir + " --accountsToTransfer " + path
|
||||
ProcessUtilities.popenExecutioner(execPath)
|
||||
|
||||
@@ -390,7 +390,7 @@ def remoteTransfer(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'transferStatus': 0,'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -440,7 +440,7 @@ def fetchAccountsFromRemoteServer(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'fetchStatus': 0,'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -481,7 +481,7 @@ def FetchRemoteTransferStatus(request):
|
||||
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'fetchStatus': 0,'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -528,7 +528,7 @@ def cancelRemoteTransfer(request):
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'cancelStatus': 1, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -572,7 +572,7 @@ def cyberPanelVersion(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {
|
||||
"getVersion": 0,
|
||||
'error_message': str(msg)
|
||||
@@ -590,7 +590,7 @@ def runAWSBackups(request):
|
||||
if os.path.exists(randomFile):
|
||||
s3 = S3Backups(request, None, 'runAWSBackups')
|
||||
s3.start()
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [API.runAWSBackups]')
|
||||
|
||||
|
||||
@@ -620,7 +620,7 @@ def submitUserCreation(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'changeStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
from .models import DBUsers
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
@@ -33,7 +33,7 @@ class BackupManager:
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
return render(request, 'backup/index.html', currentACL)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def backupSite(self, request = None, userID = None, data = None):
|
||||
@@ -45,7 +45,7 @@ class BackupManager:
|
||||
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
return render(request, 'backup/backup.html', {'websiteList': websitesName})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def restoreSite(self, request = None, userID = None, data = None):
|
||||
@@ -73,7 +73,7 @@ class BackupManager:
|
||||
|
||||
return render(request, 'backup/restore.html', {'backups': all_files})
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def getCurrentBackups(self, userID = None, data = None):
|
||||
@@ -120,7 +120,7 @@ class BackupManager:
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -157,7 +157,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'status': 1, 'metaStatus': 1, 'error_message': "None", 'tempStorage': tempStoragePath})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
final_dic = {'status': 0, 'metaStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
@@ -240,7 +240,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'backupStatus': 0, 'error_message': "None", "status": 0, "abort": 0})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'backupStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [backupStatus]")
|
||||
@@ -252,20 +252,20 @@ class BackupManager:
|
||||
backupCancellationDomain = data['backupCancellationDomain']
|
||||
fileName = data['fileName']
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " cancelBackupCreation --backupCancellationDomain " + backupCancellationDomain + " --fileName " + fileName
|
||||
subprocess.call(shlex.split(execPath))
|
||||
|
||||
try:
|
||||
backupOb = Backups.objects.get(fileName=fileName)
|
||||
backupOb.delete()
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [cancelBackupCreation]")
|
||||
|
||||
final_json = json.dumps({'abortStatus': 1, 'error_message': "None", "status": 0})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'abortStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -291,7 +291,7 @@ class BackupManager:
|
||||
|
||||
final_json = json.dumps({'status': 1, 'deleteStatus': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'deleteStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
||||
@@ -313,7 +313,7 @@ class BackupManager:
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " submitRestore --backupFile " + backupFile + " --dir " + dir
|
||||
ProcessUtilities.popenExecutioner(execPath)
|
||||
time.sleep(4)
|
||||
@@ -321,7 +321,7 @@ class BackupManager:
|
||||
final_dic = {'restoreStatus': 1, 'error_message': "None"}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'restoreStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -368,7 +368,7 @@ class BackupManager:
|
||||
'running': 'Running..'})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
status = "Just Started"
|
||||
final_json = json.dumps(
|
||||
@@ -381,7 +381,7 @@ class BackupManager:
|
||||
'abort': 1})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'restoreStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -395,7 +395,7 @@ class BackupManager:
|
||||
|
||||
return render(request, 'backup/backupDestinations.html', {})
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def submitDestinationCreation(self, userID = None, data = None):
|
||||
@@ -427,7 +427,7 @@ class BackupManager:
|
||||
except:
|
||||
port = "22"
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " submitDestinationCreation --ipAddress " + ipAddress + " --password " \
|
||||
+ password + " --port " + port
|
||||
|
||||
@@ -457,7 +457,7 @@ class BackupManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'destStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -492,7 +492,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -506,7 +506,7 @@ class BackupManager:
|
||||
|
||||
ipAddress = data['IPAddress']
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py"
|
||||
execPath = execPath + " getConnectionStatus --ipAddress " + ipAddress
|
||||
|
||||
output = ProcessUtilities.executioner(execPath)
|
||||
@@ -520,7 +520,7 @@ class BackupManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'connStatus': 1, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -573,7 +573,7 @@ class BackupManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'delStatus': 1, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -600,7 +600,7 @@ class BackupManager:
|
||||
|
||||
return render(request, 'backup/backupSchedule.html', {'destinations': destinations})
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def getCurrentBackupSchedules(self, userID = None, data = None):
|
||||
@@ -631,7 +631,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -658,13 +658,13 @@ class BackupManager:
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
if backupDest == "Home" and backupFreq == "Daily":
|
||||
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupScheduleLocal.py"
|
||||
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/backupScheduleLocal.py"
|
||||
elif backupDest == "Home" and backupFreq == "Weekly":
|
||||
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupScheduleLocal.py "
|
||||
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/backupScheduleLocal.py "
|
||||
elif backupDest != "Home" and backupFreq == "Daily":
|
||||
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupSchedule.py"
|
||||
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/backupSchedule.py"
|
||||
elif backupDest != "Home" and backupFreq == "Weekly":
|
||||
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupSchedule.py "
|
||||
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/backupSchedule.py "
|
||||
|
||||
command = "cat " + path
|
||||
output = ProcessUtilities.outputExecutioner(command)
|
||||
@@ -700,13 +700,13 @@ class BackupManager:
|
||||
return HttpResponse(final_json)
|
||||
except:
|
||||
if backupDest == "Home" and backupFreq == "Daily":
|
||||
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupScheduleLocal.py"
|
||||
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/backupScheduleLocal.py"
|
||||
elif backupDest == "Home" and backupFreq == "Weekly":
|
||||
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupScheduleLocal.py "
|
||||
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/backupScheduleLocal.py "
|
||||
elif backupDest != "Home" and backupFreq == "Daily":
|
||||
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupSchedule.py"
|
||||
cronJob = "0 3 * * * root /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/backupSchedule.py"
|
||||
elif backupDest != "Home" and backupFreq == "Weekly":
|
||||
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/backupSchedule.py "
|
||||
cronJob = "0 0 * * 0 root /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/backupSchedule.py "
|
||||
|
||||
command = "cat " + path
|
||||
output = ProcessUtilities.outputExecutioner(command)
|
||||
@@ -741,7 +741,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'scheduleStatus': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'scheduleStatus': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -802,7 +802,7 @@ class BackupManager:
|
||||
final_json = json.dumps({'delStatus': 1, 'error_message': "None"})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'delStatus': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -815,7 +815,7 @@ class BackupManager:
|
||||
|
||||
return render(request, 'backup/remoteBackups.html')
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def submitRemoteBackups(self, userID = None, data = None):
|
||||
@@ -858,7 +858,7 @@ class BackupManager:
|
||||
return HttpResponse(data_ret)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0,
|
||||
'error_message': "Not able to fetch version of remote server. Error Message: " + str(
|
||||
msg),
|
||||
@@ -897,7 +897,7 @@ class BackupManager:
|
||||
|
||||
##
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
||||
execPath = execPath + " writeAuthKey --pathToKey " + pathToKey
|
||||
output = ProcessUtilities.outputExecutioner(execPath)
|
||||
|
||||
@@ -930,14 +930,14 @@ class BackupManager:
|
||||
data['error_message'], "dir": "Null"}
|
||||
data_ret = json.dumps(data_ret)
|
||||
return HttpResponse(data_ret)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0,
|
||||
'error_message': "Not able to fetch accounts from remote server. Error Message: " + str(
|
||||
msg), "dir": "Null"}
|
||||
data_ret = json.dumps(data_ret)
|
||||
return HttpResponse(data_ret)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -995,13 +995,13 @@ class BackupManager:
|
||||
data['error_message']})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'remoteTransferStatus': 0,
|
||||
'error_message': "Can not initiate remote transfer. Error message: " +
|
||||
str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_json = json.dumps({'remoteTransferStatus': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -1045,7 +1045,7 @@ class BackupManager:
|
||||
'backupsSent': 0}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'remoteTransferStatus': 0, 'error_message': str(msg), 'backupsSent': 0}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -1063,7 +1063,7 @@ class BackupManager:
|
||||
|
||||
##
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py"
|
||||
execPath = execPath + " remoteBackupRestore --backupDirComplete " + backupDirComplete + " --backupDir " + str(
|
||||
backupDir)
|
||||
|
||||
@@ -1075,7 +1075,7 @@ class BackupManager:
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'remoteRestoreStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -1122,7 +1122,7 @@ class BackupManager:
|
||||
"complete": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'remoteTransferStatus': 0, 'error_message': str(msg), "status": "None", "complete": 0}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
@@ -1168,7 +1168,7 @@ class BackupManager:
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data = {'cancelStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from signals import *
|
||||
from .signals import *
|
||||
from plogical.pluginManagerGlobal import pluginManagerGlobal
|
||||
|
||||
class pluginManager:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.loadBackupHome, name='loadBackupHome'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
# Create your views here.
|
||||
import json
|
||||
@@ -61,7 +61,7 @@ def submitBackupCreation(request):
|
||||
|
||||
return coreResult
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
|
||||
|
||||
@@ -337,5 +337,5 @@ def localInitiate(request):
|
||||
if os.path.exists(randomFile):
|
||||
wm = BackupManager()
|
||||
return wm.submitBackupCreation(1, json.loads(request.body))
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
@@ -410,6 +410,9 @@
|
||||
<li><a href="{% url 'listWebsites' %}"
|
||||
title="{% trans 'List Websites' %}"><span>{% trans "List Websites" %}</span></a>
|
||||
</li>
|
||||
<li><a href="{% url 'listChildDomains' %}"
|
||||
title="{% trans 'List Child Domains' %}"><span>{% trans "List Child Domains" %}</span></a>
|
||||
</li>
|
||||
<li class="modifyWebsite"><a href="{% url 'modifyWebsite' %}"
|
||||
title="{% trans 'Modify Website' %}"><span>{% trans "Modify Website" %}</span></a>
|
||||
</li>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.renderBase, name='index'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.shortcuts import render,redirect
|
||||
from django.http import HttpResponse
|
||||
@@ -199,7 +199,7 @@ def upgradeStatus(request):
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException,msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'upgradeStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -217,6 +217,6 @@ def upgradeVersion(request):
|
||||
vers.build = latest['build']
|
||||
vers.save()
|
||||
return HttpResponse("Version upgrade OK.")
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse(str(msg))
|
||||
@@ -20,9 +20,9 @@ class cliLogger:
|
||||
def readLastNFiles(numberOfLines,fileName):
|
||||
try:
|
||||
|
||||
lastFewLines = subprocess.check_output(["tail", "-n",str(numberOfLines),fileName])
|
||||
lastFewLines = subprocess.check_output(["tail", "-n",str(numberOfLines),fileName]).decode("utf-8")
|
||||
|
||||
return lastFewLines
|
||||
|
||||
except subprocess.CalledProcessError,msg:
|
||||
except subprocess.CalledProcessError as msg:
|
||||
return "File was empty"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import os,sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import django
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
django.setup()
|
||||
from inspect import stack
|
||||
from cliLogger import cliLogger as logger
|
||||
from cli.cliLogger import cliLogger as logger
|
||||
import json
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
import re
|
||||
@@ -17,7 +17,7 @@ import requests
|
||||
from loginSystem.models import Administrator
|
||||
from packages.models import Package
|
||||
from plogical.mysqlUtilities import mysqlUtilities
|
||||
from cliParser import cliParser
|
||||
from cli.cliParser import cliParser
|
||||
from plogical.vhost import vhost
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
from plogical.ftpUtilities import FTPUtilities
|
||||
@@ -33,7 +33,7 @@ class cyberPanel:
|
||||
data = json.dumps({'success': operationStatus,
|
||||
'errorMessage': errorMessage
|
||||
})
|
||||
print data
|
||||
print(data)
|
||||
|
||||
## Website Functions
|
||||
|
||||
@@ -51,7 +51,7 @@ class cyberPanel:
|
||||
else:
|
||||
self.printStatus(0, result[1])
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -68,7 +68,7 @@ class cyberPanel:
|
||||
else:
|
||||
self.printStatus(0, result[1])
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -77,9 +77,9 @@ class cyberPanel:
|
||||
vhost.deleteVirtualHostConfigurations(domainName)
|
||||
self.printStatus(1, 'None')
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def deleteChild(self, childDomain):
|
||||
try:
|
||||
@@ -91,9 +91,9 @@ class cyberPanel:
|
||||
else:
|
||||
self.printStatus(0, result[1])
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def listWebsitesJson(self):
|
||||
try:
|
||||
@@ -122,11 +122,11 @@ class cyberPanel:
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps(json_data)
|
||||
print final_json
|
||||
print(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def listWebsitesPretty(self):
|
||||
try:
|
||||
@@ -146,11 +146,11 @@ class cyberPanel:
|
||||
else:
|
||||
state = "Active"
|
||||
table.add_row([items.id, items.domain, ipAddress, items.package.packageName, items.admin.userName, state, items.adminEmail])
|
||||
print table
|
||||
print(table)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def changePHP(self, virtualHostName, phpVersion):
|
||||
try:
|
||||
@@ -167,7 +167,7 @@ class cyberPanel:
|
||||
else:
|
||||
self.printStatus(0, result[1])
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -186,7 +186,7 @@ class cyberPanel:
|
||||
|
||||
self.printStatus(1, 'None')
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -218,11 +218,11 @@ class cyberPanel:
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps(json_data)
|
||||
print final_json
|
||||
print(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def listDNSPretty(self, virtualHostName):
|
||||
try:
|
||||
@@ -237,11 +237,11 @@ class cyberPanel:
|
||||
else:
|
||||
content = items.content
|
||||
table.add_row([items.id, items.type, items.name, content, items.prio, items.ttl])
|
||||
print table
|
||||
print(table)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def listDNSZonesJson(self):
|
||||
try:
|
||||
@@ -264,11 +264,11 @@ class cyberPanel:
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps(json_data)
|
||||
print final_json
|
||||
print(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def listDNSZonesPretty(self):
|
||||
try:
|
||||
@@ -280,18 +280,18 @@ class cyberPanel:
|
||||
|
||||
for items in records:
|
||||
table.add_row([items.id, items.name])
|
||||
print table
|
||||
print(table)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def createDNSZone(self, virtualHostName, owner):
|
||||
try:
|
||||
admin = Administrator.objects.get(userName=owner)
|
||||
DNS.dnsTemplate(virtualHostName, admin)
|
||||
self.printStatus(1, 'None')
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -300,7 +300,7 @@ class cyberPanel:
|
||||
zone = DNS.getZoneObject(virtualHostName)
|
||||
DNS.createDNSRecord(zone, name, recordType, value, int(priority), int(ttl))
|
||||
self.printStatus(1, 'None')
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -308,7 +308,7 @@ class cyberPanel:
|
||||
try:
|
||||
DNS.deleteDNSZone(virtualHostName)
|
||||
self.printStatus(1, 'None')
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -316,7 +316,7 @@ class cyberPanel:
|
||||
try:
|
||||
DNS.deleteDNSRecord(recordID)
|
||||
self.printStatus(1, 'None')
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -326,13 +326,13 @@ class cyberPanel:
|
||||
try:
|
||||
backupLogPath = "/usr/local/lscp/logs/backup_log."+time.strftime("%I-%M-%S-%a-%b-%Y")
|
||||
|
||||
print 'Backup logs to be generated in %s' % (backupLogPath)
|
||||
print('Backup logs to be generated in %s' % (backupLogPath))
|
||||
|
||||
backupSchedule.createLocalBackup(virtualHostName, backupLogPath)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def restoreBackup(self, fileName):
|
||||
try:
|
||||
@@ -351,19 +351,19 @@ class cyberPanel:
|
||||
data = json.loads(r.text)
|
||||
|
||||
if data['abort'] == 1 and data['running'] == "Error":
|
||||
print 'Failed to restore backup, Error message : ' + data['status'] + '\n'
|
||||
print('Failed to restore backup, Error message : ' + data['status'] + '\n')
|
||||
break
|
||||
elif data['abort'] == 1 and data['running'] == "Completed":
|
||||
print '\n\n'
|
||||
print 'Backup restore completed.\n'
|
||||
print('\n\n')
|
||||
print('Backup restore completed.\n')
|
||||
break
|
||||
else:
|
||||
print 'Waiting for restore to complete. Current status: ' + data['status']
|
||||
print('Waiting for restore to complete. Current status: ' + data['status'])
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
## Packages
|
||||
|
||||
@@ -380,7 +380,7 @@ class cyberPanel:
|
||||
|
||||
self.printStatus(1, 'None')
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -391,7 +391,7 @@ class cyberPanel:
|
||||
delPack.delete()
|
||||
self.printStatus(1, 'None')
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -422,11 +422,11 @@ class cyberPanel:
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps(json_data)
|
||||
print final_json
|
||||
print(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def listPackagesPretty(self):
|
||||
try:
|
||||
@@ -438,11 +438,11 @@ class cyberPanel:
|
||||
|
||||
for items in records:
|
||||
table.add_row([items.packageName, items.allowedDomains, items.diskSpace, items.bandwidth, items.ftpAccounts, items.dataBases, items.emailAccounts])
|
||||
print table
|
||||
print(table)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
|
||||
## Database functions
|
||||
@@ -455,7 +455,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -468,7 +468,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -494,11 +494,11 @@ class cyberPanel:
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps(json_data)
|
||||
print final_json
|
||||
print(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def listDatabasesPretty(self, virtualHostName):
|
||||
try:
|
||||
@@ -510,11 +510,11 @@ class cyberPanel:
|
||||
|
||||
for items in records:
|
||||
table.add_row([items.id, items.dbName, items.dbUser])
|
||||
print table
|
||||
print(table)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
## Email functions
|
||||
|
||||
@@ -526,7 +526,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -538,7 +538,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -550,7 +550,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -575,11 +575,11 @@ class cyberPanel:
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps(json_data)
|
||||
print final_json
|
||||
print(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def listEmailsPretty(self, virtualHostName):
|
||||
try:
|
||||
@@ -591,11 +591,11 @@ class cyberPanel:
|
||||
|
||||
for items in records:
|
||||
table.add_row([items.email])
|
||||
print table
|
||||
print(table)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
## FTP Functions
|
||||
|
||||
@@ -612,7 +612,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -624,7 +624,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -636,7 +636,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -662,11 +662,11 @@ class cyberPanel:
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps(json_data)
|
||||
print final_json
|
||||
print(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
def listFTPPretty(self, virtualHostName):
|
||||
try:
|
||||
@@ -678,11 +678,11 @@ class cyberPanel:
|
||||
|
||||
for items in records:
|
||||
table.add_row([items.id, items.user, items.dir])
|
||||
print table
|
||||
print(table)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
print 0
|
||||
print(0)
|
||||
|
||||
## FTP Functions
|
||||
|
||||
@@ -709,7 +709,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -733,7 +733,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -757,7 +757,7 @@ class cyberPanel:
|
||||
self.printStatus(1, 'None')
|
||||
else:
|
||||
self.printStatus(1, result[1])
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -786,7 +786,7 @@ class cyberPanel:
|
||||
ProcessUtilities.restartLitespeed()
|
||||
self.printStatus(1, 'None')
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logger.writeforCLI(str(msg), "Error", stack()[0][3])
|
||||
self.printStatus(0, str(msg))
|
||||
|
||||
@@ -803,23 +803,23 @@ def main():
|
||||
completeCommandExample = 'cyberpanel createWebsite --package Detault --owner admin --domainName cyberpanel.net --email support@cyberpanel.net --php 5.6'
|
||||
|
||||
if not args.package:
|
||||
print "\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.owner:
|
||||
print "\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter the domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.email:
|
||||
print "\n\nPlease enter the email. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the email. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.php:
|
||||
print "\n\nPlease enter the PHP version such as 5.6 for PHP version 5.6. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the PHP version such as 5.6 for PHP version 5.6. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if args.ssl:
|
||||
@@ -843,7 +843,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel deleteWebsite --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter the domain to delete. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the domain to delete. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.deleteWebsite(args.domainName)
|
||||
@@ -853,19 +853,19 @@ def main():
|
||||
' --owner admin --php 5.6'
|
||||
|
||||
if not args.masterDomain:
|
||||
print "\n\nPlease enter Master domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter Master domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.childDomain:
|
||||
print "\n\nPlease enter the Child Domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the Child Domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.owner:
|
||||
print "\n\nPlease enter owner for this domain DNS records. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter owner for this domain DNS records. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.php:
|
||||
print "\n\nPlease enter required PHP version. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter required PHP version. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if args.ssl:
|
||||
@@ -889,7 +889,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel deleteChild --childDomain cyberpanel.net'
|
||||
|
||||
if not args.childDomain:
|
||||
print "\n\nPlease enter the child domain to delete. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the child domain to delete. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.deleteChild(args.childDomain)
|
||||
@@ -903,11 +903,11 @@ def main():
|
||||
completeCommandExample = 'cyberpanel changePHP --domainName cyberpanel.net --php 5.6'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter Domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter Domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.php:
|
||||
print "\n\nPlease enter required PHP version. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter required PHP version. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
|
||||
@@ -917,11 +917,11 @@ def main():
|
||||
completeCommandExample = 'cyberpanel changePackage --domainName cyberpanel.net --packageName CLI'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter the Domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the Domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.packageName:
|
||||
print "\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.changePackage(args.domainName, args.packageName)
|
||||
@@ -933,7 +933,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel listDNSJson --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.listDNSJson(args.domainName)
|
||||
@@ -942,7 +942,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel listDNSPretty --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.listDNSPretty(args.domainName)
|
||||
@@ -954,11 +954,11 @@ def main():
|
||||
completeCommandExample = 'cyberpanel createDNSZone --owner admin --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.owner:
|
||||
print "\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.createDNSZone(args.domainName, args.owner)
|
||||
@@ -966,7 +966,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel deleteDNSZone --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.deleteDNSZone(args.domainName)
|
||||
@@ -975,27 +975,27 @@ def main():
|
||||
' --recordType A --value 192.168.100.1 --priority 0 --ttl 3600'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.name:
|
||||
print "\n\nPlease enter the record name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the record name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.recordType:
|
||||
print "\n\nPlease enter the record type. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the record type. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.value:
|
||||
print "\n\nPlease enter the record value. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the record value. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.priority:
|
||||
print "\n\nPlease enter the priority. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the priority. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.ttl:
|
||||
print "\n\nPlease enter the ttl. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the ttl. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.createDNSRecord(args.domainName, args.name, args.recordType, args.value, args.priority, args.ttl)
|
||||
@@ -1003,7 +1003,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel deleteDNSRecord --recordID 200'
|
||||
|
||||
if not args.recordID:
|
||||
print "\n\nPlease enter the record ID to be deleted, you can find record ID by listing the current DNS records. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the record ID to be deleted, you can find record ID by listing the current DNS records. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.deleteDNSRecord(args.recordID)
|
||||
@@ -1015,7 +1015,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel createBackup --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the domain. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.createBackup(args.domainName)
|
||||
@@ -1024,7 +1024,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel restoreBackup --fileName /home/talkshosting.com/backup/backup-talksho-01-30-53-Fri-Jun-2018.tar.gz'
|
||||
|
||||
if not args.fileName:
|
||||
print "\n\nPlease enter the file name or complete path to file. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the file name or complete path to file. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.restoreBackup(args.fileName)
|
||||
@@ -1037,33 +1037,33 @@ def main():
|
||||
' --dataBases 100 --ftpAccounts 100 --allowedDomains 100'
|
||||
|
||||
if not args.owner:
|
||||
print "\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
if not args.packageName:
|
||||
print "\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
if not args.diskSpace:
|
||||
print "\n\nPlease enter value for Disk Space. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter value for Disk Space. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.bandwidth:
|
||||
print "\n\nPlease enter value for Bandwidth. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter value for Bandwidth. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.emailAccounts:
|
||||
print "\n\nPlease enter value for Email accounts. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter value for Email accounts. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.dataBases:
|
||||
print "\n\nPlease enter value for Databases. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter value for Databases. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.ftpAccounts:
|
||||
print "\n\nPlease enter value for Ftp accounts. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter value for Ftp accounts. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.allowedDomains:
|
||||
print "\n\nPlease enter value for Allowed Child Domains. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter value for Allowed Child Domains. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
|
||||
@@ -1073,7 +1073,7 @@ def main():
|
||||
elif args.function == "deletePackage":
|
||||
completeCommandExample = 'cyberpanel deletePackage --packageName CLI'
|
||||
if not args.packageName:
|
||||
print "\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the package name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.deletePackage(args.packageName)
|
||||
@@ -1090,24 +1090,24 @@ def main():
|
||||
'--dbUsername cyberpanel --dbPassword cyberpanel'
|
||||
|
||||
if not args.databaseWebsite:
|
||||
print "\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
if not args.dbName:
|
||||
print "\n\nPlease enter the database name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the database name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
if not args.dbUsername:
|
||||
print "\n\nPlease enter the database username. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the database username. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.dbPassword:
|
||||
print "\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.createDatabase(args.dbName, args.dbUsername, args.dbPassword, args.databaseWebsite)
|
||||
elif args.function == "deleteDatabase":
|
||||
completeCommandExample = 'cyberpanel deleteDatabase --dbName cyberpanel'
|
||||
if not args.dbName:
|
||||
print "\n\nPlease enter the database name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the database name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.deleteDatabase(args.dbName)
|
||||
@@ -1116,14 +1116,14 @@ def main():
|
||||
completeCommandExample = 'cyberpanel listDatabasesJson --databaseWebsite cyberpanel.net'
|
||||
|
||||
if not args.databaseWebsite:
|
||||
print "\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
cyberpanel.listDatabasesJson(args.databaseWebsite)
|
||||
elif args.function == "listDatabasesPretty":
|
||||
completeCommandExample = 'cyberpanel listDatabasesPretty --databaseWebsite cyberpanel.net'
|
||||
|
||||
if not args.databaseWebsite:
|
||||
print "\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter database website. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.listDatabasesPretty(args.databaseWebsite)
|
||||
@@ -1136,14 +1136,14 @@ def main():
|
||||
'--password cyberpanel'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
if not args.userName:
|
||||
print "\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.password:
|
||||
print "\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.createEmail(args.domainName, args.userName, args.password)
|
||||
@@ -1151,7 +1151,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel deleteEmail --email cyberpanel@cyberpanel.net'
|
||||
|
||||
if not args.email:
|
||||
print "\n\nPlease enter the email. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the email. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.deleteEmail(args.email)
|
||||
@@ -1160,11 +1160,11 @@ def main():
|
||||
completeCommandExample = 'cyberpanel changeEmailPassword --email cyberpanel@cyberpanel.net --password cyberpanel'
|
||||
|
||||
if not args.email:
|
||||
print "\n\nPlease enter email. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter email. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.password:
|
||||
print "\n\nPlease enter the password. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the password. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.changeEmailPassword(args.email, args.password)
|
||||
@@ -1172,7 +1172,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel listEmailsJson --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.listEmailsJson(args.domainName)
|
||||
@@ -1180,7 +1180,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel listEmailsPretty --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.listEmailsPretty(args.domainName)
|
||||
@@ -1193,18 +1193,18 @@ def main():
|
||||
'--password cyberpanel --owner admin'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
if not args.userName:
|
||||
print "\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.password:
|
||||
print "\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.owner:
|
||||
print "\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the owner name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.createFTPAccount(args.domainName, args.userName, args.password, args.owner)
|
||||
@@ -1212,7 +1212,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel deleteFTPAccount --userName cyberpanel'
|
||||
|
||||
if not args.userName:
|
||||
print "\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.deleteFTPAccount(args.userName)
|
||||
@@ -1221,11 +1221,11 @@ def main():
|
||||
completeCommandExample = 'cyberpanel changeFTPPassword --userName cyberpanel --password cyberpanel'
|
||||
|
||||
if not args.userName:
|
||||
print "\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the user name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
if not args.password:
|
||||
print "\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter the password for database. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.changeFTPPassword(args.userName, args.password)
|
||||
@@ -1233,7 +1233,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel listFTPJson --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.listFTPJson(args.domainName)
|
||||
@@ -1241,7 +1241,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel listFTPPretty --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.listFTPPretty(args.domainName)
|
||||
@@ -1251,7 +1251,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel issueSSL --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.issueSSL(args.domainName)
|
||||
@@ -1259,7 +1259,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel hostNameSSL --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.issueSSLForHostName(args.domainName)
|
||||
@@ -1268,7 +1268,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel mailServerSSL --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.issueSSLForMailServer(args.domainName)
|
||||
@@ -1277,7 +1277,7 @@ def main():
|
||||
completeCommandExample = 'cyberpanel issueSelfSignedSSL --domainName cyberpanel.net'
|
||||
|
||||
if not args.domainName:
|
||||
print "\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n"
|
||||
print("\n\nPlease enter Domain name. For example:\n\n" + completeCommandExample + "\n\n")
|
||||
return
|
||||
|
||||
cyberpanel.issueSelfSignedSSL(args.domainName)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.router, name='router'),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from cloudManager import CloudManager
|
||||
|
||||
from .cloudManager import CloudManager
|
||||
import json
|
||||
from loginSystem.models import Administrator
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
@@ -307,6 +307,6 @@ def router(request):
|
||||
else:
|
||||
return cm.ajaxPre(0, 'This function is not available in your version of CyberPanel.')
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
cm = CloudManager(None)
|
||||
return cm.ajaxPre(0, str(msg))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
@@ -18,12 +18,12 @@ class Container:
|
||||
length = len(Container.users)
|
||||
for items in Container.users:
|
||||
if (counter + 1) == length:
|
||||
print items + ' ' + Container.packages[counter]
|
||||
print(items + ' ' + Container.packages[counter])
|
||||
else:
|
||||
print items + ' ' + Container.packages[counter] + ' '
|
||||
print(items + ' ' + Container.packages[counter] + ' ')
|
||||
counter = counter + 1
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
|
||||
@staticmethod
|
||||
@@ -33,12 +33,12 @@ class Container:
|
||||
length = len(Container.users)
|
||||
for items in Container.packages:
|
||||
if (counter + 1) == length:
|
||||
print items
|
||||
print(items)
|
||||
else:
|
||||
print items + '\n'
|
||||
print(items + '\n')
|
||||
counter = counter + 1
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
|
||||
@staticmethod
|
||||
@@ -47,10 +47,10 @@ class Container:
|
||||
counter = 0
|
||||
for items in Container.users:
|
||||
if items == user:
|
||||
print Container.packages[counter]
|
||||
print(Container.packages[counter])
|
||||
return
|
||||
counter = counter + 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
|
||||
@staticmethod
|
||||
@@ -59,10 +59,10 @@ class Container:
|
||||
counter = 0
|
||||
for items in Container.packages:
|
||||
if items == package:
|
||||
print Container.users[counter]
|
||||
print(Container.users[counter])
|
||||
return
|
||||
counter = counter + 1
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
|
||||
@staticmethod
|
||||
@@ -88,7 +88,7 @@ class Container:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Packages successfully installed.[200]\n", 1)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
|
||||
|
||||
def main():
|
||||
|
||||
@@ -43,7 +43,7 @@ class ContainerManager(multi.Thread):
|
||||
self.addTrafficController()
|
||||
elif self.function == 'removeLimits':
|
||||
self.removeLimits()
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + ' [ContainerManager.run]')
|
||||
|
||||
@staticmethod
|
||||
@@ -78,7 +78,7 @@ class ContainerManager(multi.Thread):
|
||||
ioConf = ioConf.replace('{net_cls}', str(net_cls))
|
||||
|
||||
return ioConf
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@@ -124,11 +124,11 @@ class ContainerManager(multi.Thread):
|
||||
1)
|
||||
return 0
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/containerization/container.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/containerization/container.py"
|
||||
execPath = execPath + " --function submitContainerInstall"
|
||||
ProcessUtilities.outputExecutioner(execPath)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
|
||||
|
||||
def restartServices(self):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
from websiteFunctions.models import Websites
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.cHome, name='cHome'),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.shortcuts import HttpResponse, redirect
|
||||
from loginSystem.views import loadLoginPage
|
||||
from containerManager import ContainerManager
|
||||
from .containerManager import ContainerManager
|
||||
import json
|
||||
from websiteFunctions.models import Websites
|
||||
from .models import ContainerLimits
|
||||
@@ -42,7 +42,7 @@ def submitContainerInstall(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -117,7 +117,7 @@ def fetchWebsiteLimits(request):
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -264,7 +264,7 @@ def saveWebsiteLimits(request):
|
||||
json_data = json.dumps(finalData)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -333,7 +333,7 @@ def getUsageData(request):
|
||||
finalData['writeRate'] = 0
|
||||
except:
|
||||
command = "top -b -n 1 -u " + website.externalApp + " | awk 'NR>7 { sum += $9; } END { print sum; }'"
|
||||
output = str(subprocess.check_output(command, shell=True))
|
||||
output = str(subprocess.check_output(command, shell=True).decode("utf-8"))
|
||||
|
||||
finalData = {}
|
||||
finalData['status'] = 1
|
||||
@@ -345,7 +345,7 @@ def getUsageData(request):
|
||||
final_json = json.dumps(finalData)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg), 'cpu': 0, 'memory':0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
513
cyberpanel.sh
513
cyberpanel.sh
@@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
#CyberPanel installer script for Ubuntu 18.04 and CentOS 7.X
|
||||
|
||||
DEV="OFF"
|
||||
BRANCH="stable"
|
||||
POSTFIX_VARIABLE="ON"
|
||||
POWERDNS_VARIABLE="ON"
|
||||
PUREFTPD_VARIABLE="ON"
|
||||
@@ -19,6 +20,101 @@ ADMIN_PASS="1234567"
|
||||
MEMCACHED="ON"
|
||||
REDIS="ON"
|
||||
TOTAL_RAM=$(free -m | awk '/Mem\:/ { print $2 }')
|
||||
CENTOS_8="False"
|
||||
WATCHDOG="OFF"
|
||||
|
||||
watchdog_setup() {
|
||||
if [[ $WATCHDOG == "ON" ]] ; then
|
||||
wget -O /etc/cyberpanel/watchdog.sh https://$DOWNLOAD_SERVER/misc/watchdog.sh
|
||||
chmod +x /etc/cyberpanel/watchdog.sh
|
||||
ln -s /etc/cyberpanel/watchdog.sh /usr/local/bin/watchdog
|
||||
pid=$(ps aux | grep "watchdog lsws" | grep -v grep | awk '{print $2}')
|
||||
if [[ "$pid" == "" ]] ; then
|
||||
nohup watchdog lsws > /dev/null 2>&1 &
|
||||
fi
|
||||
echo -e "Checking MariaDB ..."
|
||||
pid=$(ps aux | grep "watchdog mariadb" | grep -v grep | awk '{print $2}')
|
||||
if [[ "$pid" == "" ]] ; then
|
||||
nohup watchdog mariadb > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
echo "nohup watchdog lsws > /dev/null 2>&1 &
|
||||
nohup watchdog mariadb > /dev/null 2>&1 &" >> /etc/rc.d/rc.local
|
||||
else
|
||||
echo "nohup watchdog lsws > /dev/null 2>&1 &
|
||||
nohup watchdog mariadb > /dev/null 2>&1 &" >> /etc/rc.local
|
||||
fi
|
||||
echo -e "\n Setting up WatchDog..."
|
||||
fi
|
||||
}
|
||||
|
||||
webadmin_passwd() {
|
||||
if [[ $VERSION == "OLS" ]] ; then
|
||||
php_command="admin_php"
|
||||
else
|
||||
php_command="admin_php5"
|
||||
fi
|
||||
|
||||
WEBADMIN_PASS=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 ; echo '')
|
||||
TEMP=`/usr/local/lsws/admin/fcgi-bin/${php_command} /usr/local/lsws/admin/misc/htpasswd.php ${WEBADMIN_PASS}`
|
||||
echo "" > /usr/local/lsws/admin/conf/htpasswd
|
||||
echo "admin:$TEMP" > /usr/local/lsws/admin/conf/htpasswd
|
||||
echo ${WEBADMIN_PASS} > /etc/cyberpanel/webadmin_passwd
|
||||
}
|
||||
|
||||
check_virtualization() {
|
||||
echo -e "Checking virtualization type..."
|
||||
if hostnamectl | grep "Virtualization: lxc" ; then
|
||||
echo -e "\nLXC detected..."
|
||||
echo -e "CyberPanel does not support LXC"
|
||||
echo -e "Exiting..."
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
license_validation() {
|
||||
CURRENT_DIR=$(pwd)
|
||||
|
||||
if [ -f /root/cyberpanel-tmp ] ; then
|
||||
rm -rf /root/cyberpanel-tmp
|
||||
fi
|
||||
|
||||
mkdir /root/cyberpanel-tmp
|
||||
cd /root/cyberpanel-tmp
|
||||
wget -q https://$DOWNLOAD_SERVER/litespeed/lsws-$LSWS_STABLE_VER-ent-x86_64-linux.tar.gz
|
||||
tar xzvf lsws-$LSWS_STABLE_VER-ent-x86_64-linux.tar.gz > /dev/null
|
||||
cd /root/cyberpanel-tmp/lsws-$LSWS_STABLE_VER/conf
|
||||
if [[ $LICENSE_KEY == "TRIAL" ]] ; then
|
||||
wget -q http://license.litespeedtech.com/reseller/trial.key
|
||||
sed -i "s|writeSerial = open('lsws-5.4.2/serial.no', 'w')|command = 'wget -q --output-document=./lsws-$LSWS_STABLE_VER/trial.key http://license.litespeedtech.com/reseller/trial.key'|g" $CURRENT_DIR/installCyberPanel.py
|
||||
sed -i 's|writeSerial.writelines(self.serial)|subprocess.call(command, shell=True)|g' $CURRENT_DIR/installCyberPanel.py
|
||||
sed -i 's|writeSerial.close()||g' $CURRENT_DIR/installCyberPanel.py
|
||||
else
|
||||
echo $LICENSE_KEY > serial.no
|
||||
fi
|
||||
|
||||
cd /root/cyberpanel-tmp/lsws-$LSWS_STABLE_VER/bin
|
||||
|
||||
if [[ $LICENSE_KEY == "TRIAL" ]] ; then
|
||||
if ./lshttpd -V |& grep "ERROR" ; then
|
||||
echo -e "\n\nIt apeears to have some issue with license , please check above result..."
|
||||
exit
|
||||
fi
|
||||
LICENSE_KEY="1111-2222-3333-4444"
|
||||
else
|
||||
if ./lshttpd -r |& grep "ERROR" ; then
|
||||
./lshttpd -r
|
||||
echo -e "\n\nIt apeears to have some issue with license , please check above result..."
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
echo -e "License seems valid..."
|
||||
cd /root/cyberpanel-tmp
|
||||
rm -rf lsws-$LSWS_STABLE_VER*
|
||||
cd $CURRENT_DIR
|
||||
rm -rf /root/cyberpanel-tmp
|
||||
}
|
||||
|
||||
special_change(){
|
||||
sed -i 's|cyberpanel.sh|'$DOWNLOAD_SERVER'|g' install.py
|
||||
@@ -27,6 +123,35 @@ sed -i 's|git clone https://github.com/usmannasir/cyberpanel|echo downloaded|g'
|
||||
#change to CDN first, regardless country
|
||||
sed -i 's|http://|https://|g' install.py
|
||||
|
||||
if ! grep -q "1.1.1.1" /etc/resolv.conf ; then
|
||||
echo -e "\nnameserver 1.1.1.1" >> /etc/resolv.conf
|
||||
fi
|
||||
if ! grep -q "8.8.8.8" /etc/resolv.conf ; then
|
||||
echo -e "\nnameserver 8.8.8.8" >> /etc/resolv.conf
|
||||
fi
|
||||
cp /etc/resolv.conf /etc/resolv.conf-tmp
|
||||
|
||||
line1="$(grep -n "f.write('nameserver 8.8.8.8')" installCyberPanel.py | head -n 1 | cut -d: -f1)"
|
||||
sed -i "${line1}i\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ subprocess.call(command, shell=True)" installCyberPanel.py
|
||||
sed -i "${line1}i\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ command = 'cat /etc/resolv.conf-tmp > /etc/resolv.conf'" installCyberPanel.py
|
||||
|
||||
LATEST_URL="https://update.litespeedtech.com/ws/latest.php"
|
||||
#LATEST_URL="https://cyberpanel.sh/latest.php"
|
||||
curl --silent -o /tmp/lsws_latest $LATEST_URL 2>/dev/null
|
||||
LSWS_STABLE_LINE=`cat /tmp/lsws_latest | grep LSWS_STABLE`
|
||||
LSWS_STABLE_VER=`expr "$LSWS_STABLE_LINE" : '.*LSWS_STABLE=\(.*\) BUILD .*'`
|
||||
|
||||
if [[ $PROVIDER == "Alibaba Cloud" ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then
|
||||
mkdir /root/.config
|
||||
mkdir /root/.config/pip
|
||||
cat << EOF > /root/.config/pip/pip.conf
|
||||
[global]
|
||||
index-url = https://mirrors.aliyun.com/pypi/simple/
|
||||
EOF
|
||||
echo -e "\nSet to Aliyun pip repo..."
|
||||
fi
|
||||
#seems Alibaba cloud , other than CN , also requires change on ubuntu.
|
||||
|
||||
if [[ $SERVER_COUNTRY == "CN" ]] ; then
|
||||
#line1="$(grep -n "github.com/usmannasir/cyberpanel" install.py | head -n 1 | cut -d: -f1)"
|
||||
#line2=$((line1 - 1))
|
||||
@@ -37,15 +162,18 @@ if [[ $SERVER_COUNTRY == "CN" ]] ; then
|
||||
sed -i 's|wget https://rpms.litespeedtech.com/debian/|wget --no-check-certificate https://rpms.litespeedtech.com/debian/|g' install.py
|
||||
sed -i 's|https://repo.powerdns.com/repo-files/centos-auth-42.repo|https://'$DOWNLOAD_SERVER'/powerdns/powerdns.repo|g' installCyberPanel.py
|
||||
sed -i 's|https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip|https://'$DOWNLOAD_SERVER'/misc/rainloop-community-latest.zip|g' install.py
|
||||
sed -i 's|cmd.append("rpm")|command = '"'"'curl -o /etc/yum.repos.d/litespeed.repo https://'$DOWNLOAD_SERVER'/litespeed/litespeed.repo'"'"'|g' install.py
|
||||
sed -i 's|cmd.append("-ivh")|cmd = shlex.split(command)|g' install.py
|
||||
sed -i 's|cmd.append("https://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm")||g' install.py
|
||||
|
||||
sed -i 's|rpm -ivh https://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm|curl -o /etc/yum.repos.d/litespeed.repo https://'$DOWNLOAD_SERVER'/litespeed/litespeed.repo|g' install.py
|
||||
|
||||
|
||||
sed -i 's|https://copr.fedorainfracloud.org/coprs/copart/restic/repo/epel-7/copart-restic-epel-7.repo|https://'$DOWNLOAD_SERVER'/restic/restic.repo|g' install.py
|
||||
|
||||
sed -i 's|yum -y install https://cyberpanel.sh/gf-release-latest.gf.el7.noarch.rpm|wget -O /etc/yum.repos.d/gf.repo https://'$DOWNLOAD_SERVER'/gf-plus/gf.repo|g' install.py
|
||||
sed -i 's|dovecot-2.3-latest|dovecot-2.3-latest-mirror|g' install.py
|
||||
sed -i 's|git clone https://github.com/usmannasir/cyberpanel|wget https://cyberpanel.sh/cyberpanel-git.tar.gz \&\& tar xzvf cyberpanel-git.tar.gz|g' install.py
|
||||
sed -i 's|https://repo.dovecot.org/ce-2.3-latest/centos/$releasever/RPMS/$basearch|https://'$DOWNLOAD_SERVER'/dovecot/|g' install.py
|
||||
sed -i 's|'$DOWNLOAD_SERVER'|cyberpanel.sh|g' install.py
|
||||
|
||||
sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.4.2-ent-x86_64-linux.tar.gz|https://'$DOWNLOAD_SERVER'/litespeed/lsws-'$LSWS_STABLE_VER'-ent-x86_64-linux.tar.gz|g' installCyberPanel.py
|
||||
# global change for CN , regardless provider and system
|
||||
|
||||
if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
@@ -59,10 +187,11 @@ gpgcheck = 1" > MariaDB.repo
|
||||
#above to set mariadb db to Tsinghua repo
|
||||
cd $DIR
|
||||
sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz|https://cyberpanel.sh/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz|g' installCyberPanel.py
|
||||
mkdir /root/.pip
|
||||
cat << EOF > /root/.pip/pip.conf
|
||||
mkdir /root/.config
|
||||
mkdir /root/.config/pip
|
||||
cat << EOF > /root/.config/pip/pip.conf
|
||||
[global]
|
||||
index-url = https://mirrors.aliyun.com/pypi/simple/
|
||||
index-url = https://mirrors.aliyun.com/pypi/simple/
|
||||
EOF
|
||||
echo -e "\nSet to Aliyun pip repo..."
|
||||
cat << EOF > composer.sh
|
||||
@@ -94,7 +223,7 @@ echo '{
|
||||
"repositories": {
|
||||
"packagist": {
|
||||
"type": "composer",
|
||||
"url": "https://packagist.phpcomposer.com"
|
||||
"url": "https://mirrors.aliyun.com/composer/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,9 +237,11 @@ EOF
|
||||
echo $'\n89.208.248.38 rpms.litespeedtech.com\n' >> /etc/hosts
|
||||
echo -e "Mirror server set..."
|
||||
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
|
||||
cat << EOF > /root/.pip/pip.conf
|
||||
mkdir /root/.config
|
||||
mkdir /root/.config/pip
|
||||
cat << EOF > /root/.config/pip/pip.conf
|
||||
[global]
|
||||
index-url = https://mirrors.aliyun.com/pypi/simple/
|
||||
index-url = https://mirrors.aliyun.com/pypi/simple/
|
||||
EOF
|
||||
echo -e "\nSet to Aliyun pip repo..."
|
||||
if [[ $PROVIDER == "Tencent Cloud" ]] ; then
|
||||
@@ -246,18 +377,23 @@ TOTAL_SWAP=$(free -m | awk '/^Swap:/ { print $2 }')
|
||||
SET_SWAP=$((TOTAL_RAM - TOTAL_SWAP))
|
||||
SWAP_FILE=/cyberpanel.swap
|
||||
|
||||
if [[ ! -f $SWAP_FILE ]] ; then
|
||||
if [ ! -f $SWAP_FILE ] ; then
|
||||
if [[ $TOTAL_SWAP -gt $TOTAL_RAM ]] || [[ $TOTAL_SWAP -eq $TOTAL_RAM ]] ; then
|
||||
echo "SWAP check..."
|
||||
else
|
||||
fallocate --length ${SET_SWAP}MiB $SWAP_FILE
|
||||
chmod 600 $SWAP_FILE
|
||||
mkswap $SWAP_FILE
|
||||
swapon $SWAP_FILE
|
||||
echo "${SWAP_FILE} swap swap sw 0 0" | sudo tee -a /etc/fstab
|
||||
sysctl vm.swappiness=10
|
||||
echo "vm.swappiness = 10" >> /etc/sysctl.conf
|
||||
echo "SWAP set..."
|
||||
if [[ $SET_SWAP -gt "2049" ]] ; then
|
||||
SET_SWAP="2048"
|
||||
else
|
||||
echo "Checking SWAP..."
|
||||
fi
|
||||
fallocate --length ${SET_SWAP}MiB $SWAP_FILE
|
||||
chmod 600 $SWAP_FILE
|
||||
mkswap $SWAP_FILE
|
||||
swapon $SWAP_FILE
|
||||
echo "${SWAP_FILE} swap swap sw 0 0" | sudo tee -a /etc/fstab
|
||||
sysctl vm.swappiness=10
|
||||
echo "vm.swappiness = 10" >> /etc/sysctl.conf
|
||||
echo "SWAP set..."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -272,45 +408,74 @@ if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
|
||||
rpm --import https://$DOWNLOAD_SERVER/gf-plus/RPM-GPG-KEY-gf.el7
|
||||
rpm --import https://repo.dovecot.org/DOVECOT-REPO-GPG
|
||||
rpm --import https://copr-be.cloud.fedoraproject.org/results/copart/restic/pubkey.gpg
|
||||
yum clean all
|
||||
yum update -y
|
||||
yum autoremove epel-release -y
|
||||
rm -f /etc/yum.repos.d/epel.repo
|
||||
rm -f /etc/yum.repos.d/epel.repo.rpmsave
|
||||
yum clean all
|
||||
yum update -y
|
||||
yum install epel-release -y
|
||||
yum install -y wget htop telnet curl which bc telnet htop libevent-devel gcc python-devel libattr-devel xz-devel gpgme-devel mariadb-devel curl-devel python-pip git
|
||||
|
||||
if [[ $CENTOS_8 == "False" ]] ; then
|
||||
yum install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc python-devel libattr-devel xz-devel gpgme-devel mariadb-devel curl-devel python-pip git
|
||||
fi
|
||||
if [[ $CENTOS_8 == "True" ]] ; then
|
||||
yum install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git platform-python-devel tar
|
||||
dnf --enablerepo=PowerTools install gpgme-devel -y
|
||||
fi
|
||||
|
||||
if [[ $DEV == "ON" ]] ; then
|
||||
if [[ $CENTOS_8 == "False" ]] ; then
|
||||
yum -y install yum-utils
|
||||
yum -y groupinstall development
|
||||
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
|
||||
yum -y install python36u python36u-pip python36u-devel
|
||||
fi
|
||||
if [[ $CENTOS_8 == "True" ]] ; then
|
||||
dnf install python3 -y
|
||||
fi
|
||||
pip3.6 install virtualenv
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $SERVER_OS == "Ubuntu" ]] ; then
|
||||
apt update -y
|
||||
DEBIAN_FRONTEND=noninteractive apt upgrade -y
|
||||
DEBIAN_FRONTEND=noninteracitve apt install -y htop telnet python-mysqldb python-dev libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev python-gpg python python-minimal python-setuptools virtualenv python-dev python-pip git
|
||||
if [[ $DEV == "ON" ]] ; then
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y python3-pip
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y build-essential libssl-dev libffi-dev python3-dev
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y python3-venv
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
memcached_installation() {
|
||||
if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
yum install -y lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached lsphp56-pecl-memcached lsphp55-pecl-memcached lsphp54-pecl-memcached
|
||||
yum install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached lsphp56-pecl-memcached lsphp55-pecl-memcached lsphp54-pecl-memcached
|
||||
if [[ $TOTAL_RAM -eq "2048" ]] || [[ $TOTAL_RAM -gt "2048" ]] ; then
|
||||
yum groupinstall "Development Tools" -y
|
||||
yum install autoconf automake zlib-devel openssl-devel expat-devel pcre-devel libmemcached-devel cyrus-sasl* -y
|
||||
wget https://$DOWNLOAD_SERVER/litespeed/lsmcd.tar.gz
|
||||
tar xzvf lsmcd.tar.gz
|
||||
cd lsmcd
|
||||
DIR=$(pwd)
|
||||
cd $DIR/lsmcd
|
||||
./fixtimestamp.sh
|
||||
./configure CFLAGS=" -O3" CXXFLAGS=" -O3"
|
||||
make
|
||||
make install
|
||||
systemctl enable lsmcd
|
||||
systemctl start lsmcd
|
||||
cd $DIR
|
||||
else
|
||||
yum install -y memcached
|
||||
sed -i 's|OPTIONS=""|OPTIONS="-l 127.0.0.1 -U 0"|g' /etc/sysconfig/memcached
|
||||
systemctl enable memcached
|
||||
systemctl start memcached
|
||||
fi
|
||||
fi
|
||||
if [[ $SERVER_OS == "Ubuntu" ]] ; then
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached
|
||||
if [[ $TOTAL_RAM -eq "2048" ]] || [[ $TOTAL_RAM -gt "2048" ]] ; then
|
||||
DEBIAN_FRONTEND=noninteractive apt install build-essential zlib1g-dev libexpat1-dev openssl libssl-dev libsasl2-dev libpcre3-dev git -y
|
||||
wget https://$DOWNLOAD/litespeed/lsmcd.tar.gz
|
||||
@@ -343,10 +508,10 @@ fi
|
||||
|
||||
redis_installation() {
|
||||
if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
yum install -y lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis lsphp56-redis lsphp55-redis lsphp54-redis redis
|
||||
yum install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis lsphp56-redis lsphp55-redis lsphp54-redis redis
|
||||
fi
|
||||
if [[ $SERVER_OS == "Ubuntu" ]] ; then
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis redis
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis redis
|
||||
fi
|
||||
|
||||
if ifconfig -a | grep inet6 ; then
|
||||
@@ -371,23 +536,30 @@ if ps -aux | grep "redis" | grep -v grep ; then
|
||||
fi
|
||||
}
|
||||
|
||||
check_provider()
|
||||
{
|
||||
if [ "$(cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" = 'EC2' ] && [ -d /home/ubuntu ]; then
|
||||
PROVIDER='Amazon Web Service'
|
||||
elif [ "$(dmidecode -s bios-vendor)" = 'Google' ];then
|
||||
PROVIDER='Google Cloud Platform'
|
||||
elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ];then
|
||||
PROVIDER='Digital Ocean'
|
||||
elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ];then
|
||||
PROVIDER='Alibaba Cloud'
|
||||
elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then
|
||||
PROVIDER='Microsoft Azure'
|
||||
elif [[ -d /usr/local/qcloud ]]; then
|
||||
PROVIDER='Tencent Cloud'
|
||||
check_provider() {
|
||||
|
||||
if hash dmidecode > /dev/null 2>&1 ; then
|
||||
if [ "$(dmidecode -s bios-vendor)" = 'Google' ] ; then
|
||||
PROVIDER='Google Cloud Platform'
|
||||
elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ] ; then
|
||||
PROVIDER='Digital Ocean'
|
||||
elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ] ; then
|
||||
PROVIDER='Alibaba Cloud'
|
||||
elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ] ; then
|
||||
PROVIDER='Microsoft Azure'
|
||||
elif [ -d /usr/local/qcloud ] ; then
|
||||
PROVIDER='Tencent Cloud'
|
||||
else
|
||||
PROVIDER='undefined'
|
||||
fi
|
||||
else
|
||||
PROVIDER='undefined'
|
||||
PROVIDER='undefined'
|
||||
fi
|
||||
|
||||
if [ "$(cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" = 'EC2' ] && [ -d /home/ubuntu ]; then
|
||||
PROVIDER='Amazon Web Service'
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -400,18 +572,23 @@ if echo $OUTPUT | grep -q "CentOS Linux 7" ; then
|
||||
elif echo $OUTPUT | grep -q "CloudLinux 7" ; then
|
||||
echo -e "\nDetecting CloudLinux 7.X...\n"
|
||||
SERVER_OS="CentOS"
|
||||
elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then
|
||||
echo -e "\nDetecting CentOS 8.X...\n"
|
||||
SERVER_OS="CentOS"
|
||||
CENTOS_8="True"
|
||||
elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then
|
||||
echo -e "\nDetecting Ubuntu 18.04...\n"
|
||||
SERVER_OS="Ubuntu"
|
||||
else
|
||||
cat /etc/*release
|
||||
echo -e "\nUnable to detect your OS...\n"
|
||||
echo -e "\nCyberPanel is supported on Ubuntu 18.04, CentOS 7.x and CloudLinux 7.x...\n"
|
||||
echo -e "\nCyberPanel is supported on Ubuntu 18.04, CentOS 7.x, CentOS 8.x and CloudLinux 7.x...\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_root() {
|
||||
echo -e "Checking root privileges...\n"
|
||||
echo -e "\nChecking root privileges...\n"
|
||||
if [[ $(id -u) != 0 ]] > /dev/null; then
|
||||
echo -e "You must use root account to do this"
|
||||
echo -e "or run following command: (do NOT miss the quotes)"
|
||||
@@ -477,9 +654,9 @@ echo -e "\n This will install everything default , which is OpenLiteSpeed and no
|
||||
|
||||
license_input() {
|
||||
VERSION="ENT"
|
||||
SERIAL_NO="--ent ent --serial "
|
||||
echo -e "\nPlease note that your server has \e[31m$TOTAL_RAM\e[39m RAM"
|
||||
echo -e "If you are using \e[31mFree Start\e[39m license, It will not start due to \e[31m2GB RAM limit\e[39m.\n"
|
||||
echo -e "If you do not have any license, you can also use trial license (if server has not used trial license before), type \e[31mTRIAL\e[39m\n"
|
||||
|
||||
printf "%s" "Please input your serial number for LiteSpeed WebServer Enterprise:"
|
||||
read LICENSE_KEY
|
||||
@@ -502,23 +679,26 @@ TMP2=$(echo $LICENSE_KEY | cut -c10)
|
||||
TMP3=$(echo $LICENSE_KEY | cut -c15)
|
||||
|
||||
if [[ $TMP == "-" ]] && [[ $TMP2 == "-" ]] && [[ $TMP3 == "-" ]] && [[ $KEY_SIZE == "19" ]] ; then
|
||||
echo -e "License key set..."
|
||||
echo -e "\nLicense key set..."
|
||||
elif [[ $LICENSE_KEY == "trial" ]] || [[ $LICENSE_KEY == "TRIAL" ]] || [[ $LICENSE_KEY == "Trial" ]] ; then
|
||||
echo -e "\nTrial license set..."
|
||||
LICENSE_KEY="TRIAL"
|
||||
else
|
||||
echo -e "\nLicense key seems incorrect, please verify\n"
|
||||
echo -e "\nIf you are copying/pasting, please make sure you didn't paste blank space...\n"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
interactive_mode() {
|
||||
echo -e " CyberPanel Installer v$CP_VER1$CP_VER2
|
||||
|
||||
1. Install CyberPanel.
|
||||
|
||||
|
||||
2. Addons and Miscellaneous
|
||||
|
||||
|
||||
3. Exit.
|
||||
|
||||
|
||||
"
|
||||
read -p " Please enter the number[1-3]: " num
|
||||
echo ""
|
||||
@@ -548,14 +728,14 @@ fi
|
||||
echo -e " CyberPanel Addons v$CP_VER1$CP_VER2
|
||||
|
||||
1. Install Memcached extension and backend
|
||||
|
||||
|
||||
2. Install Redis extension and backend
|
||||
|
||||
|
||||
3. Return to main page.
|
||||
|
||||
|
||||
4. Exit
|
||||
"
|
||||
|
||||
|
||||
echo && read -p "Please enter the number[1-4]: " num
|
||||
case "$num" in
|
||||
1)
|
||||
@@ -584,16 +764,16 @@ DISK=$(df -h | awk '$NF=="/"{printf "%d/%dGB (%s)\n", $3,$2,$5}')
|
||||
#clear
|
||||
echo -e " CyberPanel Installer v$CP_VER1$CP_VER2
|
||||
|
||||
RAM check : $RAM
|
||||
|
||||
RAM check : $RAM
|
||||
|
||||
Disk check : $DISK (Minimal \e[31m10GB\e[39m free space)
|
||||
|
||||
1. Install CyberPanel with \e[31mOpenLiteSpeed\e[39m.
|
||||
|
||||
|
||||
2. Install Cyberpanel with \e[31mLiteSpeed Enterprise\e[39m.
|
||||
|
||||
|
||||
3. Exit.
|
||||
|
||||
|
||||
"
|
||||
read -p " Please enter the number[1-3]: " num
|
||||
echo ""
|
||||
@@ -613,7 +793,7 @@ case "$num" in
|
||||
;;
|
||||
esac
|
||||
|
||||
<<COMMENT
|
||||
|
||||
echo -e "\nInstall minimal service for CyberPanel? This will skip PowerDNS, Postfix and Pure-FTPd."
|
||||
printf "%s" "Minimal installation [y/N]: "
|
||||
read TMP_YN
|
||||
@@ -645,9 +825,40 @@ else
|
||||
PUREFTPD_VARIABLE="ON"
|
||||
fi
|
||||
fi
|
||||
COMMENT
|
||||
|
||||
#above comment for future use
|
||||
|
||||
#if [[ $DEV_ARG == "ON" ]] ; then
|
||||
#echo -e "Press \e[31mEnter\e[39m to continue with stable version of CyberPanel, or"
|
||||
#echo -e "\nPlease enter \e[31mbeta\e[39m and then press \e[31mEnter\e[39m to install CyberPanel with Python 3."
|
||||
#echo -e "\nCentOS 8 will autoamtically proceed with Python 3 branch."
|
||||
#printf "%s" ""
|
||||
#read TMP_YN
|
||||
|
||||
DEV="ON"
|
||||
BRANCH_NAME="p3"
|
||||
echo -e "Branch name set to $BRANCH_NAME"
|
||||
|
||||
#if [[ $TMP_YN == "beta" ]] ; then
|
||||
# DEV="ON"
|
||||
## echo -e "\nPlease specify branch name"
|
||||
## printf "%s" ""
|
||||
## read TMP_YN
|
||||
# BRANCH_NAME="p3"
|
||||
# echo -e "Branch name set to $BRANCH_NAME"
|
||||
#else
|
||||
# DEV="OFF"
|
||||
#
|
||||
# if [[ $CENTOS_8 == "True" ]] ; then
|
||||
# DEV="ON"
|
||||
# BRANCH_NAME="p3"
|
||||
# fi
|
||||
#fi
|
||||
|
||||
|
||||
|
||||
#fi
|
||||
|
||||
echo -e "\nPlease choose to use default admin password \e[31m1234567\e[39m, randomly generate one \e[31m(recommended)\e[39m or specify the admin password?"
|
||||
printf "%s" "Choose [d]fault, [r]andom or [s]et password: [d/r/s] "
|
||||
read TMP_YN
|
||||
@@ -707,6 +918,18 @@ if [[ $TMP_YN =~ ^(no|n|N) ]] ; then
|
||||
else
|
||||
REDIS="ON"
|
||||
fi
|
||||
|
||||
echo -e "\nWould you like to set up a WatchDog \e[31m(beta)\e[39m for Web service and Database service ?"
|
||||
echo -e "The watchdog script will be automatically started up after installation and server reboot"
|
||||
echo -e "If you want to kill the watchdog , run \e[31mwatchdog kill\e[39m"
|
||||
echo -e "Please type Yes or no (with captical \e[31mY\e[39m):"
|
||||
printf "%s"
|
||||
read TMP_YN
|
||||
if [[ $TMP_YN == "Yes" ]] ; then
|
||||
WATCHDOG="ON"
|
||||
else
|
||||
WATCHDOG="OFF"
|
||||
fi
|
||||
}
|
||||
|
||||
main_install() {
|
||||
@@ -715,20 +938,34 @@ if [[ -e /usr/local/CyberCP ]] ; then
|
||||
echo -e "\n CyberPanel already installed, exiting..."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
special_change
|
||||
|
||||
if [[ $VERSION == "ENT" ]] ; then
|
||||
echo -e "\nValidating the license..."
|
||||
echo -e "\nThis may take a minute..."
|
||||
echo -e "\nplease be patient...\n\n"
|
||||
license_validation
|
||||
SERIAL_NO="--ent ent --serial "
|
||||
fi
|
||||
|
||||
sed -i 's|lsws-5.4.2|lsws-'$LSWS_STABLE_VER'|g' installCyberPanel.py
|
||||
sed -i 's|lsws-5.3.5|lsws-'$LSWS_STABLE_VER'|g' installCyberPanel.py
|
||||
#this sed must be done after license validation
|
||||
|
||||
echo -e "Preparing..."
|
||||
echo -e "Installation will start in 10 seconds, if you wish to stop please press CTRL + C"
|
||||
sleep 10
|
||||
debug="1"
|
||||
if [[ $debug == "0" ]] ; then
|
||||
echo "/usr/local/CyberPanel/bin/python2 install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY"
|
||||
echo "/usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $debug == "1" ]] ; then
|
||||
/usr/local/CyberPanel/bin/python2 install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY
|
||||
if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then
|
||||
/usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE
|
||||
|
||||
if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then
|
||||
echo -e "\nCyberPanel installation sucessfully completed..."
|
||||
else
|
||||
echo -e "Oops, something went wrong..."
|
||||
@@ -746,12 +983,13 @@ fi
|
||||
}
|
||||
|
||||
pip_virtualenv() {
|
||||
|
||||
if [[ $DEV == "OFF" ]] ; then
|
||||
if [[ $SERVER_COUNTRY == "CN" ]] ; then
|
||||
mkdir /root/.pip
|
||||
cat << EOF > /root/.pip/pip.conf
|
||||
mkdir /root/.config
|
||||
mkdir /root/.config/pip
|
||||
cat << EOF > /root/.config/pip/pip.conf
|
||||
[global]
|
||||
index-url = https://mirrors.aliyun.com/pypi/simple/
|
||||
index-url = https://mirrors.aliyun.com/pypi/simple/
|
||||
EOF
|
||||
fi
|
||||
|
||||
@@ -767,6 +1005,23 @@ rm -rf requirements.txt
|
||||
wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/1.8.0/requirments.txt
|
||||
pip install --ignore-installed -r requirements.txt
|
||||
virtualenv --system-site-packages /usr/local/CyberPanel
|
||||
fi
|
||||
|
||||
if [[ $DEV == "ON" ]] ; then
|
||||
#install dev branch
|
||||
#wget https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt
|
||||
cd /usr/local/
|
||||
virtualenv -p /usr/bin/python3 CyberPanel
|
||||
source /usr/local/CyberPanel/bin/activate
|
||||
wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt
|
||||
pip3.6 install --ignore-installed -r requirements.txt
|
||||
cd -
|
||||
fi
|
||||
|
||||
if [ -f requirements.txt ] && [ -d cyberpanel ] ; then
|
||||
rm -rf cyberpanel
|
||||
rm -f requirements.txt
|
||||
fi
|
||||
|
||||
if [[ $SERVER_COUNTRY == "CN" ]] ; then
|
||||
wget https://cyberpanel.sh/cyberpanel-git.tar.gz
|
||||
@@ -774,13 +1029,20 @@ if [[ $SERVER_COUNTRY == "CN" ]] ; then
|
||||
cp -r cyberpanel /usr/local/cyberpanel
|
||||
cd cyberpanel/install
|
||||
else
|
||||
if [[ $DEV == "ON" ]] ; then
|
||||
git clone https://github.com/usmannasir/cyberpanel
|
||||
cd cyberpanel
|
||||
git checkout $BRANCH_NAME
|
||||
cd -
|
||||
cp -r cyberpanel /usr/local/cyberpanel
|
||||
cd cyberpanel/install
|
||||
else
|
||||
git clone https://github.com/usmannasir/cyberpanel
|
||||
cp -r cyberpanel /usr/local/cyberpanel
|
||||
cd cyberpanel/install
|
||||
fi
|
||||
fi
|
||||
|
||||
curl https://cyberpanel.sh/?version
|
||||
|
||||
}
|
||||
|
||||
after_install() {
|
||||
@@ -794,13 +1056,33 @@ fi
|
||||
|
||||
chmod 1733 /var/lib/php/session
|
||||
|
||||
if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then
|
||||
if grep "\[ERROR\] We are not able to run ./install.sh return code: 1. Fatal error, see /var/log/installLogs.txt for full details" /var/log/installLogs.txt > /dev/null; then
|
||||
cd ${DIR}/cyberpanel/install/lsws-*
|
||||
./install.sh
|
||||
echo -e "\n\n\nIt seems LiteSpeed Enterprise has failed to install, please check your license key is valid"
|
||||
echo -e "\nIf this license key has been used before, you may need to go to store to release it first."
|
||||
exit
|
||||
fi
|
||||
|
||||
for version in $(ls /usr/local/lsws | grep lsphp);
|
||||
|
||||
if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then
|
||||
|
||||
if [[ $DEV == "ON" ]] ; then
|
||||
virtualenv -p /usr/bin/python3 /usr/local/CyberCP
|
||||
source /usr/local/CyberCP/bin/activate
|
||||
wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt
|
||||
pip3.6 install --ignore-installed -r requirements.txt
|
||||
systemctl restart lscpd
|
||||
fi
|
||||
|
||||
for version in $(ls /usr/local/lsws | grep lsphp);
|
||||
do
|
||||
php_ini=$(find /usr/local/lsws/$version/ -name php.ini)
|
||||
version2=${version:5:2}
|
||||
version2=$(awk "BEGIN { print "${version2}/10" }")
|
||||
if [[ $version2 = "7" ]] ; then
|
||||
version2="7.0"
|
||||
fi
|
||||
if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
yum remove -y $version-mysql
|
||||
yum install -y $version-mysqlnd
|
||||
@@ -808,7 +1090,7 @@ for version in $(ls /usr/local/lsws | grep lsphp);
|
||||
if [[ ! -d /usr/local/lsws/$version/tmp ]] ; then
|
||||
mkdir /usr/local/lsws/$version/tmp
|
||||
fi
|
||||
/usr/local/lsws/${version}/bin/pecl channel-update pecl.php.net;
|
||||
/usr/local/lsws/${version}/bin/pecl channel-update pecl.php.net;
|
||||
/usr/local/lsws/${version}/bin/pear config-set temp_dir /usr/local/lsws/${version}/tmp
|
||||
/usr/local/lsws/${version}/bin/pecl install timezonedb
|
||||
echo "extension=timezonedb.so" > /usr/local/lsws/${version}/etc/php.d/20-timezone.ini
|
||||
@@ -816,7 +1098,7 @@ for version in $(ls /usr/local/lsws | grep lsphp);
|
||||
sed -i 's|mail.add_x_header = On|mail.add_x_header = Off|g' $php_ini
|
||||
sed -i 's|;session.save_path = "/tmp"|session.save_path = "/var/lib/php/session"|g' $php_ini
|
||||
fi
|
||||
|
||||
|
||||
if [[ $SERVER_OS == "Ubuntu" ]] ; then
|
||||
if [[ ! -d /usr/local/lsws/cyberpanel-tmp ]] ; then
|
||||
echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone
|
||||
@@ -824,9 +1106,9 @@ for version in $(ls /usr/local/lsws | grep lsphp);
|
||||
DEBIAN_FRONTEND=noninteractive apt install libmagickwand-dev pkg-config build-essential -y
|
||||
mkdir /usr/local/lsws/cyberpanel-tmp
|
||||
cd /usr/local/lsws/cyberpanel-tmp
|
||||
wget https://pecl.php.net/get/timezonedb-2019.3.tgz
|
||||
tar xzvf timezonedb-2019.3.tgz
|
||||
cd timezonedb-2019.3
|
||||
wget -O timezonedb.tgz https://pecl.php.net/get/timezonedb
|
||||
tar xzvf timezonedb.tgz
|
||||
cd timezonedb-*
|
||||
fi
|
||||
/usr/local/lsws/${version}/bin/phpize
|
||||
./configure --with-php-config=/usr/local/lsws/${version}/bin/php-config${version2}
|
||||
@@ -836,9 +1118,7 @@ for version in $(ls /usr/local/lsws | grep lsphp);
|
||||
make clean
|
||||
fi
|
||||
done
|
||||
sed -i 's|maxConnections 2000|maxConnections 20000|g' /usr/local/lsws/conf/httpd_config.conf
|
||||
sed -i 's|maxSSLConnections 1000|maxSSLConnections 10000|g' /usr/local/lsws/conf/httpd_config.conf
|
||||
/usr/local/lsws/bin/lswsctrl restart
|
||||
|
||||
rm -rf /etc/profile.d/cyberpanel*
|
||||
curl --silent -o /etc/profile.d/cyberpanel.sh https://cyberpanel.sh/?banner 2>/dev/null
|
||||
chmod +x /etc/profile.d/cyberpanel.sh
|
||||
@@ -847,22 +1127,46 @@ DISK2=$(df -h | awk '$NF=="/"{printf "%d/%dGB (%s)\n", $3,$2,$5}')
|
||||
ELAPSED="$(($SECONDS / 3600)) hrs $((($SECONDS / 60) % 60)) min $(($SECONDS % 60)) sec"
|
||||
MYSQLPASSWD=$(cat /etc/cyberpanel/mysqlPassword)
|
||||
echo "$ADMIN_PASS" > /etc/cyberpanel/adminPass
|
||||
/usr/local/CyberPanel/bin/python2 /usr/local/CyberCP/plogical/adminPass.py --password $ADMIN_PASS
|
||||
/usr/local/CyberPanel/bin/python /usr/local/CyberCP/plogical/adminPass.py --password $ADMIN_PASS
|
||||
mkdir -p /etc/opendkim
|
||||
systemctl restart lscpd
|
||||
systemctl restart lsws
|
||||
echo "/usr/local/CyberPanel/bin/python2 /usr/local/CyberCP/plogical/adminPass.py --password \$@" > /usr/bin/adminPass
|
||||
echo "/usr/local/CyberPanel/bin/python /usr/local/CyberCP/plogical/adminPass.py --password \$@" > /usr/bin/adminPass
|
||||
echo "systemctl restart lscpd" >> /usr/bin/adminPass
|
||||
chmod +x /usr/bin/adminPass
|
||||
if [[ $VERSION = "OLS" ]] ; then
|
||||
WORD="OpenLiteSpeed"
|
||||
# sed -i 's|maxConnections 10000|maxConnections 100000|g' /usr/local/lsws/conf/httpd_config.conf
|
||||
# OLS_LATEST=$(curl https://openlitespeed.org/packages/release)
|
||||
# wget https://openlitespeed.org/packages/openlitespeed-$OLS_LATEST.tgz
|
||||
# tar xzvf openlitespeed-$OLS_LATEST.tgz
|
||||
# cd openlitespeed
|
||||
# ./install.sh
|
||||
/usr/local/lsws/bin/lswsctrl stop
|
||||
/usr/local/lsws/bin/lswsctrl start
|
||||
# rm -f openlitespeed-$OLS_LATEST.tgz
|
||||
# rm -rf openlitespeed
|
||||
# cd ..
|
||||
fi
|
||||
if [[ $VERSION = "ENT" ]] ; then
|
||||
WORD="LiteSpeed Enterprise"
|
||||
if [[ $SERVER_COUNTRY != "CN" ]] ; then
|
||||
LSWS_VER=$(curl -s http://update.litespeedtech.com/ws/latest.php | grep LSWS | sed 's/LSWS=//' | head -n 1)
|
||||
/usr/local/lsws/admin/misc/lsup.sh -f -v ${LSWS_VER}
|
||||
/usr/local/lsws/admin/misc/lsup.sh -f -v $LSWS_STABLE_VER
|
||||
fi
|
||||
fi
|
||||
|
||||
systemctl status lsws 2>&1>/dev/null
|
||||
if [[ $? == "0" ]] ; then
|
||||
echo "LSWS service is running..."
|
||||
else
|
||||
systemctl stop lsws
|
||||
systemctl start lsws
|
||||
fi
|
||||
|
||||
webadmin_passwd
|
||||
|
||||
watchdog_setup
|
||||
|
||||
clear
|
||||
echo "###################################################################"
|
||||
echo " CyberPanel Successfully Installed "
|
||||
@@ -875,9 +1179,9 @@ echo " Installation time : $ELAPSED "
|
||||
echo " "
|
||||
echo " Visit: https://$SERVER_IP:8090 "
|
||||
echo " Panel username: admin "
|
||||
echo " Panel password: $ADMIN_PASS "
|
||||
#echo " Mysql username: root "
|
||||
#echo " Mysql password: $MYSQLPASSWD "
|
||||
echo " Panel password: $ADMIN_PASS "
|
||||
echo " WebAdmin console username: admin "
|
||||
echo " WebAdmin console password: $WEBADMIN_PASS "
|
||||
echo " "
|
||||
echo " Please change your default admin password "
|
||||
echo " If you need to reset your panel password, please run: "
|
||||
@@ -908,7 +1212,7 @@ fi
|
||||
if [[ $SERVER_COUNTRY = CN ]] ; then
|
||||
if [[ $PROVIDER == "Tencent Cloud" ]] ; then
|
||||
if [[ $SERVER_OS == "Ubuntu" ]] ; then
|
||||
rm -f /etc/apt/sources.list
|
||||
rm -f /etc/apt/sources.list
|
||||
mv /etc/apt/sources.list-backup /etc/apt/sources.list
|
||||
echo > "nameserver 127.0.0.53
|
||||
options edns0" /run/systemd/resolve/stub-resolv.conf
|
||||
@@ -921,9 +1225,18 @@ options edns0" /etc/resolv.conf
|
||||
if [[ $VERSION = "ENT" ]] ; then
|
||||
sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz|https://cyberpanel.sh/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz|g' /usr/local/CyberCP/install/installCyberPanel.py
|
||||
sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.3.8-ent-x86_64-linux.tar.gz|https://cyberpanel.sh/packages/5.0/lsws-5.3.8-ent-x86_64-linux.tar.gz|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py
|
||||
sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.3.8-ent-x86_64-linux.tar.gz|https://'$DOWNLOAD_SERVER'/litespeed/lsws-'$LSWS_STABLE_VER'-ent-x86_64-linux.tar.gz|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py
|
||||
echo -e "If you have install LiteSpeed Enterprise, please run \e[31m/usr/local/lsws/admin/misc/lsup.sh\033[39m to update it to latest."
|
||||
fi
|
||||
fi
|
||||
|
||||
sed -i 's|lsws-5.3.8|lsws-'$LSWS_STABLE_VER'|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py
|
||||
sed -i 's|lsws-5.4.2|lsws-'$LSWS_STABLE_VER'|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py
|
||||
sed -i 's|lsws-5.3.5|lsws-'$LSWS_STABLE_VER'|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py
|
||||
|
||||
sed -i 's|NoAnonymous no|NoAnonymous yes|g' /etc/pure-ftpd/pure-ftpd.conf
|
||||
|
||||
|
||||
if [[ $SILENT != "ON" ]] ; then
|
||||
printf "%s" "Would you like to restart your server now? [y/N]: "
|
||||
read TMP_YN
|
||||
@@ -953,10 +1266,15 @@ TMP=$(echo $VERSION | cut -c5)
|
||||
TMP2=$(echo $VERSION | cut -c10)
|
||||
TMP3=$(echo $VERSION | cut -c15)
|
||||
if [[ $VERSION == "OLS" || $VERSION == "ols" ]] ; then
|
||||
VERSION=OLS
|
||||
VERSION="OLS"
|
||||
echo -e "\nSet to OpenLiteSpeed..."
|
||||
elif [[ $VERSION == "Trial" ]] || [[ $VERSION == "TRIAL" ]] || [[ $VERSION == "trial" ]] ; then
|
||||
VERSION="ENT"
|
||||
LICENSE_KEY="TRIAL"
|
||||
echo -e "\nLiteSpeed Enterprise trial license set..."
|
||||
elif [[ $TMP == "-" ]] && [[ $TMP2 == "-" ]] && [[ $TMP3 == "-" ]] && [[ $KEY_SIZE == "19" ]] ; then
|
||||
LICENSE_KEY=$VERSION
|
||||
VERSION="ENT"
|
||||
echo -e "\nLiteSpeed Enterprise license key set..."
|
||||
else
|
||||
echo -e "\nCan not recognize the input value \e[31m$VERSION\e[39m "
|
||||
@@ -975,7 +1293,6 @@ elif [[ $ADMIN_PASS == "r" ]] ; then
|
||||
echo -e "\nAdmin password will be set to \e[31m$ADMIN_PASS\e[39m"
|
||||
echo $ADMIN_PASS
|
||||
else
|
||||
echo -e "\nManual input password..."
|
||||
echo -e "\nAdmin password will be set to \e[31m$ADMIN_PASS\e[39m"
|
||||
fi
|
||||
}
|
||||
@@ -985,6 +1302,11 @@ if [ $# -eq 0 ] ; then
|
||||
else
|
||||
if [[ $1 == "help" ]] ; then
|
||||
show_help
|
||||
exit
|
||||
elif [[ $1 == "dev" ]] ; then
|
||||
DEV="ON"
|
||||
DEV_ARG="ON"
|
||||
SILENT="OFF"
|
||||
elif [[ $1 == "default" ]] ; then
|
||||
echo -e "\nThis will start default installation...\n"
|
||||
SILENT="ON"
|
||||
@@ -1045,7 +1367,7 @@ fi
|
||||
|
||||
|
||||
|
||||
SERVER_IP=$(curl --silent --max-time 5 -4 https://cyberpanel.sh/?ip)
|
||||
SERVER_IP=$(curl --silent --max-time 10 -4 https://cyberpanel.sh/?ip)
|
||||
if [[ $SERVER_IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo -e "Valid IP detected..."
|
||||
else
|
||||
@@ -1065,10 +1387,11 @@ fi
|
||||
if [[ $SERVER_COUNTRY == "CN" ]] ; then
|
||||
DOWNLOAD_SERVER="cyberpanel.sh"
|
||||
else
|
||||
DOWNLOAD_SERVER="cyberpanelsh.b-cdn.net"
|
||||
DOWNLOAD_SERVER="cdn.cyberpanel.sh"
|
||||
fi
|
||||
|
||||
check_OS
|
||||
check_virtualization
|
||||
check_root
|
||||
check_panel
|
||||
check_process
|
||||
@@ -1092,5 +1415,3 @@ pip_virtualenv
|
||||
system_tweak
|
||||
|
||||
main_install
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.contrib import admin
|
||||
import models
|
||||
from . import models
|
||||
# Register your models here.
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import os.path
|
||||
import sys
|
||||
import django
|
||||
@@ -22,13 +22,13 @@ class DatabaseManager:
|
||||
def loadDatabaseHome(self, request = None, userID = None):
|
||||
try:
|
||||
return render(request, 'databases/index.html')
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def phpMyAdmin(self, request = None, userID = None):
|
||||
try:
|
||||
return render(request, 'databases/phpMyAdmin.html')
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def createDatabase(self, request = None, userID = None):
|
||||
@@ -40,7 +40,7 @@ class DatabaseManager:
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'databases/createDatabase.html', {'websitesList': websitesName})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def submitDBCreation(self, userID = None, data = None, rAPI = None):
|
||||
@@ -76,7 +76,7 @@ class DatabaseManager:
|
||||
data_ret = {'status': 0, 'createDBStatus': 0, 'error_message': result[1]}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'createDBStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -91,7 +91,7 @@ class DatabaseManager:
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'databases/deleteDatabase.html', {'websitesList': websitesName})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
@@ -132,7 +132,7 @@ class DatabaseManager:
|
||||
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
|
||||
return HttpResponse(final_json)
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
final_json = json.dumps({'status': 0, 'fetchStatus': 0, 'error_message': str(msg)})
|
||||
return HttpResponse(final_json)
|
||||
@@ -163,7 +163,7 @@ class DatabaseManager:
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'deleteStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -177,7 +177,7 @@ class DatabaseManager:
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
|
||||
return render(request, 'databases/listDataBases.html', {'websiteList': websitesName})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def changePassword(self, userID = None, data = None):
|
||||
@@ -210,7 +210,7 @@ class DatabaseManager:
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'changePasswordStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -238,10 +238,10 @@ class DatabaseManager:
|
||||
for db in webs.databases_set.all():
|
||||
mysqlUtilities.allowGlobalUserAccess(admin.userName, db.dbName)
|
||||
|
||||
print "1," + finalUserPassword
|
||||
print("1," + finalUserPassword)
|
||||
|
||||
except BaseException, msg:
|
||||
print "0," + str(msg)
|
||||
except BaseException as msg:
|
||||
print("0," + str(msg))
|
||||
|
||||
def main():
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
from websiteFunctions.models import Websites
|
||||
@@ -7,6 +7,6 @@ from websiteFunctions.models import Websites
|
||||
# Create your models here.
|
||||
|
||||
class Databases(models.Model):
|
||||
website = models.ForeignKey(Websites)
|
||||
website = models.ForeignKey(Websites, on_delete=models.CASCADE)
|
||||
dbName = models.CharField(max_length=50,unique=True)
|
||||
dbUser = models.CharField(max_length=50)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from signals import *
|
||||
from .signals import *
|
||||
from plogical.pluginManagerGlobal import pluginManagerGlobal
|
||||
|
||||
class pluginManager:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
import json
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.loadDatabaseHome, name='loadDatabaseHome'),
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.shortcuts import redirect, HttpResponse
|
||||
from loginSystem.views import loadLoginPage
|
||||
from databaseManager import DatabaseManager
|
||||
from pluginManager import pluginManager
|
||||
from .databaseManager import DatabaseManager
|
||||
from .pluginManager import pluginManager
|
||||
import json
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from loginSystem.models import Administrator
|
||||
@@ -134,7 +134,7 @@ def setupPHPMYAdminSession(request):
|
||||
userID = request.session['userID']
|
||||
admin = Administrator.objects.get(id = userID)
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/databases/databaseManager.py"
|
||||
execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/databases/databaseManager.py"
|
||||
execPath = execPath + " generatePHPMYAdminData --userID " + str(userID)
|
||||
|
||||
output = ProcessUtilities.outputExecutioner(execPath)
|
||||
@@ -151,7 +151,7 @@ def setupPHPMYAdminSession(request):
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'createDBStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
import models
|
||||
|
||||
from . import models
|
||||
from django.contrib import admin
|
||||
|
||||
admin.site.register(models.Domains)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import os.path
|
||||
import sys
|
||||
import django
|
||||
@@ -11,7 +11,7 @@ import json
|
||||
from plogical.dnsUtilities import DNS
|
||||
from loginSystem.models import Administrator
|
||||
import os
|
||||
from models import Domains,Records
|
||||
from .models import Domains,Records
|
||||
from re import match,I,M
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
from plogical.acl import ACLManager
|
||||
@@ -24,7 +24,7 @@ class DNSManager:
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
return render(request, 'dns/index.html', {"type": admin.type})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def createNameserver(self, request = None, userID = None):
|
||||
@@ -40,7 +40,7 @@ class DNSManager:
|
||||
else:
|
||||
return render(request, "dns/createNameServer.html", {"status": 0})
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def NSCreation(self, userID = None, data = None):
|
||||
@@ -94,7 +94,7 @@ class DNSManager:
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'NSCreation': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -109,7 +109,7 @@ class DNSManager:
|
||||
return render(request, 'dns/createDNSZone.html', {"status": 1})
|
||||
else:
|
||||
return render(request, 'dns/createDNSZone.html', {"status": 0})
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def zoneCreation(self, userID = None, data = None):
|
||||
@@ -142,7 +142,7 @@ class DNSManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'zoneCreation': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -161,7 +161,7 @@ class DNSManager:
|
||||
|
||||
return render(request, 'dns/addDeleteDNSRecords.html', {"domainsList": domainsList, "status": 1})
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def getCurrentRecordsForDomain(self, userID = None, data = None):
|
||||
@@ -233,7 +233,7 @@ class DNSManager:
|
||||
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -406,7 +406,7 @@ class DNSManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'add_status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -436,7 +436,7 @@ class DNSManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'delete_status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -456,7 +456,7 @@ class DNSManager:
|
||||
|
||||
return render(request, 'dns/deleteDNSZone.html', {"domainsList": domainsList, "status": 1})
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def submitZoneDeletion(self, userID = None, data = None):
|
||||
@@ -486,7 +486,7 @@ class DNSManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'delete_status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -529,7 +529,7 @@ class DNSManager:
|
||||
|
||||
return render(request, 'dns/configureDefaultNameServers.html', data)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
|
||||
@@ -568,7 +568,7 @@ class DNSManager:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
@@ -1,4 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.db import models
|
||||
from loginSystem.models import Administrator
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from signals import *
|
||||
from .signals import *
|
||||
from plogical.pluginManagerGlobal import pluginManagerGlobal
|
||||
|
||||
class pluginManager:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.loadDNSHome, name='dnsHome'),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user