Skip to content
Snippets Groups Projects
Commit f849ac57 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Ignore brackets in SMTP relay.

parent 79cf6e97
No related branches found
No related tags found
No related merge requests found
...@@ -56,9 +56,9 @@ def check_relay(): ...@@ -56,9 +56,9 @@ def check_relay():
print('Checking if SMTP relay conforms to conf.') print('Checking if SMTP relay conforms to conf.')
status, out = subprocess.getstatusoutput('grep relayhost /etc/postfix/main.cf') status, out = subprocess.getstatusoutput('grep relayhost /etc/postfix/main.cf')
if status == 0: if status == 0:
configured_relay = out[len('relayhost'):].strip(' \t=') configured_relay = out[len('relayhost'):].strip(' \t=[]')
else: else:
configured_relay = None configured_relay = ''
if not configured_relay: if not configured_relay:
# no relay configured, check relayless situations # no relay configured, check relayless situations
ip = conf.get('NETWORK_IP_NAT') ip = conf.get('NETWORK_IP_NAT')
...@@ -74,7 +74,7 @@ def check_relay(): ...@@ -74,7 +74,7 @@ def check_relay():
if ip not in output: if ip not in output:
print_red('ip %s is not in ubicast.eu SPF and emails sent from support@ubicast.eu will be treated as spam' % ip) print_red('ip %s is not in ubicast.eu SPF and emails sent from support@ubicast.eu will be treated as spam' % ip)
return 1 return 1
conf_relay = conf.get('EMAIL_SMTP_SERVER') conf_relay = conf.get('EMAIL_SMTP_SERVER', '').strip('[]')
if conf_relay != configured_relay: if conf_relay != configured_relay:
print_red('Configured STMP relay (%s) does not match the expected value (%s).' % (configured_relay, conf_relay)) print_red('Configured STMP relay (%s) does not match the expected value (%s).' % (configured_relay, conf_relay))
return 1 return 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment