netfilter restarts and clears all bans when F2B regex captures an IPv4 address with trailing colon
Contribution guidelines
- I've read the contribution guidelines and wholeheartedly agree
Checklist prior issue creation
- I understand that failure to follow below instructions may cause this issue to be closed.
- I understand that vague, incomplete or inaccurate information may cause this issue to be closed.
- I understand that this form is intended solely for reporting software bugs and not for support-related inquiries.
- I understand that all responses are voluntary and community-driven, and do not constitute commercial support.
- I confirm that I have reviewed previous issues to ensure this matter has not already been addressed.
- I confirm that my environment meets all prerequisite requirements as specified in the official documentation.
Description
netfilter-mailcow terminates and is automatically restarted when an address received from F2B_CHANNEL contains a trailing colon and is passed to ipaddress.ip_address().
Example:
Error reading log line from pubsub: '98.10.78.59:' does not appear to be an IPv4 or IPv6 addressImmediately afterwards netfilter restarts and executes Clearing all bans.
The issue is reproducible with different remote IPv4 addresses and may prevent authentication failures from reaching the configured ban threshold because the netfilter state is repeatedly cleared.
This was observed with mailcow 2026-09 and ghcr.io/mailcow/netfilter:1.64.
This appears related to #5125, but is currently reproducible and the exception can be traced to an IPv4 address being parsed with a trailing colon.
Steps to reproduce:
- Run mailcow 2026-09 with netfilter 1.64 using the NFTables backend.
- Expose the SMTP submission service normally.
- A remote host connects to the submission service. The problem has occurred both with SASL authentication failures and with a connection that was closed immediately after CONNECT.
- Observe the
netfilter-mailcowlog. - An IPv4 address is received from
F2B_CHANNELwith a trailing colon, for example98.10.78.59:. ipaddress.ip_address()rejects the value and netfilter exits.- Docker automatically restarts the container.
- On startup netfilter reports
Clearing all bans, resetting its state.
The issue has occurred with multiple unrelated source IP addresses and is not specific to one remote host.
Logs:
2026-09-28 - Three different remote IPv4 addresses triggered the same parsing error:
04:14:45
Error reading log line from pubsub: '149.154.1.42:' does not appear to be an IPv4 or IPv6 address
07:03:15
Error reading log line from pubsub: '103.73.107.187:' does not appear to be an IPv4 or IPv6 address
08:31:27
Error reading log line from pubsub: '98.10.78.59:' does not appear to be an IPv4 or IPv6 address
For example, the complete netfilter sequence for the last occurrence was:
2026-09-28 08:31:27 WARN: Error reading log line from pubsub: '98.10.78.59:' does not appear to be an IPv4 or IPv6 address
2026-09-28 08:31:27 INFO: Using NFTables backend
2026-09-28 08:31:27 INFO: Clearing all bans
2026-09-28 08:31:27 INFO: Clear completed: ip
2026-09-28 08:31:27 INFO: Clear completed: ip6
2026-09-28 08:31:27 INFO: Initializing mailcow netfilter chain
2026-09-28 08:31:27 INFO: MAILCOW ip chain created successfully.
2026-09-28 08:31:27 INFO: MAILCOW ip6 chain created successfully.
2026-09-28 08:31:27 INFO: Setting MAILCOW isolation
2026-09-28 08:31:27 INFO: Watching Redis channel F2B_CHANNEL
The corresponding Postfix event for 98.10.78.59 was:
Sep 28 08:31:27 postfix/submission/smtpd[6665]: warning: hostname syn-098-010-078-059.res.spectrum.com does not resolve to address 98.10.78.59: Name or service not known
Sep 28 08:31:27 postfix/submission/smtpd[6665]: connect from unknown[98.10.78.59]
Sep 28 08:31:27 postfix/submission/smtpd[6665]: NOQUEUE: lost connection after CONNECT from unknown[98.10.78.59]
Sep 28 08:31:27 postfix/submission/smtpd[6665]: disconnect from unknown[98.10.78.59] commands=0/0
This source did not attempt SASL authentication.
Another occurrence demonstrates the effect on the authentication counter. After the 07:03:15 netfilter restart:
2026-09-28 07:03:19 WARN: 103.73.107.187 matched rule id 3 (warning: unknown[103.73.107.187]: SASL PLAIN authentication failed: (reason unavailable), [email protected])
2026-09-28 07:03:19 WARN: 1 more attempts in the next 3600 seconds until 103.73.107.187/32 is banned
Container state after observing the issue:
Status=running
RestartCount=14
OOMKilled=false
Image:
ghcr.io/mailcow/netfilter:1.64
Backend:
NFTablesWhich branch are you using?
master (stable)
Which architecture are you using?
x86_64
Operating System:
Debian GNU/Linux 12 (bookworm)
Server/VM specifications:
8 gb, 4 core
Is Apparmor, SELinux or similar active?
yes
Virtualization technology:
kvm
Docker version:
29.7.2
docker-compose version or docker compose version:
v5.5.0
mailcow version:
2026-09
Reverse proxy:
none
Logs of git diff:
Logs of iptables -L -vn:
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
45265 25M MAILCOW 0 -- * * 0.0.0.0/0 0.0.0.0/0 /* mailcow */
855K 521M DOCKER-USER 0 -- * * 0.0.0.0/0 0.0.0.0/0
855K 521M DOCKER-FORWARD 0 -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain DOCKER (2 references)
pkts bytes target prot opt in out source destination
58 3144 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.253 tcp dpt:587
41 2396 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.253 tcp dpt:465
53 3004 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.253 tcp dpt:25
214 12840 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.11 tcp dpt:443
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.11 tcp dpt:80
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:12345
1 60 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:4190
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:995
68 3775 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:993
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:143
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:110
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.5 tcp dpt:3306
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.249 tcp dpt:6379
0 0 DROP 0 -- !docker0 docker0 0.0.0.0/0 0.0.0.0/0
0 0 DROP 0 -- !br-mailcow br-mailcow 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-BRIDGE (1 references)
pkts bytes target prot opt in out source destination
0 0 DOCKER 0 -- * docker0 0.0.0.0/0 0.0.0.0/0
435 25219 DOCKER 0 -- * br-mailcow 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-CT (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT 0 -- * docker0 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
496K 469M ACCEPT 0 -- * br-mailcow 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
Chain DOCKER-FORWARD (1 references)
pkts bytes target prot opt in out source destination
855K 521M DOCKER-CT 0 -- * * 0.0.0.0/0 0.0.0.0/0
359K 53M DOCKER-INTERNAL 0 -- * * 0.0.0.0/0 0.0.0.0/0
359K 53M DOCKER-BRIDGE 0 -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT 0 -- docker0 * 0.0.0.0/0 0.0.0.0/0
358K 53M ACCEPT 0 -- br-mailcow * 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-INTERNAL (1 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
Chain MAILCOW (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP 6 -- !br-mailcow br-mailcow 0.0.0.0/0 0.0.0.0/0 /* mailcow isolation */Logs of ip6tables -L -vn:
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 MAILCOW 0 -- * * ::/0 ::/0 /* mailcow */
0 0 DOCKER-USER 0 -- * * ::/0 ::/0
0 0 DOCKER-FORWARD 0 -- * * ::/0 ::/0
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain DOCKER (0 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-BRIDGE (1 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-CT (1 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-FORWARD (1 references)
pkts bytes target prot opt in out source destination
0 0 DOCKER-CT 0 -- * * ::/0 ::/0
0 0 DOCKER-INTERNAL 0 -- * * ::/0 ::/0
0 0 DOCKER-BRIDGE 0 -- * * ::/0 ::/0
Chain DOCKER-INTERNAL (1 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
Chain MAILCOW (1 references)
pkts bytes target prot opt in out source destinationLogs of iptables -L -vn -t nat:
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
1271 68559 DOCKER 0 -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 DOCKER 0 -- * * 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
169K 13M MASQUERADE 0 -- * !br-mailcow 172.22.1.0/24 0.0.0.0/0
0 0 MASQUERADE 0 -- * !docker0 172.17.0.0/16 0.0.0.0/0
Chain DOCKER (2 references)
pkts bytes target prot opt in out source destination
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 127.0.0.1 tcp dpt:7654 to:172.22.1.249:6379
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 127.0.0.1 tcp dpt:13306 to:172.22.1.5:3306
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:110 to:172.22.1.250:110
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:143 to:172.22.1.250:143
68 3775 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:993 to:172.22.1.250:993
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:995 to:172.22.1.250:995
1 60 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:4190 to:172.22.1.250:4190
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 127.0.0.1 tcp dpt:19991 to:172.22.1.250:12345
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:172.22.1.11:80
214 12840 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 to:172.22.1.11:443
56 3184 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 to:172.22.1.253:25
41 2396 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:465 to:172.22.1.253:465
888 46080 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:587 to:172.22.1.253:587Logs of ip6tables -L -vn -t nat:
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 DOCKER 0 -- * * ::/0 ::/0 ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 DOCKER 0 -- * * ::/0 !::1 ADDRTYPE match dst-type LOCAL
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain DOCKER (2 references)
pkts bytes target prot opt in out source destinationDNS check:
198.252.206.1Source: mailcow/mailcow-dockerized