diff --git a/tests/test_email.py b/tests/test_email.py index 8308a8e0cc57e4caf661eaf83937d96bf3e651d0..cc8e2eb95db0f6f991da196952b6580024d1920f 100755 --- a/tests/test_email.py +++ b/tests/test_email.py @@ -43,13 +43,17 @@ def print_green(txt): def check_listening_port(): # check that postfix listens the port 25 correctly - status, out = subprocess.getstatusoutput('netstat -pant | grep master | grep 127.0.0.1:25') + status, out = subprocess.getstatusoutput('netstat -pant | grep master | grep ":25"') if status != 0: print_red('The port 25 is not listened by postfix "master" process.') return 1 - else: - print_green('Postfix is listening port 25 correctly.') - return 0 + print_green('Postfix "master" process is listening port 25 correctly.') + if '127.0.0.1:25' not in out: + print_red('Postfix "master" process is not listening address 127.0.0.1, please check postfix configuration.') + print('Postfix should listen address 127.0.0.1 to be sure that this server cannot be used as an SMTP relay by external services.') + return 1 + print_green('Postfix "master" process is listening address 127.0.0.1 correctly.') + return 0 def check_relay():