1

Topic: /var/log/daemon: fail2ban.utils[xxx]: ERROR xxx No such file or direct

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version 1.7.1
- Deployed with iRedMail downloadable installer
- OpenBSD 7.4
- Store mail accounts in PGSQL
- Web server Nginx
- Manage mail accounts with iRedAdmin-Pro? No
====

Looks like there may be a typo in one of the fail2ban scripts, as I'm getting the following errors in /var/log/daemon:

Nov  3 03:59:55 mail fail2ban.utils[xxxxx]: ERROR aba98f31c40 -- exec: ['f2bV_ipjailmatches=$0 \n/usr/local/bin/fail2ban_banned_db ban 165.154.208.108 80,443,25,587,465,110,995,143,993,4190 tcp postfix 5 $f2bV_ipjailmatches', 'Nov  3 03:59:45 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:48 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:50 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:52 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:54 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]']
Nov  3 03:59:55 mail fail2ban.utils[xxxxx]: ERROR aba98f31c40 -- stderr: 'env: bash: No such file or directory'
Nov  3 03:59:55 mail fail2ban.utils[xxxxx]: ERROR aba98f31c40 -- returned 127
Nov  3 03:59:55 mail fail2ban.utils[xxxxx]: ERROR aba98f14a00 -- exec: ['f2bV_ipjailmatches=$0 \n/usr/local/bin/fail2ban_banned_db ban 165.154.208.108 80,443,25,587,465,110,995,143,993,4190 tcp postfix 5 $f2bV_ipjailmatches', 'Nov  3 03:59:45 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:48 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:50 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:52 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:54 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]']
Nov  3 03:59:55 mail fail2ban.utils[xxxxx]: ERROR aba98f14a00 -- stderr: 'env: bash: No such file or directory'
Nov  3 03:59:55 mail fail2ban.utils[xxxxx]: ERROR aba98f14a00 -- returned 127
Nov  3 03:59:55 mail fail2ban.actions[xxxxx]: ERROR Failed to execute ban jail 'postfix' action 'banned_db' info 'ActionInfo({'ip': '165.154.208.108', 'family': 'inet4', 'fid': <function Actions.ActionInfo.<lambda> at 0xaba98e80040>, 'ipjailmatches': 'Nov  3 03:59:45 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:48 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:50 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:52 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]\nNov  3 03:59:54 mail postfix/smtpd[xxxxx]: lost connection after AUTH from unknown[165.154.208.108]', 'ipjailfailures': 5, 'raw-ticket': <function Actions.ActionInfo.<lambda> at 0xaba98e80700>})': Error banning 165.154.208.108

----

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

2

Re: /var/log/daemon: fail2ban.utils[xxx]: ERROR xxx No such file or direct

Please install package "bash".
Did you remove it after iRedMail installation?

3 (edited by Neovana 2024-11-04 12:02:14)

Re: /var/log/daemon: fail2ban.utils[xxx]: ERROR xxx No such file or direct

ZhangHuangbin wrote:

Please install package "bash".
Did you remove it after iRedMail installation?

I did not remove it, it is still installed.

% which bash
/usr/local/bin/bash

I feel like there is an issue with:

exec: ['f2bV_ipjailmatches=$0 \n/usr/local/bin/fail2ban_banned_db ban 165.154.208.108 80,443,25,587,465,110,995,143,993,4190 tcp postfix 5 $f2bV_ipjailmatches', '

Maybe with the spacing after "\n"?

4

Re: /var/log/daemon: fail2ban.utils[xxx]: ERROR xxx No such file or direct

Neovana wrote:
ZhangHuangbin wrote:

Please install package "bash".
Did you remove it after iRedMail installation?

I did not remove it, it is still installed.

% which bash
/usr/local/bin/bash

I feel like there is an issue with:

exec: ['f2bV_ipjailmatches=$0 \n/usr/local/bin/fail2ban_banned_db ban 165.154.208.108 80,443,25,587,465,110,995,143,993,4190 tcp postfix 5 $f2bV_ipjailmatches', '

Maybe with the spacing after "\n"?

This is so unclear and confusing.

5

Re: /var/log/daemon: fail2ban.utils[xxx]: ERROR xxx No such file or direct

Neovana wrote:

Nov  3 03:59:55 mail fail2ban.utils[xxxxx]: ERROR aba98f31c40 -- stderr: 'env: bash: No such file or directory'

Seems shell script with shabang line "#!/usr/bin/env bash" doesn't work.

Does it work if you replace the first line in /usr/local/bin/fail2ban_banned_db by below one?

#!/usr/local/bin/bash

6

Re: /var/log/daemon: fail2ban.utils[xxx]: ERROR xxx No such file or direct

ZhangHuangbin wrote:
Neovana wrote:

Nov  3 03:59:55 mail fail2ban.utils[xxxxx]: ERROR aba98f31c40 -- stderr: 'env: bash: No such file or directory'

Seems shell script with shabang line "#!/usr/bin/env bash" doesn't work.

Does it work if you replace the first line in /usr/local/bin/fail2ban_banned_db by below one?

#!/usr/local/bin/bash

Changing the shabang line solved that problem, but also fail2ban will not load jails after a reboot. I have to manually reload them with this command:

doas fail2ban-client -x reload

Is there a way to have the jails load upon boot?

7

Re: /var/log/daemon: fail2ban.utils[xxx]: ERROR xxx No such file or direct

Neovana wrote:

Is there a way to have the jails load upon boot?

I have same issue on OpenBSD 7.6, but starting / restarting fail2ban service loads the jails correctly.
Didn't figure out why it happens yet. sad