[openssh-commits] [openssh] branch master updated: support shadow(5) sp_inact on Linux
git+noreply at mindrot.org
git+noreply at mindrot.org
Wed Nov 25 16:28:14 AEDT 2026
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
The following commit(s) were added to refs/heads/master by this push:
new 59e6a43ea support shadow(5) sp_inact on Linux
59e6a43ea is described below
commit 59e6a43eacb071afd854979313511f5a127bf313
Author: Damien Miller <djm at mindrot.org>
AuthorDate: Tue Nov 24 21:26:09 2026 -0800
support shadow(5) sp_inact on Linux
Support shadow password password expiry field on Linux. This is separate
to the account expiry field that we have supported for ages, but allows
an account to be disabled automatically some interval after the password
expires.
Anthropic ANT-2026-4DLE7YPO; feedback/ok dtucker@
---
auth-shadow.c | 21 +++++++++++++++++++++
configure.ac | 3 +++
2 files changed, 24 insertions(+)
diff --git a/auth-shadow.c b/auth-shadow.c
index f9a79e03c..dcc698e33 100644
--- a/auth-shadow.c
+++ b/auth-shadow.c
@@ -78,6 +78,27 @@ auth_shadow_acctexpired(struct spwd *spw)
fatal_fr(r, "buffer error");
}
+#ifdef SSH_INACT_STYLE_DAYS_AFTER_EXPIRY
+ /*
+ * On Linux (at least), sp_inact is the number of days after the
+ * password has expired until the account is disabled (shadow(5)).
+ */
+ do {
+ long long pwage = (long long)today - spw->sp_lstchg;
+
+ debug3_f("sp_lstchg %lld sp_max %lld sp_inact %lld pwage %lld",
+ (long long)spw->sp_lstchg, (long long)spw->sp_max,
+ (long long)spw->sp_inact, pwage);
+ if (spw->sp_lstchg > 0 && spw->sp_max >= 0 &&
+ spw->sp_inact >= 0 && pwage > spw->sp_max &&
+ pwage - spw->sp_max > spw->sp_inact) {
+ logit("Account %.100s has expired (password inactive)",
+ spw->sp_namp);
+ return 1;
+ }
+ } while (0);
+#endif
+
return 0;
}
diff --git a/configure.ac b/configure.ac
index 70abe0134..d7746fc82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -982,6 +982,9 @@ int main(void) { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
AC_DEFINE([USE_BTMP])
AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
+ AC_DEFINE([SSH_INACT_STYLE_DAYS_AFTER_EXPIRY], [1],
+ [Define if shadow password sp_inact is interpreted as the
+ number of days after password expiry to lock an account])
AC_ARG_WITH([linux-memlock-onfault],
[ --with-linux-memlock-onfault Enables memory locking on Linux],
[
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list