From 9b3e323cf75330774d8b0bac4f9e38d88c8a9cb5 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 19 Jan 2024 11:54:23 +0500 Subject: [PATCH] bug fix: dns config reset --- plogical/virtualHostUtilities.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plogical/virtualHostUtilities.py b/plogical/virtualHostUtilities.py index fa64f2918..11e61de42 100644 --- a/plogical/virtualHostUtilities.py +++ b/plogical/virtualHostUtilities.py @@ -128,7 +128,6 @@ def OnBoardingHostName(Domain, tempStatusPath): command = 'systemctl restart postfix && systemctl restart dovecot && postmap -F hash:/etc/postfix/vmail_ssl.map' ProcessUtilities.executioner(command, 'root', True) logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Completed. [200]') - else: ### Case 2 where postfix hostname either does not exist or does not match with server hostname or @@ -138,6 +137,7 @@ def OnBoardingHostName(Domain, tempStatusPath): if Domain != rDNS: message = 'Domain that you have provided is not configured as rDNS for your server IP. [404]' + print(message) logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, message) logging.CyberCPLogFileWriter.writeToFile(message) return 0 @@ -173,6 +173,9 @@ def OnBoardingHostName(Domain, tempStatusPath): if SSLProvider == 'Denial': virtualHostUtilities.issueSSLForMailServer(Domain, path) + x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, open(filePath, 'r').read()) + SSLProvider = x509.get_issuer().get_components()[1][1].decode('utf-8') + if SSLProvider == 'Denial': message = 'Failed to issue Mail server SSL, either its DNS record is not propagated or the domain ie behind Cloudflare. [404]' logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, message)