From 9c5f564528b40c4983d6b130d57472574bad22e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Thu, 25 Jan 2018 09:37:30 +0100
Subject: [PATCH] Changed messages in postfix test (refs #24224).

---
 tests/test_email.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/test_email.py b/tests/test_email.py
index 8308a8e0..cc8e2eb9 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():
-- 
GitLab