diff --git a/backup/backupManager.py b/backup/backupManager.py index 0188bed11..f1f24d562 100755 --- a/backup/backupManager.py +++ b/backup/backupManager.py @@ -654,13 +654,13 @@ class BackupManager: return HttpResponse(final_json) else: if backupDest == "Home" and backupFreq == "Daily": - cronJob = "0 3 * * 0-6 root python /usr/local/CyberCP/plogical/backupScheduleLocal.py" + cronJob = "0 3 * * * root python /usr/local/CyberCP/plogical/backupScheduleLocal.py" elif backupDest == "Home" and backupFreq == "Weekly": - cronJob = "0 3 * * 3 root python /usr/local/CyberCP/plogical/backupScheduleLocal.py " + cronJob = "0 0 * * 0 root python /usr/local/CyberCP/plogical/backupScheduleLocal.py " elif backupDest != "Home" and backupFreq == "Daily": - cronJob = "0 3 * * 0-6 root python /usr/local/CyberCP/plogical/backupSchedule.py" + cronJob = "0 3 * * * root python /usr/local/CyberCP/plogical/backupSchedule.py" elif backupDest != "Home" and backupFreq == "Weekly": - cronJob = "0 3 * * 3 root python /usr/local/CyberCP/plogical/backupSchedule.py " + cronJob = "0 0 * * 0 root python /usr/local/CyberCP/plogical/backupSchedule.py " command = "cat " + path output = ProcessUtilities.outputExecutioner(command) @@ -672,10 +672,10 @@ class BackupManager: writeToFile.writelines(finalCronJob + "\n") writeToFile.close() - command = "sudo mv " + tempCronPath + " " + path + command = "mv " + tempCronPath + " " + path ProcessUtilities.executioner(command) - command = "sudo systemctl restart crond" + command = "systemctl restart crond" ProcessUtilities.executioner(command) destination = dest.objects.get(destLoc=backupDest) @@ -686,14 +686,13 @@ class BackupManager: return HttpResponse(final_json) except: if backupDest == "Home" and backupFreq == "Daily": - cronJob = "0 3 * * 0-6 root python /usr/local/CyberCP/plogical/backupScheduleLocal.py" + cronJob = "0 3 * * * root python /usr/local/CyberCP/plogical/backupScheduleLocal.py" elif backupDest == "Home" and backupFreq == "Weekly": - cronJob = "0 3 * * 3 root python /usr/local/CyberCP/plogical/backupScheduleLocal.py" + cronJob = "0 0 * * 0 root python /usr/local/CyberCP/plogical/backupScheduleLocal.py " elif backupDest != "Home" and backupFreq == "Daily": - cronJob = "0 3 * * 0-6 root python /usr/local/CyberCP/plogical/backupSchedule.py" - + cronJob = "0 3 * * * root python /usr/local/CyberCP/plogical/backupSchedule.py" elif backupDest != "Home" and backupFreq == "Weekly": - cronJob = "0 3 * * 3 root python /usr/local/CyberCP/plogical/backupSchedule.py" + cronJob = "0 0 * * 0 root python /usr/local/CyberCP/plogical/backupSchedule.py " command = "cat " + path output = ProcessUtilities.outputExecutioner(command) diff --git a/baseTemplate/views.py b/baseTemplate/views.py index eb200406b..1cb204534 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -17,6 +17,7 @@ import plogical.CyberCPLogFileWriter as logging from plogical.acl import ACLManager from manageServices.models import PDNSStatus from django.views.decorators.csrf import ensure_csrf_cookie +from plogical.processUtilities import ProcessUtilities # Create your views here. @@ -58,7 +59,12 @@ def getAdminStatus(request): pdns = PDNSStatus.objects.get(pk=1) currentACL['dnsAsWhole'] = pdns.serverStatus except: - if os.path.exists('/etc/pdns'): + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + pdnsPath = '/etc/powerdns' + else: + pdnsPath = '/etc/pdns' + + if os.path.exists(pdnsPath): PDNSStatus(serverStatus=1).save() currentACL['dnsAsWhole'] = 1 else: diff --git a/install/install.py b/install/install.py index 660400d1f..6a4ab1e79 100755 --- a/install/install.py +++ b/install/install.py @@ -1151,7 +1151,7 @@ class preFlightsChecks: 'Change permissions for client.', 1, 0, os.EX_OSERR) impFile = ['/etc/pure-ftpd/pure-ftpd.conf', '/etc/pure-ftpd/pureftpd-pgsql.conf', '/etc/pure-ftpd/pureftpd-mysql.conf', '/etc/pure-ftpd/pureftpd-ldap.conf', - '/etc/dovecot/dovecot.conf', '/etc/pdns/pdns.conf', '/etc/pure-ftpd/db/mysql.conf'] + '/etc/dovecot/dovecot.conf', '/etc/pdns/pdns.conf', '/etc/pure-ftpd/db/mysql.conf', '/etc/powerdns/pdns.conf'] for items in impFile: command = 'chmod 600 %s' % (items) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 2ec47f210..1cc5b2fea 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -1443,7 +1443,7 @@ class Upgrade: impFile = ['/etc/pure-ftpd/pure-ftpd.conf', '/etc/pure-ftpd/pureftpd-pgsql.conf', '/etc/pure-ftpd/pureftpd-mysql.conf', '/etc/pure-ftpd/pureftpd-ldap.conf', - '/etc/dovecot/dovecot.conf', '/etc/pdns/pdns.conf', '/etc/pure-ftpd/db/mysql.conf'] + '/etc/dovecot/dovecot.conf', '/etc/pdns/pdns.conf', '/etc/pure-ftpd/db/mysql.conf', '/etc/powerdns/pdns.conf'] for items in impFile: command = 'chmod 600 %s' % (items) @@ -1513,52 +1513,110 @@ class Upgrade: @staticmethod def upgradeDovecot(): - CentOSPath = '/etc/redhat-release' + try: + Upgrade.stdOut("Upgrading Dovecot..") + CentOSPath = '/etc/redhat-release' - if os.path.exists(CentOSPath): - path = '/etc/yum.repos.d/dovecot.repo' - content = """[dovecot-2.3-latest] -name=Dovecot 2.3 CentOS $releasever - $basearch -baseurl=http://repo.dovecot.org/ce-2.3-latest/centos/$releasever/RPMS/$basearch -gpgkey=https://repo.dovecot.org/DOVECOT-REPO-GPG -gpgcheck=1 -enabled=1""" - writeToFile = open(path, 'w') - writeToFile.write(content) - writeToFile.close() + if os.path.exists(CentOSPath): + path = '/etc/yum.repos.d/dovecot.repo' + content = """[dovecot-2.3-latest] + name=Dovecot 2.3 CentOS $releasever - $basearch + baseurl=http://repo.dovecot.org/ce-2.3-latest/centos/$releasever/RPMS/$basearch + gpgkey=https://repo.dovecot.org/DOVECOT-REPO-GPG + gpgcheck=1 + enabled=1""" + writeToFile = open(path, 'w') + writeToFile.write(content) + writeToFile.close() - command = "yum makecache -y" - Upgrade.executioner(command, 0) + command = "yum makecache -y" + Upgrade.executioner(command, 0) - command = "yum update -y" - Upgrade.executioner(command, 0) + command = "yum update -y" + Upgrade.executioner(command, 0) - ## Remove Default Password Scheme + ## Remove Default Password Scheme - path = '/etc/dovecot/dovecot-sql.conf.ext' + path = '/etc/dovecot/dovecot-sql.conf.ext' - data = open(path, 'r').readlines() + data = open(path, 'r').readlines() - updatePasswords = 1 + updatePasswords = 1 - writeToFile = open(path, 'w') - for items in data: - if items.find('default_pass_scheme') > -1: - updatePasswords = 0 - continue - else: - writeToFile.writelines(items) + writeToFile = open(path, 'w') + for items in data: + if items.find('default_pass_scheme') > -1: + updatePasswords = 0 + continue + else: + writeToFile.writelines(items) - writeToFile.close() + writeToFile.close() - if updatePasswords: - for items in EUsers.objects.all(): - command = 'doveadm pw -p %s' % (items.password) - items.password = subprocess.check_output(shlex.split(command)).strip('\n') - items.save() + if updatePasswords: + for items in EUsers.objects.all(): + command = 'doveadm pw -p %s' % (items.password) + items.password = subprocess.check_output(shlex.split(command)).strip('\n') + items.save() - command = "systemctl restart dovecot" - Upgrade.executioner(command, 0) + command = "systemctl restart dovecot" + Upgrade.executioner(command, 0) + else: + command = 'curl https://repo.dovecot.org/DOVECOT-REPO-GPG | gpg --import' + subprocess.call(command, shell=True) + + command = 'gpg --export ED409DA1 > /etc/apt/trusted.gpg.d/dovecot.gpg' + subprocess.call(command, shell=True) + + debPath = '/etc/apt/sources.list.d/dovecot.list' + writeToFile = open(debPath, 'w') + writeToFile.write('deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/bionic bionic main\n') + writeToFile.close() + + try: + command = 'apt update -y' + Upgrade.executioner(command, 0) + except: + pass + + try: + command = 'apt upgrade -y' + Upgrade.executioner(command, 0) + except: + pass + + ## Remove Default Password Scheme + + path = '/etc/dovecot/dovecot-sql.conf.ext' + + data = open(path, 'r').readlines() + + updatePasswords = 1 + + writeToFile = open(path, 'w') + for items in data: + if items.find('default_pass_scheme') > -1: + updatePasswords = 0 + continue + else: + writeToFile.writelines(items) + + writeToFile.close() + + if updatePasswords: + Upgrade.stdOut("Upgrading passwords...") + for items in EUsers.objects.all(): + command = 'doveadm pw -p %s' % (items.password) + items.password = subprocess.check_output(shlex.split(command)).strip('\n') + items.save() + + command = "systemctl restart dovecot" + Upgrade.executioner(command, 0) + + Upgrade.stdOut("Dovecot upgraded.") + + except BaseException, msg: + Upgrade.stdOut(str(msg) + " [upgradeDovecot]") @staticmethod def upgrade(): diff --git a/static/dockerManager/dockerManager.js b/static/dockerManager/dockerManager.js old mode 100755 new mode 100644