TLS patch
parent
2878dc3a05
commit
320de5bd89
|
@ -18,6 +18,10 @@ from .resolver import updateDNS
|
||||||
smtprelayport = '10025'
|
smtprelayport = '10025'
|
||||||
bindip = '0.0.0.0'
|
bindip = '0.0.0.0'
|
||||||
|
|
||||||
|
cacerts = '/etc/ssl/certs/ca-certificates.crt'
|
||||||
|
keyfile = '/var/run/secrets/keyfile'
|
||||||
|
certfile = '/var/run/secrets/certfile'
|
||||||
|
|
||||||
if not os.environ.get('SMTP_HOSTNAME'):
|
if not os.environ.get('SMTP_HOSTNAME'):
|
||||||
banner_hostname = 'midominio.cl'
|
banner_hostname = 'midominio.cl'
|
||||||
else:
|
else:
|
||||||
|
@ -43,7 +47,7 @@ async def enviarCorreosDominio(dominioid):
|
||||||
try:
|
try:
|
||||||
conectado = False
|
conectado = False
|
||||||
try:
|
try:
|
||||||
smtp = aiosmtplib.SMTP(hostname=str(dbdireccion.ipaddr), port=465, use_tls=True, validate_certs=False, timeout=10)
|
smtp = aiosmtplib.SMTP(hostname=str(dbdireccion.ipaddr), source_address=banner_hostname, port=465, use_tls=True, validate_certs=True, client_cert=certfile, client_key=keyfile, cert_bundle=cacerts, timeout=10)
|
||||||
await smtp.connect()
|
await smtp.connect()
|
||||||
conectado = True
|
conectado = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -52,7 +56,7 @@ async def enviarCorreosDominio(dominioid):
|
||||||
|
|
||||||
if conectado == False:
|
if conectado == False:
|
||||||
try:
|
try:
|
||||||
smtp = aiosmtplib.SMTP(hostname=str(dbdireccion.ipaddr), port=587, use_tls=False, validate_certs=False, timeout=10)
|
smtp = aiosmtplib.SMTP(hostname=str(dbdireccion.ipaddr), source_address=banner_hostname, port=587, use_tls=True, validate_certs=True, client_cert=certfile, client_key=keyfile, cert_bundle=cacerts, timeout=10)
|
||||||
await smtp.connect()
|
await smtp.connect()
|
||||||
await smtp.starttls()
|
await smtp.starttls()
|
||||||
conectado = True
|
conectado = True
|
||||||
|
|
Loading…
Reference in New Issue