NetBSD Problem Report #59108
From www@netbsd.org Wed Feb 26 22:57:11 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 0F2D71A923A
for <gnats-bugs@gnats.NetBSD.org>; Wed, 26 Feb 2025 22:57:11 +0000 (UTC)
Message-Id: <20250226225709.7530A1A923D@mollari.NetBSD.org>
Date: Wed, 26 Feb 2025 22:57:09 +0000 (UTC)
From: jlduran@gmail.com
Reply-To: jlduran@gmail.com
To: gnats-bugs@NetBSD.org
Subject: blocklistd/sshd: Allow the nfail counter to be reset once a valid login occurs
X-Send-Pr-Version: www-1.0
>Number: 59108
>Category: bin
>Synopsis: blocklistd/sshd: Allow the nfail counter to be reset once a valid login occurs
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: christos
>State: needs-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Feb 26 23:00:00 +0000 2025
>Closed-Date:
>Last-Modified: Fri May 09 11:55:02 +0000 2025
>Originator: Jose Luis Duran
>Release: 10.1
>Organization:
FreeBSD
>Environment:
NetBSD netbsd101.home.arpa 10.1 NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
Allow the nfail (number of failed attempts) blocklistctl counter to be reset once a valid SSH login occurs. Otherwise, the counter never resets, and after a reboot the system could start blocked for a given IP.
>How-To-Repeat:
Follow the procedure detailed in:
https://wiki.netbsd.org/tutorials/setting_up_blocklistd/
For setting up blocklistd.
Provoke a block by failing to ssh many times.
Confirm that the IP is blocked:
netbsd101# blocklistctl dump -b
address/ma:port id nfail last access
192.0.2.1/32:22 1 3/3 2025/02/26 12:00:00
Unblock the host:
/sbin/npfctl rule blocklistd rem-id 1
Now perform a valid ssh login. Notice that the nfail counter is not reset:
blocklistctl dump -b
Reboot the machine. You won't be able to ssh.
>Fix:
This is what is currently done in FreeBSD (adapted to pfilter_notify):
--- a/crypto/external/bsd/openssh/dist/auth.c
+++ b/crypto/external/bsd/openssh/dist/auth.c
@@ -388,8 +388,11 @@ auth_log(struct ssh *ssh, int authenticated, int partial,
authmsg = "Postponed";
else if (partial)
authmsg = "Partial";
- else
+ else {
authmsg = authenticated ? "Accepted" : "Failed";
+ if (authenticated)
+ pfilter_notify(0);
+ }
if ((extra = format_method_key(authctxt)) == NULL) {
if (authctxt->auth_method_info != NULL)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->christos
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Thu, 27 Feb 2025 00:12:16 +0000
Responsible-Changed-Why:
over to blocklistd wizard
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59108 CVS commit: src/crypto/external/bsd/openssh/dist
Date: Thu, 20 Mar 2025 14:43:03 -0400
Module Name: src
Committed By: christos
Date: Thu Mar 20 18:43:03 UTC 2025
Modified Files:
src/crypto/external/bsd/openssh/dist: auth.c
Log Message:
PR/59108; Jose Luis Duran: Reset the blocklist counter after successful
authentication
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/crypto/external/bsd/openssh/dist/auth.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 25 Mar 2025 19:57:41 +0000
State-Changed-Why:
Looks like this is fixed in HEAD, needs pullup-9 and pullup-10,
probably.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/59108 CVS commit: [netbsd-10] src/crypto/external/bsd/openssh/dist
Date: Fri, 9 May 2025 11:54:33 +0000
Module Name: src
Committed By: martin
Date: Fri May 9 11:54:33 UTC 2025
Modified Files:
src/crypto/external/bsd/openssh/dist [netbsd-10]: auth.c
Log Message:
Pull up following revision(s) (requested by christos in ticket #1106):
crypto/external/bsd/openssh/dist/auth.c: revision 1.38
PR/59108; Jose Luis Duran: Reset the blocklist counter after successful
authentication
To generate a diff of this commit:
cvs rdiff -u -r1.33.2.2 -r1.33.2.3 \
src/crypto/external/bsd/openssh/dist/auth.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.