:: Re: [DNG] fail2ban doesn't work on …
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: piorunz
Ημερομηνία:  
Προς: dng
Αντικείμενο: Re: [DNG] fail2ban doesn't work on Excalibur
Hi Nick,

As I replied to other Nick just now, backend is already on auto in
default settings file.

Not sure what else I could do.

$ grep "backend =" /etc/fail2ban/jail.conf
backend = auto
backend = %(sshd_backend)s
#backend = %(syslog_backend)s
backend = %(syslog_backend)s
backend = %(postfix_backend)s
backend = %(syslog_backend)s
backend = %(dovecot_backend)s
backend = %(dovecot_backend)s
backend = %(syslog_backend)s
backend = %(syslog_backend)s
backend = %(syslog_backend)s
backend = %(syslog_backend)s

I tried creating jail.local with the following:
$ cat jail.local
[DEFAULT]
backend = auto

But there is no change, fail2ban outputs:
$ sudo service fail2ban start
Starting Authentication failure monitor: fail2ban2025-11-06 16:04:51,004 
fail2ban                [22161]: ERROR   NOK: (38, 'Function not 
implemented')
  failed!


I also tried to run it directly:
$ sudo fail2ban-server -v
2025-11-06 16:05:44,098 fail2ban.configreader   [22260]: INFO    Loading 
configs for fail2ban under /etc/fail2ban
2025-11-06 16:05:44,099 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/fail2ban.conf']
2025-11-06 16:05:44,099 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/fail2ban.conf']
2025-11-06 16:05:44,099 fail2ban                [22260]: INFO    Using 
socket file /var/run/fail2ban/fail2ban.sock
2025-11-06 16:05:44,099 fail2ban                [22260]: INFO    Using 
pid file /var/run/fail2ban/fail2ban.pid, [INFO] logging to 
/var/log/fail2ban.log
2025-11-06 16:05:44,100 fail2ban.configreader   [22260]: INFO    Loading 
configs for jail under /etc/fail2ban
2025-11-06 16:05:44,100 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/jail.conf']
2025-11-06 16:05:44,104 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/paths-debian.conf']
2025-11-06 16:05:44,105 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/paths-common.conf']
2025-11-06 16:05:44,105 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/paths-overrides.local']
2025-11-06 16:05:44,105 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/jail.d/defaults-debian.conf']
2025-11-06 16:05:44,105 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/jail.local']
2025-11-06 16:05:44,105 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/paths-common.conf', 
'/etc/fail2ban/paths-debian.conf', '/etc/fail2ban/jail.conf', 
'/etc/fail2ban/jail.d/defaults-debian.conf', '/etc/fail2ban/jail.local']
2025-11-06 16:05:44,105 fail2ban.configreader   [22260]: INFO    Loading 
configs for filter.d/sshd under /etc/fail2ban
2025-11-06 16:05:44,106 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/filter.d/sshd.conf']
2025-11-06 16:05:44,106 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/filter.d/common.conf']
2025-11-06 16:05:44,107 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/filter.d/common.local']
2025-11-06 16:05:44,107 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/filter.d/common.conf', 
'/etc/fail2ban/filter.d/sshd.conf']
2025-11-06 16:05:44,108 fail2ban.configreader   [22260]: INFO    Loading 
configs for action.d/nftables under /etc/fail2ban
2025-11-06 16:05:44,108 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/action.d/nftables.conf']
2025-11-06 16:05:44,108 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/action.d/nftables-common.local']
2025-11-06 16:05:44,108 fail2ban.configparserinc[22260]: INFO 
Loading files: ['/etc/fail2ban/action.d/nftables.conf']
2025-11-06 16:05:44,118 fail2ban.server         [22260]: INFO 
Starting in daemon mode
2025-11-06 16:05:44,124 fail2ban                [22260]: ERROR   NOK: 
(38, 'Function not implemented')
Server ready
2025-11-06 16:05:44,124 fail2ban.server         [22260]: INFO 
Shutdown in progress...
2025-11-06 16:05:44,124 fail2ban.server         [22260]: INFO 
Stopping all jails
2025-11-06 16:05:44,124 fail2ban.server         [22260]: INFO    Exiting 
Fail2ban


It says exiting, but the process is actually running.
$ sudo fail2ban-server -v
2025-11-06 16:06:31,802 fail2ban.configreader   [22310]: INFO    Loading 
configs for fail2ban under /etc/fail2ban
2025-11-06 16:06:31,803 fail2ban.configparserinc[22310]: INFO 
Loading files: ['/etc/fail2ban/fail2ban.conf']
2025-11-06 16:06:31,803 fail2ban.configparserinc[22310]: INFO 
Loading files: ['/etc/fail2ban/fail2ban.conf']
2025-11-06 16:06:31,803 fail2ban                [22310]: INFO    Using 
socket file /var/run/fail2ban/fail2ban.sock
2025-11-06 16:06:31,803 fail2ban                [22310]: INFO    Using 
pid file /var/run/fail2ban/fail2ban.pid, [INFO] logging to 
/var/log/fail2ban.log
2025-11-06 16:06:31,804 fail2ban                [22310]: ERROR   Server 
already running
2025-11-06 16:06:31,805 fail2ban                [22310]: ERROR   Async 
configuration of server failed
Traceback (most recent call last):
   File 
"/usr/lib/python3/dist-packages/fail2ban/client/fail2banserver.py", line 
193, in start
     cli.configureServer(phase=phase)
     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
   File 
"/usr/lib/python3/dist-packages/fail2ban/client/fail2banclient.py", line 
243, in configureServer
     raise ServerExecutionException('Async configuration of server failed')
fail2ban.client.fail2bancmdline.ServerExecutionException: Async 
configuration of server failed


Running, but failed. Very interesting, what's happening there.

On 06/11/2025 15:37, Nick via Dng wrote:
> On 11/6/25 3:23 PM, Nick Rickard via Dng wrote:
>>
>>> I noticed that fail2ban package doesn't work at all on Excalibur.
>>
>>> fail2ban                [31993]: ERROR NOK: (38, 'Function not
>>> implemented')
>>>   failed!
>>> invoke-rc.d: initscript fail2ban, action "start" failed.
>>> dpkg: error processing package fail2ban (--configure):
>>
>>> Anyone know how to fix this? Thank you.
>> (I'm afraid this is half an answer as I'm not at the machine in
>> question at the moment.)
>>
>> I had a similar issue and traced it to fail2ban defaulting to a
>> systemd setup. Somewhere in the config files (/etc/fail2ban/
>> jail.conf??) were lines like:
>>
>> dovecot_backend = systemd
>>
>> so fail2ban was trying to initiate the jails using systemd, which
>> clearly failed on a Devuan system. I can't recall what I changed it
>> to, possibly "auto", but that hopefully gives you somewhere to start
>> looking. Upshot is that my fail2ban works in excalibur.
>>
> The preferred way is to use a jail.local. The supplied jail.conf
> contains this note:
>
> # "backend" specifies the backend used to get files modification.
> # Available options are "pyinotify", "gamin", "polling", "systemd" and
> "auto".
> # This option can be overridden in each jail as well.
> #
> # pyinotify: requires pyinotify (a file alteration monitor) to be
> installed.
> #              If pyinotify is not installed, Fail2ban will use auto.
> # gamin:     requires Gamin (a file alteration monitor) to be installed.
> #              If Gamin is not installed, Fail2ban will use auto.
> # polling:   uses a polling algorithm which does not require external
> libraries.
> # systemd:   uses systemd python library to access the systemd journal.
> #              Specifying "logpath" is not valid for this backend.
> #              See "journalmatch" in the jails associated filter config
> # auto:      will try to use the following backends, in order:
> #              pyinotify, gamin, polling.
> #
> # Note: if systemd backend is chosen as the default but you enable a jail
> #       for which logs are present only in its own log files, specify
> some other
> #       backend for that jail (e.g. polling) and provide empty value for
> #       journalmatch. See https://github.com/fail2ban/fail2ban/
> issues/959#issuecomment-74901200
> backend = auto
>
> _______________________________________________
> Dng mailing list
> Dng@???
> Manage your subscription: https://mailinglists.dyne.org/cgi-bin/mailman/
> listinfo/dng
> Archive: https://lists.dyne.org/lurker/list/dng.en.html



--
With kindest regards, Piotr.