diff --git a/config/filter.d/postfix.conf b/config/filter.d/postfix.conf
index 1cf54f14..e6a3e5c2 100644
--- a/config/filter.d/postfix.conf
+++ b/config/filter.d/postfix.conf
@@ -10,16 +10,17 @@ before = common.conf
[Definition]
-_daemon = postfix(-\w+)?/(?:submission/|smtps/)?smtp[ds]
+_daemon = postfix(-\w+)?/\w+(?:/smtp[ds])?
+_port = (?::\d+)?
prefregex = ^%(__prefix_line)s(?:NOQUEUE: reject:|improper command pipelining) .+$
-failregex = ^RCPT from \S+\[\]: 554 5\.7\.1
- ^RCPT from \S+\[\]: 450 4\.7\.1 Client host rejected: cannot find your (reverse )?hostname\b
- ^RCPT from \S+\[\]: 450 4\.7\.1 (<[^>]*>)?: Helo command rejected: Host not found\b
- ^EHLO from \S+\[\]: 504 5\.5\.2 (<[^>]*>)?: Helo command rejected: need fully-qualified hostname\b
- ^VRFY from \S+\[\]: 550 5\.1\.1
- ^RCPT from \S+\[\]: 450 4\.1\.8 (<[^>]*>)?: Sender address rejected: Domain not found\b
+failregex = ^RCPT from [^[]*\[\]<_port>: 55[04] 5\.7\.1\s
+ ^RCPT from [^[]*\[\]<_port>: 450 4\.7\.1 Client host rejected: cannot find your (reverse )?hostname\b
+ ^RCPT from [^[]*\[\]<_port>: 450 4\.7\.1 (<[^>]*>)?: Helo command rejected: Host not found\b
+ ^EHLO from [^[]*\[\]<_port>: 504 5\.5\.2 (<[^>]*>)?: Helo command rejected: need fully-qualified hostname\b
+ ^VRFY from [^[]*\[\]<_port>: 550 5\.1\.1\s
+ ^RCPT from [^[]*\[\]<_port>: 450 4\.1\.8 (<[^>]*>)?: Sender address rejected: Domain not found\b
^after \S+ from [^[]*\[\]:?
ignoreregex =
diff --git a/fail2ban/tests/files/logs/postfix b/fail2ban/tests/files/logs/postfix
index c38ba311..7f24cdd0 100644
--- a/fail2ban/tests/files/logs/postfix
+++ b/fail2ban/tests/files/logs/postfix
@@ -44,3 +44,6 @@ Jun 12 08:58:35 xxx postfix/smtpd[2931]: NOQUEUE: reject: RCPT from unknown[1.2.
# failJSON: { "time": "2005-06-12T08:58:35", "match": true , "host": "1.2.3.4" }
Jun 12 08:58:35 xxx postfix/smtpd[13533]: improper command pipelining after AUTH from unknown[1.2.3.4]: QUIT
+
+# failJSON: { "time": "2005-05-05T15:51:11", "match": true , "host": "216.245.194.173", "desc": "postfix postscreen / gh-1764" }
+May 5 15:51:11 xxx postfix/postscreen[1148]: NOQUEUE: reject: RCPT from [216.245.194.173]:60591: 550 5.7.1 Service unavailable; client [216.245.194.173] blocked using rbl.example.com; from=, to=, proto=ESMTP, helo=