Skip to content

Commit

Permalink
bug fix: dns config reset
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Jan 19, 2024
1 parent 539d077 commit 9b3e323
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plogical/virtualHostUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9b3e323

Please sign in to comment.