Skip to content

Commit 7284ab7

Browse files
committed
tld extract bug fix
1 parent e78cc6f commit 7284ab7

File tree

6 files changed

+25
-57
lines changed

6 files changed

+25
-57
lines changed

cloudAPI/cloudManager.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,18 +2859,11 @@ def SwitchDNS(self):
28592859

28602860
zones = cf.zones.get(params = {'per_page':100})
28612861

2862-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache'
2863-
ProcessUtilities.executioner(command)
2864-
2865-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
2866-
ProcessUtilities.executioner(command)
2867-
2868-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
2869-
ProcessUtilities.executioner(command, None, True)
28702862

28712863
for website in Websites.objects.all():
28722864
import tldextract
2873-
extractDomain = tldextract.extract(website.domain)
2865+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
2866+
extractDomain = no_cache_extract(website.domain)
28742867
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
28752868

28762869
for zone in zones:
@@ -2920,7 +2913,8 @@ def SwitchDNS(self):
29202913
for website in ChildDomains.objects.all():
29212914

29222915
import tldextract
2923-
extractDomain = tldextract.extract(website.domain)
2916+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
2917+
extractDomain = no_cache_extract(website.domain)
29242918
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
29252919

29262920
for zone in zones:

dns/dnsManager.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,9 @@ def addDeleteDNSRecords(self, request = None, userID = None):
171171
finalData['domainsList'] = []
172172
import tldextract
173173

174-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache'
175-
ProcessUtilities.executioner(command)
176-
177-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
178-
ProcessUtilities.executioner(command)
179-
180-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
181-
ProcessUtilities.executioner(command, None, True)
182-
183-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
184-
ProcessUtilities.executioner(command)
185-
174+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
186175
for items in tempList:
187-
extractDomain = tldextract.extract(items)
176+
extractDomain = no_cache_extract(items)
188177
subDomain = extractDomain.subdomain
189178
if len(subDomain) == 0:
190179
finalData['domainsList'].append(items)

mailServer/mailserverManager.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -693,18 +693,12 @@ def fetchDKIMKeys(self):
693693

694694
try:
695695

696-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache'
697-
ProcessUtilities.executioner(command)
698-
699-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
700-
ProcessUtilities.executioner(command)
701-
702-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
703-
ProcessUtilities.executioner(command, None, True)
704696

705697
import tldextract
706698

707-
extractDomain = tldextract.extract(domainName)
699+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
700+
701+
extractDomain = no_cache_extract(domainName)
708702
domainName = extractDomain.domain + '.' + extractDomain.suffix
709703

710704
path = "/etc/opendkim/keys/" + domainName + "/default.txt"
@@ -772,7 +766,9 @@ def generateDKIMKeys(self):
772766

773767
import tldextract
774768

775-
extractDomain = tldextract.extract(domainName)
769+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
770+
771+
extractDomain = no_cache_extract(domainName)
776772
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
777773

778774
zone = dnsDomains.objects.get(name=topLevelDomain)

plogical/dnsUtilities.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,12 @@ def dnsTemplate(domain, admin):
115115
ipData = f.read()
116116
ipAddress = ipData.split('\n', 1)[0]
117117

118-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache'
119-
ProcessUtilities.executioner(command)
120-
121-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
122-
ProcessUtilities.executioner(command)
123-
124-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
125-
ProcessUtilities.executioner(command, None, True)
126-
127-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
128-
ProcessUtilities.executioner(command)
129118

130119
import tldextract
131120

132-
extractDomain = tldextract.extract(domain)
121+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
122+
123+
extractDomain = no_cache_extract(domain)
133124
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
134125
subDomain = extractDomain.subdomain
135126

@@ -582,7 +573,9 @@ def createDKIMRecords(domain):
582573

583574
import tldextract
584575

585-
extractDomain = tldextract.extract(domain)
576+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
577+
578+
extractDomain = no_cache_extract(domain)
586579
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
587580
subDomain = extractDomain.subdomain
588581

plogical/mailUtilities.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -401,19 +401,13 @@ def setupDKIM(virtualHostName):
401401
try:
402402
## Generate DKIM Keys
403403

404-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache'
405-
ProcessUtilities.executioner(command)
406-
407-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
408-
ProcessUtilities.executioner(command)
409-
410-
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
411-
ProcessUtilities.executioner(command, None, True)
412404

413405
import tldextract
414406

407+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
408+
415409
actualDomain = virtualHostName
416-
extractDomain = tldextract.extract(virtualHostName)
410+
extractDomain = no_cache_extract(virtualHostName)
417411
virtualHostName = extractDomain.domain + '.' + extractDomain.suffix
418412

419413
if not os.path.exists("/etc/opendkim/keys/" + virtualHostName + "/default.txt"):

plogical/sslv2.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,11 @@ def FindIfDomainInCloudflare(virtualHostName):
339339
import tldextract
340340

341341
RetStatus, SAVED_CF_Key, SAVED_CF_Email = ACLManager.FetchCloudFlareAPIKeyFromAcme()
342+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
342343

343344
if RetStatus:
344345

345-
extractDomain = tldextract.extract(virtualHostName)
346+
extractDomain = no_cache_extract(virtualHostName)
346347
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
347348
logging.CyberCPLogFileWriter.writeToFile(f'top level domain in cf: {topLevelDomain}')
348349
import CloudFlare
@@ -375,7 +376,8 @@ def FindIfDomainInPowerDNS(virtualHostName):
375376

376377
from plogical.dnsUtilities import DNS
377378
from dns.models import Domains
378-
extractDomain = tldextract.extract(virtualHostName)
379+
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
380+
extractDomain = no_cache_extract(virtualHostName)
379381
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
380382
zone = Domains.objects.get(name=topLevelDomain)
381383

0 commit comments

Comments
 (0)