tld extract bug fix

This commit is contained in:
usmannasir
2024-09-08 00:25:23 +05:00
parent e78cc6f485
commit 7284ab70a8
6 changed files with 25 additions and 57 deletions

View File

@@ -2859,18 +2859,11 @@ class CloudManager:
zones = cf.zones.get(params = {'per_page':100}) zones = cf.zones.get(params = {'per_page':100})
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command, None, True)
for website in Websites.objects.all(): for website in Websites.objects.all():
import tldextract import tldextract
extractDomain = tldextract.extract(website.domain) no_cache_extract = tldextract.TLDExtract(cache_dir=None)
extractDomain = no_cache_extract(website.domain)
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
for zone in zones: for zone in zones:
@@ -2920,7 +2913,8 @@ class CloudManager:
for website in ChildDomains.objects.all(): for website in ChildDomains.objects.all():
import tldextract import tldextract
extractDomain = tldextract.extract(website.domain) no_cache_extract = tldextract.TLDExtract(cache_dir=None)
extractDomain = no_cache_extract(website.domain)
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
for zone in zones: for zone in zones:

View File

@@ -171,20 +171,9 @@ class DNSManager:
finalData['domainsList'] = [] finalData['domainsList'] = []
import tldextract import tldextract
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache' no_cache_extract = tldextract.TLDExtract(cache_dir=None)
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command, None, True)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
for items in tempList: for items in tempList:
extractDomain = tldextract.extract(items) extractDomain = no_cache_extract(items)
subDomain = extractDomain.subdomain subDomain = extractDomain.subdomain
if len(subDomain) == 0: if len(subDomain) == 0:
finalData['domainsList'].append(items) finalData['domainsList'].append(items)

View File

@@ -693,18 +693,12 @@ class MailServerManager(multi.Thread):
try: try:
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command, None, True)
import tldextract import tldextract
extractDomain = tldextract.extract(domainName) no_cache_extract = tldextract.TLDExtract(cache_dir=None)
extractDomain = no_cache_extract(domainName)
domainName = extractDomain.domain + '.' + extractDomain.suffix domainName = extractDomain.domain + '.' + extractDomain.suffix
path = "/etc/opendkim/keys/" + domainName + "/default.txt" path = "/etc/opendkim/keys/" + domainName + "/default.txt"
@@ -772,7 +766,9 @@ class MailServerManager(multi.Thread):
import tldextract import tldextract
extractDomain = tldextract.extract(domainName) no_cache_extract = tldextract.TLDExtract(cache_dir=None)
extractDomain = no_cache_extract(domainName)
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
zone = dnsDomains.objects.get(name=topLevelDomain) zone = dnsDomains.objects.get(name=topLevelDomain)

View File

@@ -115,21 +115,12 @@ class DNS:
ipData = f.read() ipData = f.read()
ipAddress = ipData.split('\n', 1)[0] ipAddress = ipData.split('\n', 1)[0]
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command, None, True)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
import tldextract import tldextract
extractDomain = tldextract.extract(domain) no_cache_extract = tldextract.TLDExtract(cache_dir=None)
extractDomain = no_cache_extract(domain)
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
subDomain = extractDomain.subdomain subDomain = extractDomain.subdomain
@@ -582,7 +573,9 @@ class DNS:
import tldextract import tldextract
extractDomain = tldextract.extract(domain) no_cache_extract = tldextract.TLDExtract(cache_dir=None)
extractDomain = no_cache_extract(domain)
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
subDomain = extractDomain.subdomain subDomain = extractDomain.subdomain

View File

@@ -401,19 +401,13 @@ class mailUtilities:
try: try:
## Generate DKIM Keys ## Generate DKIM Keys
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.6/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command)
command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache'
ProcessUtilities.executioner(command, None, True)
import tldextract import tldextract
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
actualDomain = virtualHostName actualDomain = virtualHostName
extractDomain = tldextract.extract(virtualHostName) extractDomain = no_cache_extract(virtualHostName)
virtualHostName = extractDomain.domain + '.' + extractDomain.suffix virtualHostName = extractDomain.domain + '.' + extractDomain.suffix
if not os.path.exists("/etc/opendkim/keys/" + virtualHostName + "/default.txt"): if not os.path.exists("/etc/opendkim/keys/" + virtualHostName + "/default.txt"):

View File

@@ -339,10 +339,11 @@ class sslUtilities:
import tldextract import tldextract
RetStatus, SAVED_CF_Key, SAVED_CF_Email = ACLManager.FetchCloudFlareAPIKeyFromAcme() RetStatus, SAVED_CF_Key, SAVED_CF_Email = ACLManager.FetchCloudFlareAPIKeyFromAcme()
no_cache_extract = tldextract.TLDExtract(cache_dir=None)
if RetStatus: if RetStatus:
extractDomain = tldextract.extract(virtualHostName) extractDomain = no_cache_extract(virtualHostName)
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
logging.CyberCPLogFileWriter.writeToFile(f'top level domain in cf: {topLevelDomain}') logging.CyberCPLogFileWriter.writeToFile(f'top level domain in cf: {topLevelDomain}')
import CloudFlare import CloudFlare
@@ -375,7 +376,8 @@ class sslUtilities:
from plogical.dnsUtilities import DNS from plogical.dnsUtilities import DNS
from dns.models import Domains from dns.models import Domains
extractDomain = tldextract.extract(virtualHostName) no_cache_extract = tldextract.TLDExtract(cache_dir=None)
extractDomain = no_cache_extract(virtualHostName)
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
zone = Domains.objects.get(name=topLevelDomain) zone = Domains.objects.get(name=topLevelDomain)