Merge branch 'v2.0.5-dev' of github.com:usmannasir/cyberpanel into v2.0.5-dev

This commit is contained in:
Usman Nasir
2021-03-18 18:31:28 +05:00
2 changed files with 19 additions and 12 deletions

View File

@@ -133,7 +133,7 @@ class DNSManager:
zoneDomain = data['zoneDomain'] zoneDomain = data['zoneDomain']
newZone = Domains(admin=admin, name=zoneDomain, type="NATIVE") newZone = Domains(admin=admin, name=zoneDomain, type="MASTER")
newZone.save() newZone.save()
content = "ns1." + zoneDomain + " hostmaster." + zoneDomain + " 1 10800 3600 604800 3600" content = "ns1." + zoneDomain + " hostmaster." + zoneDomain + " 1 10800 3600 604800 3600"

View File

@@ -22,7 +22,11 @@ class ServiceManager:
def managePDNS(self): def managePDNS(self):
type = self.extraArgs['type'] type = self.extraArgs['type']
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
path = '/etc/pdns/pdns.conf' path = '/etc/pdns/pdns.conf'
else:
path = '/etc/powerdns/pdns.conf'
data = ProcessUtilities.outputExecutioner('sudo cat ' + path).splitlines() data = ProcessUtilities.outputExecutioner('sudo cat ' + path).splitlines()
#data = subprocess.check_output(shlex.split('sudo cat ' + path)).decode("utf-8").splitlines() #data = subprocess.check_output(shlex.split('sudo cat ' + path)).decode("utf-8").splitlines()
@@ -35,6 +39,7 @@ class ServiceManager:
ipStringNoSubnet = '' ipStringNoSubnet = ''
for items in SlaveServers.objects.all(): for items in SlaveServers.objects.all():
if items.slaveServerIP:
ipsString = ipsString + '%s/32, ' % (items.slaveServerIP) ipsString = ipsString + '%s/32, ' % (items.slaveServerIP)
ipStringNoSubnet = ipStringNoSubnet + '%s, ' % (items.slaveServerIP) ipStringNoSubnet = ipStringNoSubnet + '%s, ' % (items.slaveServerIP)
@@ -74,6 +79,9 @@ class ServiceManager:
writeToFile.writelines('disable-axfr=no\n') writeToFile.writelines('disable-axfr=no\n')
writeToFile.writelines('master=yes\n') writeToFile.writelines('master=yes\n')
writeToFile.close() writeToFile.close()
command = 'sudo mv ' + tempPath + ' ' + path
ProcessUtilities.executioner(command)
else: else:
import os import os
@@ -85,6 +93,9 @@ class ServiceManager:
counter = 0 counter = 0
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
writeToFile = open(tempPath, 'w')
for items in data: for items in data:
if items.find('allow-axfr-ips') > -1: if items.find('allow-axfr-ips') > -1:
continue continue
@@ -103,10 +114,6 @@ class ServiceManager:
counter = counter + 1 counter = counter + 1
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
writeToFile = open(tempPath, 'w')
for items in data:
writeToFile.writelines(items + '\n') writeToFile.writelines(items + '\n')
slaveData = """ slaveData = """
@@ -145,7 +152,8 @@ superslave=yes
repoPath = '/etc/yum.repos.d/elasticsearch.repo' repoPath = '/etc/yum.repos.d/elasticsearch.repo'
content = '''[elasticsearch] content = '''
[elasticsearch]
name=Elasticsearch repository for 7.x packages name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1 gpgcheck=1
@@ -317,4 +325,3 @@ def main():
if __name__ == "__main__": if __name__ == "__main__":
main() main()