From 79f1fe469b353db649aee44f85acee9a82d59955 Mon Sep 17 00:00:00 2001 From: qtwrk Date: Sat, 13 Mar 2021 00:20:15 +0100 Subject: [PATCH 1/5] fix webmail login issue on ubuntu 20 fix webmail login issue on ubuntu 20 --- cyberpanel_upgrade.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index c6112c55e..0075aaad8 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -525,6 +525,20 @@ if [[ -f /etc/cyberpanel/watchdog.sh ]] ; then fi #update and restart watchdog +if [[ $UBUNTU_20 == "True" ]] ; then + if ! grep -q "focal" /etc/apt/sources.list.d/dovecot.list ; then + sed -i 's|ce-2.3-latest/ubuntu/bionic bionic main|ce-2.3-latest/ubuntu/focal focal main|g' /etc/apt/sources.list.d/dovecot.list + rm -rf /etc/dovecot-backup + cp -r /etc/dovecot /etc/dovecot-backup + apt update + DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" remove -y dovecot-mysql dovecot-pop3d dovecot-imapd + DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -y dovecot-mysql dovecot-pop3d dovecot-imapd + systemctl restart dovecot + fi +fi +#fix webmail login issue on ubuntu 20 + + ### Disable Centos Default Repos disable_repos() { From ab835ae92eaaddea8458f1ec6dfba0f258e5e7fb Mon Sep 17 00:00:00 2001 From: Mode Date: Sun, 14 Mar 2021 07:35:12 +0000 Subject: [PATCH 2/5] Fixed managePDNS: select pdns.conf path according to OS; removed unnecessary /32; Move temp file to pdns.conf --- manageServices/serviceManager.py | 57 ++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/manageServices/serviceManager.py b/manageServices/serviceManager.py index 56dd56157..d8bca3f8a 100755 --- a/manageServices/serviceManager.py +++ b/manageServices/serviceManager.py @@ -22,7 +22,11 @@ class ServiceManager: def managePDNS(self): type = self.extraArgs['type'] - path = '/etc/pdns/pdns.conf' + + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + path = '/etc/pdns/pdns.conf' + else: + path = '/etc/powerdns/pdns.conf' data = ProcessUtilities.outputExecutioner('sudo cat ' + path).splitlines() #data = subprocess.check_output(shlex.split('sudo cat ' + path)).decode("utf-8").splitlines() @@ -35,8 +39,9 @@ class ServiceManager: ipStringNoSubnet = '' for items in SlaveServers.objects.all(): - ipsString = ipsString + '%s/32, ' % (items.slaveServerIP) - ipStringNoSubnet = ipStringNoSubnet + '%s, ' % (items.slaveServerIP) + if items.slaveServerIP: + ipsString = ipsString + '%s/32, ' % (items.slaveServerIP) + ipStringNoSubnet = ipStringNoSubnet + '%s, ' % (items.slaveServerIP) ipsString = ipsString.rstrip(', ') ipStringNoSubnet = ipStringNoSubnet.rstrip(', ') @@ -74,6 +79,9 @@ class ServiceManager: writeToFile.writelines('disable-axfr=no\n') writeToFile.writelines('master=yes\n') writeToFile.close() + + command = 'sudo mv ' + tempPath + ' ' + path + ProcessUtilities.executioner(command) else: import os @@ -110,18 +118,18 @@ class ServiceManager: writeToFile.writelines(items + '\n') slaveData = """ -slave=yes -daemon=yes -disable-axfr=yes -guardian=yes -local-address=0.0.0.0 -local-port=53 -master=no -slave-cycle-interval=60 -setgid=pdns -setuid=pdns -superslave=yes -""" + slave=yes + daemon=yes + disable-axfr=yes + guardian=yes + local-address=0.0.0.0 + local-port=53 + master=no + slave-cycle-interval=60 + setgid=pdns + setuid=pdns + superslave=yes + """ writeToFile.writelines(slaveData) writeToFile.close() @@ -146,14 +154,14 @@ superslave=yes repoPath = '/etc/yum.repos.d/elasticsearch.repo' content = '''[elasticsearch] -name=Elasticsearch repository for 7.x packages -baseurl=https://artifacts.elastic.co/packages/7.x/yum -gpgcheck=1 -gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch -enabled=0 -autorefresh=1 -type=rpm-md -''' + name=Elasticsearch repository for 7.x packages + baseurl=https://artifacts.elastic.co/packages/7.x/yum + gpgcheck=1 + gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch + enabled=0 + autorefresh=1 + type=rpm-md + ''' writeToFile = open(repoPath, 'w') writeToFile.write(content) @@ -316,5 +324,4 @@ def main(): if __name__ == "__main__": - main() - + main() \ No newline at end of file From da86cbce05259119ac5033d52dd2696b3dd36c21 Mon Sep 17 00:00:00 2001 From: Mode Date: Mon, 15 Mar 2021 08:33:44 +0000 Subject: [PATCH 3/5] For replication to work domain type must be MASTER --- dns/dnsManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dns/dnsManager.py b/dns/dnsManager.py index acdca57a9..d0db18fb4 100755 --- a/dns/dnsManager.py +++ b/dns/dnsManager.py @@ -140,7 +140,7 @@ class DNSManager: zoneDomain = data['zoneDomain'] - newZone = Domains(admin=admin, name=zoneDomain, type="NATIVE") + newZone = Domains(admin=admin, name=zoneDomain, type="MASTER") newZone.save() content = "ns1." + zoneDomain + " hostmaster." + zoneDomain + " 1 10800 3600 604800 3600" From fd19f78706cf3b0b729807fed06bd4cf1abe592a Mon Sep 17 00:00:00 2001 From: Mode Date: Mon, 15 Mar 2021 08:56:36 +0000 Subject: [PATCH 4/5] Slave configuration was being duplicated, so changed the logic --- manageServices/serviceManager.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/manageServices/serviceManager.py b/manageServices/serviceManager.py index d8bca3f8a..ac24cf2d9 100755 --- a/manageServices/serviceManager.py +++ b/manageServices/serviceManager.py @@ -93,6 +93,9 @@ class ServiceManager: counter = 0 + tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) + writeToFile = open(tempPath, 'w') + for items in data: if items.find('allow-axfr-ips') > -1: continue @@ -111,10 +114,6 @@ class ServiceManager: counter = counter + 1 - tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) - writeToFile = open(tempPath, 'w') - - for items in data: writeToFile.writelines(items + '\n') slaveData = """ @@ -128,7 +127,7 @@ class ServiceManager: slave-cycle-interval=60 setgid=pdns setuid=pdns - superslave=yes + superslave=yes """ writeToFile.writelines(slaveData) From 8b50107c8720bb607aee709dfc470b6dea999a72 Mon Sep 17 00:00:00 2001 From: Mode Date: Tue, 16 Mar 2021 22:13:55 +0000 Subject: [PATCH 5/5] Reverted back the spaces in pdns.conf, because in centos it add's those spaces --- manageServices/serviceManager.py | 43 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/manageServices/serviceManager.py b/manageServices/serviceManager.py index ac24cf2d9..010875291 100755 --- a/manageServices/serviceManager.py +++ b/manageServices/serviceManager.py @@ -117,18 +117,18 @@ class ServiceManager: writeToFile.writelines(items + '\n') slaveData = """ - slave=yes - daemon=yes - disable-axfr=yes - guardian=yes - local-address=0.0.0.0 - local-port=53 - master=no - slave-cycle-interval=60 - setgid=pdns - setuid=pdns - superslave=yes - """ +slave=yes +daemon=yes +disable-axfr=yes +guardian=yes +local-address=0.0.0.0 +local-port=53 +master=no +slave-cycle-interval=60 +setgid=pdns +setuid=pdns +superslave=yes +""" writeToFile.writelines(slaveData) writeToFile.close() @@ -152,15 +152,16 @@ class ServiceManager: repoPath = '/etc/yum.repos.d/elasticsearch.repo' - content = '''[elasticsearch] - name=Elasticsearch repository for 7.x packages - baseurl=https://artifacts.elastic.co/packages/7.x/yum - gpgcheck=1 - gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch - enabled=0 - autorefresh=1 - type=rpm-md - ''' + content = ''' +[elasticsearch] +name=Elasticsearch repository for 7.x packages +baseurl=https://artifacts.elastic.co/packages/7.x/yum +gpgcheck=1 +gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch +enabled=0 +autorefresh=1 +type=rpm-md +''' writeToFile = open(repoPath, 'w') writeToFile.write(content)