Hi guys. First of all thanks, I appreciate a lot the work you do.
I am setting up a server that will be publicly accessible, and I was trying to set up Fail2Ban, but for some reason it is not picking up logging attempts from Dropbear.
I have tried to block myself using another computer, but Itβs not even logging anything. If I run journalctl -u dropbear
I do see not only my own attempts but also from who knows where:
Feb 11 17:28:02 DietPi dropbear[3091]: [3091] Feb 11 17:28:02 Child connection from 141.98.11.169:40262
Feb 11 17:28:02 DietPi dropbear[3090]: [3090] Feb 11 17:28:02 Exit before auth from <141.98.11.169:54574>: (user 'root', 1 fails): Exited normally
Feb 11 17:28:02 DietPi dropbear[3091]: [3091] Feb 11 17:28:02 Failed loading /etc/dropbear/dropbear_dss_host_key
Feb 11 17:28:03 DietPi dropbear[3091]: [3091] Feb 11 17:28:03 Bad password attempt for 'root' from 141.98.11.169:40262
And there were several attempts from the same IP.
Running journalctl -f -u fail2ban
I get the following and nothing else:
Fail2Ban journal
Feb 11 18:32:20 DietPi systemd[1]: Started fail2ban.service - Fail2Ban Service.
Feb 11 18:32:20 DietPi fail2ban-server[7686]: 2024-02-11 18:32:20,816 fail2ban.configreader [7686]: WARNING 'allowipv6' not defined in 'Definition'. Using default one: 'auto'
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.server [7686]: INFO --------------------------------------------------
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.server [7686]: INFO Starting Fail2ban v1.0.2
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.observer [7686]: INFO Observer start...
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.database [7686]: INFO Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3'
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Creating new jail 'dropbear'
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Jail 'dropbear' uses systemd {}
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Initiated 'systemd' backend
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filter [7686]: INFO maxRetry: 3
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filter [7686]: INFO findtime: 600
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.actions [7686]: INFO banTime: 600
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Creating new jail 'sshd'
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Jail 'sshd' uses systemd {}
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Initiated 'systemd' backend
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filter [7686]: INFO maxLines: 1
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filtersystemd [7686]: INFO [sshd] Added journal match for: '_SYSTEMD_UNIT=sshd.service + _COMM=sshd'
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filter [7686]: INFO maxRetry: 3
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filter [7686]: INFO findtime: 600
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.actions [7686]: INFO banTime: 600
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filtersystemd [7686]: NOTICE [dropbear] Jail started without 'journalmatch' set. Jail regexs will be checked against all journal entries, which is not advised for performance reasons.
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filtersystemd [7686]: INFO [dropbear] Jail is in operation now (process new journal entries)
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Jail 'dropbear' started
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filtersystemd [7686]: INFO [sshd] Jail is in operation now (process new journal entries)
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Jail 'sshd' started
Feb 11 18:32:20 DietPi fail2ban-server[7686]: Server ready
Running fail2ban-client status dropbear
shows
Status for the jail: dropbear
|- Filter
| |- Currently failed: 0
| |- Total failed: 0
| `- Journal matches:
`- Actions
|- Currently banned: 0
|- Total banned: 0
`- Banned IP list:
And then running systemctl status fail2ban
shows:
β fail2ban.service - Fail2Ban Service
Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; preset: enabled)
Active: active (running) since Sun 2024-02-11 18:32:20 GMT; 58min ago
Docs: man:fail2ban(1)
Main PID: 7686 (fail2ban-server)
Tasks: 7 (limit: 4531)
Memory: 11.8M
CPU: 7.491s
CGroup: /system.slice/fail2ban.service
ββ7686 /usr/bin/python3 /usr/bin/fail2ban-server -xf start
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filtersystemd [7686]: INFO [sshd] Added journal match for: '_SYSTEMD_UNIT=sshd.service + _COMM=sshd'
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filter [7686]: INFO maxRetry: 3
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filter [7686]: INFO findtime: 600
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.actions [7686]: INFO banTime: 600
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filtersystemd [7686]: NOTICE [dropbear] Jail started without 'journalmatch' set. Jail regexs will be checked against all journal entries, which is not advised for performance reasons.
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filtersystemd [7686]: INFO [dropbear] Jail is in operation now (process new journal entries)
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Jail 'dropbear' started
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.filtersystemd [7686]: INFO [sshd] Jail is in operation now (process new journal entries)
Feb 11 18:32:20 DietPi fail2ban-server[7686]: fail2ban.jail [7686]: INFO Jail 'sshd' started
Feb 11 18:32:20 DietPi fail2ban-server[7686]: Server ready
I am not sure if I am missing some configuration or something to make it work with Dropbear
Fail2Ban was installed using dietpi-software
, and this is the configuration in services:
Fail2Ban service config
βββββββββββββββββββββββββββββββββββββββββββββββββββ€ DietPi-Services ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Please select an option for: fail2ban β
β β
β ββ Service control ββββββββββββββββββββββββββββ β
β State : [active] β
β Mode : [enabled] β
β Include/Exclude : [included] β
β Status : Display systemd status log β
β Edit : [/lib/systemd/system/fail2ban.service] β
The configuration of jail.local
is the following:
jail.local config
[DEFAULT]
enabled = true
#ignoreip = 127.0.0.1/8
ignorecommand =
backend = systemd
mode = normal
filter = %(__name__)s[mode=%(mode)s]
findtime = 600
maxretry = 3
bantime = 600
banaction = route
action = %(banaction)s[blocktype=blackhole]
[dropbear]
[sshd]
# Mode: normal (default), ddos, extra or aggressive (combines all)
# See "filter.d/sshd.conf" for details.
#mode = normal
I commented the ignoreip
for testing purposes.
I will appreciate any hint or help on how to make it work.
Thanks.
Summary
Creating a bug report/issue
I have searched the existing open and closed issues
Required Information
- DietPi version:
- G_DIETPI_VERSION_CORE=9
- G_DIETPI_VERSION_SUB=0
- G_DIETPI_VERSION_RC=2
- G_GITBRANCH=βmasterβ
- G_GITOWNER=βMichaIngβ
- Distro version:
bookworm 0
- Kernel version:
Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
- Architecture:
arm64
- SBC model:
RPi 4 Model B (aarch64)
- Power supply used:
- 5V | 5000 mAh
- SD card used:
- None, using WD Green WDS240G2G0B SSD
Additional Information (if applicable)
- Software title
- Fail2Ban
- Was the software title installed freshly or updated/migrated?
- Fresh install
- Can this issue be replicated on a fresh installation of DietPi?
- No idea