From 964141fcf26b3470a5b12f729ca0ffcb79c25e72 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 24 Sep 2023 17:44:30 +0400 Subject: [PATCH] bug fix: dkim permissions --- cloudAPI/cloudManager.py | 6 +++--- mailServer/mailserverManager.py | 4 ++-- plogical/dnsUtilities.py | 7 +++++-- plogical/mailUtilities.py | 2 +- plogical/test.py | 21 +++++++++++++++++++++ 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/cloudAPI/cloudManager.py b/cloudAPI/cloudManager.py index a62696ac1..34f86a4bd 100755 --- a/cloudAPI/cloudManager.py +++ b/cloudAPI/cloudManager.py @@ -2832,7 +2832,7 @@ def SwitchDNS(self): command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command) - command = 'chown cyberpanel:cyberpanel /usr/local/CyberCP/lib/python3.10/site-packages/tldextract/.suffix_cache/urls/*.tldextract.json' + command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command, None, True) ## @@ -2855,7 +2855,7 @@ def SwitchDNS(self): command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command) - command = 'chown cyberpanel:cyberpanel /usr/local/CyberCP/lib/python3.10/site-packages/tldextract/.suffix_cache/urls/*.tldextract.json' + 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(): @@ -2903,7 +2903,7 @@ def SwitchDNS(self): command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command) - command = 'chown cyberpanel:cyberpanel /usr/local/CyberCP/lib/python3.10/site-packages/tldextract/.suffix_cache/urls/*.tldextract.json' + command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command, None, True) from websiteFunctions.models import ChildDomains diff --git a/mailServer/mailserverManager.py b/mailServer/mailserverManager.py index d4c852494..be592fbe8 100755 --- a/mailServer/mailserverManager.py +++ b/mailServer/mailserverManager.py @@ -665,7 +665,7 @@ def fetchDKIMKeys(self): command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command) - command = 'chown cyberpanel:cyberpanel /usr/local/CyberCP/lib/python3.10/site-packages/tldextract/.suffix_cache/urls/*.tldextract.json' + command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command, None, True) import tldextract @@ -733,7 +733,7 @@ def generateDKIMKeys(self): command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command) - command = 'chown cyberpanel:cyberpanel /usr/local/CyberCP/lib/python3.10/site-packages/tldextract/.suffix_cache/urls/*.tldextract.json' + command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command, None, True) import tldextract diff --git a/plogical/dnsUtilities.py b/plogical/dnsUtilities.py index 1c9f0cb77..3dd073f48 100755 --- a/plogical/dnsUtilities.py +++ b/plogical/dnsUtilities.py @@ -120,9 +120,12 @@ def dnsTemplate(domain, admin): command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command) - command = 'chown cyberpanel:cyberpanel /usr/local/CyberCP/lib/python3.10/site-packages/tldextract/.suffix_cache/urls/*.tldextract.json' + 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 extractDomain = tldextract.extract(domain) @@ -529,7 +532,7 @@ def createDKIMRecords(domain): command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command) - command = 'chown cyberpanel:cyberpanel /usr/local/CyberCP/lib/python3.10/site-packages/tldextract/.suffix_cache/urls/*.tldextract.json' + command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command, None, True) import tldextract diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index b4a69ce0d..cf8a9548c 100755 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -314,7 +314,7 @@ def setupDKIM(virtualHostName): command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python3.8/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command) - command = 'chown cyberpanel:cyberpanel /usr/local/CyberCP/lib/python3.10/site-packages/tldextract/.suffix_cache/urls/*.tldextract.json' + command = 'chown cyberpanel:cyberpanel -R /usr/local/CyberCP/lib/python*/site-packages/tldextract/.suffix_cache' ProcessUtilities.executioner(command, None, True) import tldextract diff --git a/plogical/test.py b/plogical/test.py index e69de29bb..326ae7668 100644 --- a/plogical/test.py +++ b/plogical/test.py @@ -0,0 +1,21 @@ +import re + + +def extract_domain_parts(domain): + # Use a regular expression to extract the domain parts + pattern = r'(?:\w+\.)?(\w+)\.(\w+)' + match = re.match(pattern, domain) + + if match: + subdomain = match.group(1) + top_level_domain = match.group(2) + return subdomain, top_level_domain + else: + return None, None + + +# Example usage +domain = "sub.example.ae" +subdomain, top_level_domain = extract_domain_parts(domain) +print("Subdomain:", subdomain) +print("Top-Level Domain:", top_level_domain)