ssl improvement
This commit is contained in:
parent
4d7662597d
commit
b3ad1e4b8b
|
|
@ -1125,7 +1125,10 @@
|
|||
<p>{{ onboardingError | safe }}</p>
|
||||
</div>
|
||||
{% elif onboarding == 3 %}
|
||||
<p>Looks like something is wrong with your initial setup, please double check on <a href="/base/onboarding">Setup Wizard.</a> </p>
|
||||
<div ng-hide="success" class="alert alert-info">
|
||||
<p>Looks like something is wrong with your initial setup, please double check on <a
|
||||
href="/base/onboarding">Setup Wizard.</a></p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -451,10 +451,10 @@ context /.well-known/acme-challenge {
|
|||
|
||||
Status = 1
|
||||
|
||||
if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||
retStatus, message = sslv2.obtainSSLForADomain(virtualHostName, adminEmail, sslpath, aliasDomain)
|
||||
if retStatus == 1:
|
||||
return retStatus
|
||||
# if (Status == 1) or ProcessUtilities.decideServer() == ProcessUtilities.ent:
|
||||
# retStatus, message = sslv2.obtainSSLForADomain(virtualHostName, adminEmail, sslpath, aliasDomain)
|
||||
# if retStatus == 1:
|
||||
# return retStatus
|
||||
|
||||
if sslUtilities.CheckIfSSLNeedsToBeIssued(virtualHostName) == sslUtilities.ISSUE_SSL:
|
||||
pass
|
||||
|
|
|
|||
124
plogical/test.py
124
plogical/test.py
|
|
@ -1,67 +1,67 @@
|
|||
|
||||
import imaplib
|
||||
import getpass
|
||||
from email import message_from_string
|
||||
|
||||
# IMAP server settings
|
||||
imap_server = 'mail.wpmautic.net'
|
||||
imap_port = 993
|
||||
|
||||
# User credentials
|
||||
email_address = 'usman@wpmautic.net'
|
||||
password = getpass.getpass("Enter your email password: ")
|
||||
|
||||
# Connect to the IMAP server
|
||||
mail = imaplib.IMAP4_SSL(imap_server, imap_port)
|
||||
|
||||
# Log in to the mailbox
|
||||
mail.login(email_address, password)
|
||||
|
||||
# Select the INBOX
|
||||
mail.select("inbox")
|
||||
|
||||
# Search for all emails in the INBOX
|
||||
result, data = mail.search(None, "ALL")
|
||||
email_ids = data[0].split()
|
||||
|
||||
# Fetch and print header information for each email
|
||||
for email_id in email_ids:
|
||||
result, message_data = mail.fetch(email_id, "(BODY[HEADER.FIELDS (FROM TO SUBJECT DATE)])")
|
||||
raw_email = message_data[0][1].decode('utf-8')
|
||||
msg = message_from_string(raw_email)
|
||||
print(f"Email ID: {email_id}")
|
||||
print(f"From: {msg['From']}")
|
||||
print(f"To: {msg['To']}")
|
||||
print(f"Subject: {msg['Subject']}")
|
||||
print(f"Date: {msg['Date']}")
|
||||
print("-" * 30)
|
||||
|
||||
# Logout
|
||||
mail.logout()
|
||||
|
||||
# from cryptography import x509
|
||||
# from cryptography.hazmat.backends import default_backend
|
||||
#
|
||||
# def get_domains_covered(cert_path):
|
||||
# with open(cert_path, 'rb') as cert_file:
|
||||
# cert_data = cert_file.read()
|
||||
# cert = x509.load_pem_x509_certificate(cert_data, default_backend())
|
||||
# import imaplib
|
||||
# import getpass
|
||||
# from email import message_from_string
|
||||
#
|
||||
# # Check for the Subject Alternative Name (SAN) extension
|
||||
# san_extension = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName)
|
||||
# # IMAP server settings
|
||||
# imap_server = 'mail.wpmautic.net'
|
||||
# imap_port = 993
|
||||
#
|
||||
# if san_extension:
|
||||
# # Extract and print the domains from SAN
|
||||
# san_domains = san_extension.value.get_values_for_type(x509.DNSName)
|
||||
# return san_domains
|
||||
# else:
|
||||
# # If SAN is not present, return the Common Name as a fallback
|
||||
# return [cert.subject.get_attributes_for_oid(x509.NameOID.COMMON_NAME)[0].value]
|
||||
# # User credentials
|
||||
# email_address = 'usman@wpmautic.net'
|
||||
# password = getpass.getpass("Enter your email password: ")
|
||||
#
|
||||
# # Example usage
|
||||
# cert_path = '/etc/letsencrypt/live/cyberplanner.io/fullchain.pem'
|
||||
# domains_covered = get_domains_covered(cert_path)
|
||||
# # Connect to the IMAP server
|
||||
# mail = imaplib.IMAP4_SSL(imap_server, imap_port)
|
||||
#
|
||||
# print("Domains covered by the certificate:")
|
||||
# for domain in domains_covered:
|
||||
# print(domain)
|
||||
# # Log in to the mailbox
|
||||
# mail.login(email_address, password)
|
||||
#
|
||||
# # Select the INBOX
|
||||
# mail.select("inbox")
|
||||
#
|
||||
# # Search for all emails in the INBOX
|
||||
# result, data = mail.search(None, "ALL")
|
||||
# email_ids = data[0].split()
|
||||
#
|
||||
# # Fetch and print header information for each email
|
||||
# for email_id in email_ids:
|
||||
# result, message_data = mail.fetch(email_id, "(BODY[HEADER.FIELDS (FROM TO SUBJECT DATE)])")
|
||||
# raw_email = message_data[0][1].decode('utf-8')
|
||||
# msg = message_from_string(raw_email)
|
||||
# print(f"Email ID: {email_id}")
|
||||
# print(f"From: {msg['From']}")
|
||||
# print(f"To: {msg['To']}")
|
||||
# print(f"Subject: {msg['Subject']}")
|
||||
# print(f"Date: {msg['Date']}")
|
||||
# print("-" * 30)
|
||||
#
|
||||
# # Logout
|
||||
# mail.logout()
|
||||
#
|
||||
# # from cryptography import x509
|
||||
# # from cryptography.hazmat.backends import default_backend
|
||||
# #
|
||||
# # def get_domains_covered(cert_path):
|
||||
# # with open(cert_path, 'rb') as cert_file:
|
||||
# # cert_data = cert_file.read()
|
||||
# # cert = x509.load_pem_x509_certificate(cert_data, default_backend())
|
||||
# #
|
||||
# # # Check for the Subject Alternative Name (SAN) extension
|
||||
# # san_extension = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName)
|
||||
# #
|
||||
# # if san_extension:
|
||||
# # # Extract and print the domains from SAN
|
||||
# # san_domains = san_extension.value.get_values_for_type(x509.DNSName)
|
||||
# # return san_domains
|
||||
# # else:
|
||||
# # # If SAN is not present, return the Common Name as a fallback
|
||||
# # return [cert.subject.get_attributes_for_oid(x509.NameOID.COMMON_NAME)[0].value]
|
||||
# #
|
||||
# # # Example usage
|
||||
# # cert_path = '/etc/letsencrypt/live/cyberplanner.io/fullchain.pem'
|
||||
# # domains_covered = get_domains_covered(cert_path)
|
||||
# #
|
||||
# # print("Domains covered by the certificate:")
|
||||
# # for domain in domains_covered:
|
||||
# # print(domain)
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ class virtualHostUtilities:
|
|||
SSLProvider = x509.get_issuer().get_components()[1][1].decode('utf-8')
|
||||
|
||||
if SSLProvider == 'Denial':
|
||||
message = 'Failed to issue Hostname SSL, either its DNS record is not propagated or the domain ie behind Cloudflare. [404]'
|
||||
message = 'Failed to issue Hostname SSL, either its DNS record is not propagated or the domain is behind Cloudflare. [404]'
|
||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, message)
|
||||
logging.CyberCPLogFileWriter.writeToFile(message)
|
||||
config['hostname'] = Domain
|
||||
|
|
@ -262,7 +262,7 @@ class virtualHostUtilities:
|
|||
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]'
|
||||
message = 'Failed to issue Mail server SSL, either its DNS record is not propagated or the domain is behind Cloudflare. [404]'
|
||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, message)
|
||||
logging.CyberCPLogFileWriter.writeToFile(message)
|
||||
config['hostname'] = Domain
|
||||
|
|
|
|||
Loading…
Reference in New Issue