Skip to content

fix: fail2ban silently skipped when ssh_hardening is disabled#23

Open
rlei-odes wants to merge 1 commit into
captainzero93:mainfrom
rlei-odes:pr/fix-fail2ban-dependency
Open

fix: fail2ban silently skipped when ssh_hardening is disabled#23
rlei-odes wants to merge 1 commit into
captainzero93:mainfrom
rlei-odes:pr/fix-fail2ban-dependency

Conversation

@rlei-odes

@rlei-odes rlei-odes commented Jun 5, 2026

Copy link
Copy Markdown

Hey, great project.
Ran the script on a Debian 13 server where we kept password auth on — so ssh_hardening was disabled in the config. Even with ENABLE_FAIL2BAN=true, fail2ban got silently skipped. That's the opposite of what you want: password auth on, no brute-force protection.

Traced it to MODULE_DEPS: fail2ban lists ssh_hardening as a required dependency, so disabling one kills the other.

Looked at module_fail2ban() — it reads /etc/ssh/sshd_config directly to check whether password auth is active and decide which jails to configure. It doesn't use any state or output from ssh_hardening. The dependency isn't doing anything useful.

The README describes exactly this split: fail2ban is the protection layer for password-based setups, ssh_hardening is what you enable once you've moved to key-only auth. They're intended as alternatives for different phases of hardening, not as a chain.

Fix is a one-liner: drop ssh_hardening from fail2ban's dependency list.

module_fail2ban() reads /etc/ssh/sshd_config directly to check whether
password auth is active and sets the SSH jail accordingly. It does not
rely on any state from ssh_hardening.

The dependency caused fail2ban to be silently skipped when ssh_hardening
was disabled — exactly when fail2ban is most needed (password auth still
on). Contradicts both the README and the module's own logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant