From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Bruno Thomsen <bruno.thomsen@gmail.com>
Subject: Re: [ptxdist] [APPLIED] openssh: avoid degrading systemd on failed login
Date: Fri, 13 Nov 2026 09:39:28 +0100 [thread overview]
Message-ID: <20261113083928.1380642-1-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <20261028183643.9905-1-bruno.thomsen@gmail.com>
Thanks, applied as f1ca5f9188748c2518207eb85220fa2f86a2cd5b.
Michael
[sent from post-receive hook]
On Fri, 13 Nov 2026 09:39:28 +0100, Bruno Thomsen <bruno.thomsen@gmail.com> wrote:
> Before OpenSSH 9.8 an aborted or rejected session always exited with
> 255. OpenSSH 9.8+ uses new exit codes for the PerSourcePenalties
> feature, but nothing reads them and they reach systemd.
>
> See srclimit.h[1]:
>
> #define EXIT_LOGIN_GRACE 3 /* login grace period exceeded */
> #define EXIT_CHILD_CRASH 4 /* preauth child crashed */
> #define EXIT_AUTH_ATTEMPTED 5 /* at least one auth attempt made */
> #define EXIT_CONFIG_REFUSED 6 /* sshd_config RefuseConnection */
> #define EXIT_INVALID_USER 7 /* invalid user supplied */
>
> Systemd reads them as LSB init-script codes. It shows 3, 4, 5, 6 and 7 as
> NOTIMPLEMENTED, NOPERMISSION, NOTINSTALLED, NOTCONFIGURED and NOTRUNNING.
>
> In OpenSSH 10.x, each connection is handled by two server processes:
> - sshd-session (privileged)
> - sshd-auth (unprivileged)
>
> When sshd-session sees sshd-auth die from a crash signal, it exits with
> code 4, so don't include that code.
>
> [1] https://github.com/openssh/openssh-portable/blob/master/srclimit.h#L33
>
> Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
> Message-Id: <20261028183643.9905-1-bruno.thomsen@gmail.com>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> diff --git a/projectroot/usr/lib/systemd/system/sshd@.service b/projectroot/usr/lib/systemd/system/sshd@.service
> index 269127c8f3ac..4e582227b0d6 100644
> --- a/projectroot/usr/lib/systemd/system/sshd@.service
> +++ b/projectroot/usr/lib/systemd/system/sshd@.service
> @@ -5,7 +5,7 @@ IgnoreOnIsolate=true
>
> [Service]
> ExecStart=/usr/sbin/sshd -i
> -SuccessExitStatus=0 255
> +SuccessExitStatus=0 3 5 6 7 255
> StandardInput=socket
> RuntimeDirectory=sshd
> RuntimeDirectoryPreserve=yes
prev parent reply other threads:[~2026-11-13 8:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 18:36 [ptxdist] [PATCH] " Bruno Thomsen
2026-11-13 8:39 ` Michael Olbrich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261113083928.1380642-1-m.olbrich@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=bruno.thomsen@gmail.com \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox