diff --git a/plogical/CyberCPLogFileWriter.pyc b/plogical/CyberCPLogFileWriter.pyc index c5984f202..9a7ef101c 100644 Binary files a/plogical/CyberCPLogFileWriter.pyc and b/plogical/CyberCPLogFileWriter.pyc differ diff --git a/plogical/__init__.pyc b/plogical/__init__.pyc index dec0bc6d2..cf6cbd66a 100644 Binary files a/plogical/__init__.pyc and b/plogical/__init__.pyc differ diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index c4d4b3581..d7ee38f6a 100644 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -465,6 +465,12 @@ class ApplicationInstaller(multi.Thread): try: domain = self.extraArgs['domain'] + path = '/home/cyberpanel/' + domain + '.git' + + if not os.path.exists(path): + logging.writeToFile('Git is not setup for this website.') + return 0 + command = 'sudo GIT_SSH_COMMAND="ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no" git -C /home/' + domain + '/public_html/ pull' subprocess.check_output(shlex.split(command)) @@ -487,6 +493,26 @@ class ApplicationInstaller(multi.Thread): def detachRepo(self): try: domain = self.extraArgs['domainName'] + admin = self.extraArgs['admin'] + + try: + website = ChildDomains.objects.get(domain=domain) + externalApp = website.master.externalApp + + if admin.type != 1: + if website.master.admin != admin: + logging.writeToFile("You do not own this website, detach failed. [404]") + return 0 + + except: + website = Websites.objects.get(domain=domain) + externalApp = website.externalApp + + if admin.type != 1: + if website.admin != admin: + logging.writeToFile("You do not own this website, detach failed. [404]") + return 0 + command = 'sudo rm -rf /home/' + domain + '/public_html' subprocess.check_output(shlex.split(command)) @@ -494,9 +520,6 @@ class ApplicationInstaller(multi.Thread): command = 'sudo mkdir /home/' + domain + '/public_html' subprocess.check_output(shlex.split(command)) - website = Websites.objects.get(domain=domain) - externalApp = website.externalApp - ## command = "sudo chown -R " + externalApp + ":" + externalApp + " " + '/home/' + domain + '/public_html' @@ -705,6 +728,23 @@ class ApplicationInstaller(multi.Thread): try: domainName = self.extraArgs['domainName'] githubBranch = self.extraArgs['githubBranch'] + admin = self.extraArgs['admin'] + + try: + website = ChildDomains.objects.get(domain=domainName) + + if admin.type != 1: + if website.master.admin != admin: + logging.writeToFile("You do not own this website, failed to change branch. [404]") + return 0 + + except: + website = Websites.objects.get(domain=domainName) + + if admin.type != 1: + if website.admin != admin: + logging.writeToFile("You do not own this website, failed to change branch. [404]") + return 0 try: command = 'sudo GIT_SSH_COMMAND="ssh -i /root/.ssh/cyberpanel -o StrictHostKeyChecking=no" git -C /home/' + domainName + '/public_html/ checkout -b' + githubBranch diff --git a/plogical/applicationInstaller.pyc b/plogical/applicationInstaller.pyc new file mode 100644 index 000000000..b8e2922da Binary files /dev/null and b/plogical/applicationInstaller.pyc differ diff --git a/plogical/backupSchedule.py b/plogical/backupSchedule.py index 7ababe6b8..f51b12012 100644 --- a/plogical/backupSchedule.py +++ b/plogical/backupSchedule.py @@ -83,6 +83,11 @@ class backupSchedule: writeToFile = open(backupLogPath, "a") command = "sudo scp -o StrictHostKeyChecking=no -P "+port+" -i /root/.ssh/cyberpanel " + backupPath + " root@"+IPAddress+":/home/backup/" + ipAddressLocal + "/" + time.strftime("%a-%b") + "/" subprocess.call(shlex.split(command), stdout=writeToFile) + + ## Remove backups already sent to remote destinations + + os.remove(backupPath) + except BaseException, msg: logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startBackup]") diff --git a/plogical/dnsUtilities.pyc b/plogical/dnsUtilities.pyc index e23d8ac48..4553d4023 100644 Binary files a/plogical/dnsUtilities.pyc and b/plogical/dnsUtilities.pyc differ diff --git a/plogical/filemanager.pyc b/plogical/filemanager.pyc new file mode 100644 index 000000000..3ac3457dd Binary files /dev/null and b/plogical/filemanager.pyc differ diff --git a/plogical/installUtilities.pyc b/plogical/installUtilities.pyc index af8e3b5aa..b430ac94a 100644 Binary files a/plogical/installUtilities.pyc and b/plogical/installUtilities.pyc differ diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index 24a2625ab..4cecbbec3 100644 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -235,7 +235,6 @@ class mailUtilities: @staticmethod def generateKeys(domain): try: - result = mailUtilities.setupDKIM(domain) if result[0] == 0: raise BaseException(result[1]) diff --git a/plogical/mailUtilities.pyc b/plogical/mailUtilities.pyc new file mode 100644 index 000000000..c15fc3ed6 Binary files /dev/null and b/plogical/mailUtilities.pyc differ diff --git a/plogical/mysqlUtilities.pyc b/plogical/mysqlUtilities.pyc index 42df0f4ae..bc2990752 100644 Binary files a/plogical/mysqlUtilities.pyc and b/plogical/mysqlUtilities.pyc differ diff --git a/plogical/randomPassword.pyc b/plogical/randomPassword.pyc index d889e0881..6eebdc66a 100644 Binary files a/plogical/randomPassword.pyc and b/plogical/randomPassword.pyc differ diff --git a/plogical/serverLogs.pyc b/plogical/serverLogs.pyc new file mode 100644 index 000000000..8ea359545 Binary files /dev/null and b/plogical/serverLogs.pyc differ diff --git a/plogical/sslUtilities.pyc b/plogical/sslUtilities.pyc index 1c0c28c56..773486776 100644 Binary files a/plogical/sslUtilities.pyc and b/plogical/sslUtilities.pyc differ diff --git a/plogical/tuning.pyc b/plogical/tuning.pyc index f95a6bd3a..ebc387c65 100644 Binary files a/plogical/tuning.pyc and b/plogical/tuning.pyc differ diff --git a/plogical/vhost.py b/plogical/vhost.py index 6215dd566..90db22ba7 100644 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -611,7 +611,6 @@ RewriteFile .htaccess @staticmethod def addRewriteRules(virtualHostName, fileName=None): - try: pass except BaseException, msg: @@ -679,11 +678,8 @@ RewriteFile .htaccess def permissionControl(path): try: command = 'sudo chown -R cyberpanel:cyberpanel ' + path - cmd = shlex.split(command) - res = subprocess.call(cmd) - except BaseException, msg: logging.CyberCPLogFileWriter.writeToFile(str(msg)) diff --git a/plogical/vhost.pyc b/plogical/vhost.pyc new file mode 100644 index 000000000..a9a108e30 Binary files /dev/null and b/plogical/vhost.pyc differ diff --git a/websiteFunctions/views.py b/websiteFunctions/views.py index 2a7201446..61caf3946 100644 --- a/websiteFunctions/views.py +++ b/websiteFunctions/views.py @@ -259,6 +259,8 @@ def submitWebsiteCreation(request): data_ret = {'createWebSiteStatus': 0, 'error_message': output, "existsStatus": 0} json_data = json.dumps(data_ret) return HttpResponse(json_data) + + except BaseException, msg: data_ret = {'createWebSiteStatus': 0, 'error_message': str(msg), "existsStatus": 0} json_data = json.dumps(data_ret) @@ -2522,6 +2524,7 @@ def setupGit(request, domain): ipAddress = ipData.split('\n', 1)[0] webhookURL = 'https://' + ipAddress + ':8090/websites/' + domain + '/gitNotify' + return render(request, 'websiteFunctions/setupGit.html', {'domainName': domain, 'installed': 1, 'webhookURL': webhookURL}) else: @@ -2577,7 +2580,6 @@ def setupGitRepo(request): logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[installWordpress]") return HttpResponse("Not Logged in as admin") - def gitNotify(request, domain): try: if request.method == 'POST': @@ -2604,7 +2606,6 @@ def gitNotify(request, domain): json_data = json.dumps(data_ret) return HttpResponse(json_data) - def detachRepo(request): try: val = request.session['userID'] @@ -2618,6 +2619,7 @@ def detachRepo(request): extraArgs = {} extraArgs['domainName'] = data['domain'] + extraArgs['admin'] = admin background = ApplicationInstaller('detach', extraArgs) @@ -2655,6 +2657,7 @@ def changeBranch(request): extraArgs = {} extraArgs['domainName'] = data['domain'] extraArgs['githubBranch'] = data['githubBranch'] + extraArgs['admin'] = admin background = ApplicationInstaller('changeBranch', extraArgs)