[BR]: _grep_logs doesn't work properly with IPv6
Environment:
- Fail2Ban version : 1.0.2-3ubuntu0.1
- OS, including release name/version : Ubuntu 24.04.4 LTS
- Fail2Ban installed via OS/distribution mechanisms
- You have not applied any additional foreign patches to the codebase
- Some customizations were done to the configuration (provide details below is so)
The issue:
In helpers-common.conf the _grep_logs resp. _grep_logs_args will look for the compressed form of the IPv6 address, e.g. 2a04:5200:fff1::19b The problem is that the log files may contain either the above compressed form of the IPv6 2a04:5200:fff1::19b or the uncompressed form of the IPv6 which is 2a04:5200:fff1:0:0:0:0:19b Obviously grep should look for both versions and also it should search case-insensitive because the address could also be written as 2A04:5200:FFF1::19B or 2A04:5200:FFF1:0:0:0:0:19B or even mixed I guess.
Steps to reproduce
Have F2B detect 2a04:5200:fff1:0:0:0:0:19b as attacker from the log, using complain action try to send out the log lines.
Expected behavior
The attacking log lines should be listed, no matter whether in compressed or uncompressed form.
Observed behavior
The attacking log lines are missing from the complain message.
Any additional information
Note that this isn't specific to the complain action. The problem is in the way that F2B uses only the compressed form to grep while it should additionally use the uncompressed form of the IPv6 to grep.
Configuration, dump and another helpful excerpts
I've checked helpers-common.conf in github.com and it's still the same version that we use, so I'm pretty sure the problem exists in the latest version of F2B.
Any customizations done to /etc/fail2ban/ configuration
Quite some over the last 20+ years, but actually that should not matter at all for this issue.
Relevant parts of /var/log/fail2ban.log file:
The contents of the of /var/log/fail2ban.log file don't matter for this issue.
Relevant lines from monitored log files:
2026-06-17T21:18:07.372313+02:00 www sm-mta[989557]: STARTTLS=server, error: accept failed=-1, reason=sslv3 alert bad certificate, SSL_error=1, errno=0, retry=-1, relay=602.tr.gws.ru [IPv6:2a04:5200:fff1:0:0:0:0:19b] (may be forged)
2026-06-17T21:18:07.374317+02:00 www sm-mta[989557]: 65HJI59Y989557: 602.tr.gws.ru [IPv6:2a04:5200:fff1:0:0:0:0:19b] (may be forged) did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA-v6
2026-06-17T21:18:09.599528+02:00 www sm-mta[989563]: 65HJI7eF989563: AUTH failure (PLAIN): authentication failure (-13) SASL(-13): authentication failure: Password verification failed, [email protected], relay=602.tr.gws.ru [IPv6:2a04:5200:fff1:0:0:0:0:19b] (may be forged)
2026-06-17T21:18:09.715926+02:00 www sm-mta[989563]: 65HJI7eF989563: 602.tr.gws.ru [IPv6:2a04:5200:fff1:0:0:0:0:19b] (may be forged) did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA-v6Source: fail2ban/fail2ban