Skip to content

session server ssh FEATURE lock an account out after repeated failed password authentication - #640

Open
niklas-moser wants to merge 1 commit into
CESNET:develfrom
niklas-moser:ssh-auth-lockout
Open

session server ssh FEATURE lock an account out after repeated failed password authentication#640
niklas-moser wants to merge 1 commit into
CESNET:develfrom
niklas-moser:ssh-auth-lockout

Conversation

@niklas-moser

Copy link
Copy Markdown

Nothing reads ssh_auth_attempts, so password guessing is unlimited both within a connection and across them. auth-timeout bounds how long one authentication may take, not how many may be tried, and pam_faillock only ever sees the
keyboard-interactive method — accounts using hashed-password are verified by libnetconf2 itself with crypt(3).

This counts consecutive password failures per account across connections and refuses the account for NC_AUTHLOCK_TIME after NC_AUTHLOCK_MAX_FAILS. The hooks sit on the three credential checks in session_server_ssh.c that both the message-and callback-based backends funnel through (auth_password_check, kbdint_verify_passwd, pam_authenticate), so all three methods share one tally and neither dispatch file is touched. The tally is mirrored to a state file and re-read when it changes, so a lockout survives a restart and can be cleared on a running server. A session hitting NC_AUTHLOCK_SESSION_MAX_FAILS is disconnected — ssh_auth_attempts finally gets a reader.

Public key auth is deliberately not counted, which keeps a locked out deployment recoverable. TLS is unaffected.

Open question: the policy is compiled in (5 failures, 300 s, 900 s window, 6 per session, 64 accounts). ietf-netconf-server has no leaves for it and your augment carries only auth-timeout, so making it configurable means extending
libnetconf2-netconf-server.yang — glad to do that here if you'd prefer.

Motivated by O-RAN WG11 R004 / 3GPP TS 33.117 4.2.3.4.3.1.

…password authentication

Nothing reads ssh_auth_attempts, so password guessing is unlimited both
within a connection and across them. auth-timeout bounds how long one
authentication may take, not how many may be tried, and pam_faillock
only ever sees the keyboard-interactive method.

Count consecutive password failures per account across connections and
refuse the account for NC_AUTHLOCK_TIME after NC_AUTHLOCK_MAX_FAILS.
The hooks sit on the three credential checks in session_server_ssh.c
that both auth backends funnel through, so the configured-password,
kbdint and PAM methods share one tally and neither dispatch file is
touched. The tally is mirrored to a state file and re-read when it
changes, so a lockout survives a restart and can be cleared on a running
server. A session hitting NC_AUTHLOCK_SESSION_MAX_FAILS is disconnected.

Public key auth is deliberately not counted, which keeps a locked out
deployment recoverable.

The policy is compiled in; ietf-netconf-server has no leaves for it.
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