Score:0

Fail2ban needs restart before running on ubuntu 22.04

no flag

I am running since today fail2ban on ubuntu 22.04 with ipv6 and when i start ubuntu the logs says every time i booting:

2023-04-21 23:43:39,740 fail2ban.server [1662]: INFO
Shutdown in progress... 2023-04-21 23:43:39,741 fail2ban.observer
[1662]: INFO Observer stop ... try to end queue 5 seconds 2023-04-21 23:43:39,762 fail2ban.observer [1662]: INFO
Observer stopped, 0 events remaining. 2023-04-21 23:43:39,803 fail2ban.server [1662]: INFO Stopping all jails 2023-04-21 23:43:39,804 fail2ban.filter [1662]: INFO Removed logfile: '/var/log/auth.log' 2023-04-21 23:43:40,026 fail2ban.actions
[1662]: NOTICE [sshd] Flush ticket(s) with iptables-multiport 2023-04-21 23:43:41,007 fail2ban.jail [1662]: INFO Jail 'sshd' stopped 2023-04-21 23:43:41,008 fail2ban.database [1662]: INFO Connection to database closed. 2023-04-21 23:43:41,009 fail2ban.server [1662]: INFO Exiting Fail2ban

I need to run the command sudo service fail2ban restart and then the fail2ban service is running as expected. What i am doing wrong?

The service seems to be killed

$ sudo systemctl status fail2ban.service 
 fail2ban.service - Fail2Ban Service
     Loaded: loaded (/lib/systemd/system/fail2ban.service; disabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:fail2ban(1)

I have also tried to update the /lib/systemd/system/fail2ban.service and set the Restart option to always:

[Unit]
Description=Fail2Ban Service
Documentation=man:fail2ban(1)
After=network.target iptables.service firewalld.service ip6tables.service ipset.service nftables.service
PartOf=firewalld.service

[Service]
Type=simple
Environment="PYTHONNOUSERSITE=1"
ExecStart=/usr/bin/fail2ban-server -xf start
# if should be logged in systemd journal, use following line or set logtarget to sysout in fail2ban.local
# ExecStart=/usr/bin/fail2ban-server -xf --logtarget=sysout start
ExecStop=/usr/bin/fail2ban-client stop
ExecReload=/usr/bin/fail2ban-client reload
RuntimeDirectory=fail2ban
PIDFile=/run/fail2ban/fail2ban.pid
Restart=always
RestartPreventExitStatus=0 255
Environment="PYTHONNOUSERSITE=yes"

[Install]
WantedBy=multi-user.target
Score:0
no flag

OK the problem was me, not f2b. The journal was missunderstanding because the f2b service did not stop after boot, it stops at the shutdown before and because it not started at boot the log shows just the stopping-logs.

I dont know why, because i have reinstalled f2b many times but the f2b service was not enables at the systemctl. After enable f2b with

systemctl fail2ban.service enable

everything works. All the years before i have used f2b this was never needed. I am not sure if this a bug or wanted.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.