Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] monitoring systemd logs not working #27

Open
1 task done
machetto opened this issue Jul 11, 2024 · 5 comments
Open
1 task done

[BUG] monitoring systemd logs not working #27

machetto opened this issue Jul 11, 2024 · 5 comments

Comments

@machetto
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If a jail's backend (sshd in my case) set to systemd, the following message appears:

ERROR Backend 'systemd' failed to initialize due to No module named 'systemd'.

The problems appears to be caused by not having systemd Python module in the Docker image.

Expected Behavior

It should start monitoring sshd systemd logs.

Steps To Reproduce

Create a file fail.d/sshd.local with the following content:

[sshd]
enabled = true
backend = systemd

Restart fail2ban

Environment

- OS: Debian 12
- How docker service was installed: using `apt-get` with instructions from docker website

CPU architecture

x86-64

Docker creation

services:
  fail2ban:
    image: lscr.io/linuxserver/fail2ban:latest
    container_name: fail2ban
    cap_add:
      - NET_ADMIN
      - NET_RAW
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - VERBOSITY=-vv #optional
    volumes:
      - ./config:/config
      - /var/log:/var/log:ro
    restart: unless-stopped

Container logs

2024-07-11 10:58:38,188 7089F9C7BB08 INFO  Starting Fail2ban v1.0.2
 2024-07-11 10:58:38,188 7089F8202B38 INFO  Observer start...
 2024-07-11 10:58:38,192 7089F9C7BB08 INFO  Connected to fail2ban persistent database '/config/fail2ban/fail2ban.sqlite3'
 2024-07-11 10:58:38,192 7089F9C7BB08 INFO  Creating new jail 'sshd'
 2024-07-11 10:58:38,193 7089F9C7BB08 ERROR Backend 'systemd' failed to initialize due to No module named 'systemd'
 2024-07-11 10:58:38,193 7089F9C7BB08 ERROR Failed to initialize any backend for Jail 'sshd'
 2024-07-11 10:58:38,193 7089F9C7BB08 ERROR Command ['server-stream', [['set', 'syslogsocket', 'auto'], ['set', 'loglevel', 'INFO>
 2024-07-11 10:58:38,193 7089F8C02B38 ERROR NOK: ("Failed to initialize any backend for Jail 'sshd'",)
 2024-07-11 10:58:38,194 7089F8C02B38 INFO  Shutdown in progress...
 2024-07-11 10:58:38,194 7089F8C02B38 INFO  Observer stop ... try to end queue 5 seconds
 2024-07-11 10:58:38,214 7089F8202B38 INFO  Observer stopped, 0 events remaining.
 2024-07-11 10:58:38,254 7089F8C02B38 INFO  Stopping all jails
 2024-07-11 10:58:38,254 7089F8C02B38 INFO  Connection to database closed.
Copy link

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

@LinuxServer-CI
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

@b2un0
Copy link

b2un0 commented Aug 16, 2024

can confirm, same problem for me.
everything logs to systemd and so no jails working

@LinuxServer-CI
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Issues
Development

No branches or pull requests

4 participants