1

Topic: fail2ban_banned_db errors in mailq

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.7.2
- Deployed with iRedMail Easy or the downloadable installer? - downloadable
- Linux/BSD distribution name and version: Debian 12.10
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL (Mariadb)
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

fail2ban.log:
'2025-03-21T12:59:10.7443368-7:00 mailhost fail2ban.utils[622]: ERROR 7f410954e9c0 -- stderr: /usr/local/bin/fail2ban_banned_db: 2: Syntax error: newline unexpected'

====

fail2ban.log:
'2025-03-21T12:59:10.7443368-7:00 mailhost fail2ban.utils[622]: ERROR 7f410954e9c0 -- stderr: /usr/local/bin/fail2ban_banned_db: 2: Syntax error: newline unexpected'


I'm now getting the above error after the update yesterday.  How does this get fixed?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: fail2ban_banned_db errors in mailq

Addtionally:

My mail queue keeps filling up with messages pertaining to the error I previously wrote.  Here is the base of one of the emails:

Subject: Cron <root@mailserv> /bin/bashh /usr/local/bin/fail2ban_banned_db unban_db
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin; /bin>
X-Cron-Env: <LOGNAME=root>
Message-Id: <4ZKdd9408Zc76yLS@mailserv.example.com>
Date: Fri, 21 Mar 2025 14:17:01 -0700 (PDT)
Content-Transfer-Encoding: quoted-printable

/usr/local/bin/fail2ban_banned_db: line 1: syntax error near unexpected t=oken 'newline'
/usr/local/bin/fail2ban_banned_db: line 1: '<!DOCTYPE html>'
*** HEADER EXTRACTED active/4ZKdd9408Zc76yLS ***
named_attribute: encoding=7bit
*** MESSAGE FILE END active/4ZKdd9408Zc76yLS ***

Thanks

3

Re: fail2ban_banned_db errors in mailq

I also just checked the fail2ban service and it is active but I have received several errors:

fail2ban.service - Fail2Ban Service
     Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; preset: enabled)
     Active: active (running) since Thu 2025-03-20 19:52:40 PDT; 19h ago
       Docs: man:fail2ban(1)
   Main PID: 622 (fail2ban-server)
      Tasks: 17 (limit: 18946)
     Memory: 32.8M
        CPU: 8min 37.541s
     CGroup: /system.slice/fail2ban.service
             └─622 /usr/bin/python3 /usr/bin/fail2ban-server -xf start

Mar 21 12:59:10 mailserv fail2ban.filter[622]: INFO [pregreet] Found 88.214.25.124 - 2025-03-21 12:59:10
Mar 21 12:59:10 mailserv fail2ban.actions[622]: NOTICE [pregreet] Ban 88.214.25.124
Mar 21 12:59:10 mailserv fail2ban.utils[622]: ERROR 7f410954e9c0 -- exec: ['f2bV_ipjailmatches=$0 \n/usr/local/bin/fail2ban_banned_db ban 88.214.25.124 80,443,25,587,465,110,995,143,993,4190 tcp pregreet 1 $f2bV_ipjailmatches', '2025-03-21T12:59:10.483545-07:00 mailserv postfix/postscreen[21059]: PREGREET 47 after 0 from [88.214.25.124]:65149: \\003\\000\\000/*\\340\\000\\000\\000\\000\\000Cookie: mstshash=Administr\\r\\n\\001\\000\\b\\000\\003\\000\\000\\000']
Mar 21 12:59:10 mailserv fail2ban.utils[622]: ERROR 7f410954e9c0 -- stderr: '/usr/local/bin/fail2ban_banned_db: 2: Syntax error: newline unexpected'
Mar 21 12:59:10 mailserv fail2ban.utils[622]: ERROR 7f410954e9c0 -- returned 2
Mar 21 12:59:10 mailserv fail2ban.utils[622]: ERROR 7f410851e140 -- exec: ['f2bV_ipjailmatches=$0 \n/usr/local/bin/fail2ban_banned_db ban 88.214.25.124 80,443,25,587,465,110,995,143,993,4190 tcp pregreet 1 $f2bV_ipjailmatches', '2025-03-21T12:59:10.483545-07:00 mailserv postfix/postscreen[21059]: PREGREET 47 after 0 from [88.214.25.124]:65149: \\003\\000\\000/*\\340\\000\\000\\000\\000\\000Cookie: mstshash=Administr\\r\\n\\001\\000\\b\\000\\003\\000\\000\\000']
Mar 21 12:59:10 mailserv fail2ban.utils[622]: ERROR 7f410851e140 -- stderr: '/usr/local/bin/fail2ban_banned_db: 2: Syntax error: newline unexpected'
Mar 21 12:59:10 mailserv fail2ban.utils[622]: ERROR 7f410851e140 -- returned 2
Mar 21 12:59:10 mailserv fail2ban.actions[622]: ERROR Failed to execute ban jail 'pregreet' action 'banned_db' info 'ActionInfo({'ip': '88.214.25.124', 'family': 'inet4', 'fid': <function Actions.ActionInfo.<lambda> at 0x7f4109686160>, 'ipjailmatches': '2025-03-21T12:59:10.483545-07:00 mailserv postfix/postscreen[21059]: PREGREET 47 after 0 from [88.214.25.124]:65149: \\003\\000\\000/*\\340\\000\\000\\000\\000\\000Cookie: mstshash=Administr\\r\\n\\001\\000\\b\\000\\003\\000\\000\\000', 'ipjailfailures': 1, 'raw-ticket': <function Actions.ActionInfo.<lambda> at 0x7f41096868e0>})': Error banning 88.214.25.124
Mar 21 13:59:10 mailserv fail2ban.actions[622]: NOTICE [pregreet] Unban 88.214.25.124

4

Re: fail2ban_banned_db errors in mailq

wrdamron wrote:

I'm now getting the above error after the update yesterday.  How does this get fixed?

What update?

wrdamron wrote:

/usr/local/bin/fail2ban_banned_db: line 1: '<!DOCTYPE html>'

Seems you downloaded wrong "fail2ban_banned_db" file, it's a HTML document, not the expected shell script.
Please download this one instead:
https://raw.githubusercontent.com/iredm … _banned_db