LoginAccountsMixin.get_login_accounts() (NetOrk/netork#2707, decided 2026-11-28: option A, plus the failed attempts as a number only):
Accounts: root and UID 1000 on with a login shell (login_capable), from /etc/passwd -- name, UID, home and shell only, never the comment field. Directory accounts (SSSD, AD join) are not in /etc/passwd and are not read; the directory reviews them.
Last login: the newest any of lastlog2, lastlog, wtmpdb last and last knows (a host upgraded to lastlog2 keeps an old lastlog; a desktop login reaches wtmp only), as ISO UTC, with the remote host, the terminal and the tool that told it.
Lock and expiry:passwd -S (shadow's and libuser's words: set, locked, none) and chage -l (password change, password and account expiry: ISO date, never, must_change). locked is the password locked or the account expired on the host's date (usermod -L -e 1 does both).
Failed attempts since the last login, a number: lastb (the newest 1000 per account, failed_logins_capped when reached), else pam_faillock's tally. No warning comes of it.
One fixed command, read-only, LC_ALL=C, exec </dev/null so a sudo password never reaches a tool, no password hash read. Root first; where root is refused, as the login user: the last logins only, the rest None.
Tests: tests/test_login_accounts.py (39), with fixtures for Debian 12 (lastlog, wtmp, lastb, shadow's passwd -S), Debian 13 (lastlog2, wtmpdb, faillock), AlmaLinux 9 (libuser's passwd -S) and a read without root, plus the command run and parsed on a Linux host. ruff and mypy clean.
Version 4.51.0: v4.50.0 went to #140, which is merged into this branch (by merge). napalm-linux carries it in NAPALM/napalm-linux (0.21.0). napalm-linux carries it in NAPALM/napalm-linux (0.21.0).
`LoginAccountsMixin.get_login_accounts()` (NetOrk/netork#2707, decided 2026-11-28: option A, plus the failed attempts as a number only):
- **Accounts:** root and UID 1000 on with a login shell (`login_capable`), from `/etc/passwd` -- name, UID, home and shell only, never the comment field. Directory accounts (SSSD, AD join) are not in `/etc/passwd` and are not read; the directory reviews them.
- **Last login:** the newest any of `lastlog2`, `lastlog`, `wtmpdb last` and `last` knows (a host upgraded to lastlog2 keeps an old lastlog; a desktop login reaches wtmp only), as ISO UTC, with the remote host, the terminal and the tool that told it.
- **Lock and expiry:** `passwd -S` (shadow's and libuser's words: `set`, `locked`, `none`) and `chage -l` (password change, password and account expiry: ISO date, `never`, `must_change`). `locked` is the password locked or the account expired on the host's date (`usermod -L -e 1` does both).
- **Failed attempts since the last login,** a number: `lastb` (the newest 1000 per account, `failed_logins_capped` when reached), else `pam_faillock`'s tally. No warning comes of it.
- One fixed command, read-only, `LC_ALL=C`, `exec </dev/null` so a sudo password never reaches a tool, no password hash read. Root first; where root is refused, as the login user: the last logins only, the rest `None`.
Tests: `tests/test_login_accounts.py` (39), with fixtures for Debian 12 (lastlog, wtmp, lastb, shadow's `passwd -S`), Debian 13 (lastlog2, wtmpdb, faillock), AlmaLinux 9 (libuser's `passwd -S`) and a read without root, plus the command run and parsed on a Linux host. ruff and mypy clean.
Version 4.51.0: v4.50.0 went to #140, which is merged into this branch (by merge). napalm-linux carries it in NAPALM/napalm-linux (0.21.0). napalm-linux carries it in NAPALM/napalm-linux (0.21.0).
LoginAccountsMixin.get_login_accounts: root and UID 1000 on with a login
shell, from /etc/passwd without the comment field; the newest last login of
lastlog2, lastlog, wtmpdb last and last, with where it came from; the
password state and expiry from passwd -S and chage -l; the failed attempts
since the last login from lastb, else faillock. Root first, the login user
where root is refused, when what needs root is None.
christianmanivong
changed title from feat(logins): every account a person can log in with, as one read-only reading, 4.50.0 (NetOrk/netork#2707) to feat(logins): every account a person can log in with, as one read-only reading, 4.51.0 (NetOrk/netork#2707)2026-11-28 07:28:12 +00:00
bandit reads password == "locked" as a hardcoded password (B105) and fails
the security job. A state word is none; STATE_SET, STATE_LOCKED and
STATE_NONE name them.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
LoginAccountsMixin.get_login_accounts()(NetOrk/netork#2707, decided 2026-11-28: option A, plus the failed attempts as a number only):login_capable), from/etc/passwd-- name, UID, home and shell only, never the comment field. Directory accounts (SSSD, AD join) are not in/etc/passwdand are not read; the directory reviews them.lastlog2,lastlog,wtmpdb lastandlastknows (a host upgraded to lastlog2 keeps an old lastlog; a desktop login reaches wtmp only), as ISO UTC, with the remote host, the terminal and the tool that told it.passwd -S(shadow's and libuser's words:set,locked,none) andchage -l(password change, password and account expiry: ISO date,never,must_change).lockedis the password locked or the account expired on the host's date (usermod -L -e 1does both).lastb(the newest 1000 per account,failed_logins_cappedwhen reached), elsepam_faillock's tally. No warning comes of it.LC_ALL=C,exec </dev/nullso a sudo password never reaches a tool, no password hash read. Root first; where root is refused, as the login user: the last logins only, the restNone.Tests:
tests/test_login_accounts.py(39), with fixtures for Debian 12 (lastlog, wtmp, lastb, shadow'spasswd -S), Debian 13 (lastlog2, wtmpdb, faillock), AlmaLinux 9 (libuser'spasswd -S) and a read without root, plus the command run and parsed on a Linux host. ruff and mypy clean.Version 4.51.0: v4.50.0 went to #140, which is merged into this branch (by merge). napalm-linux carries it in NAPALM/napalm-linux (0.21.0). napalm-linux carries it in NAPALM/napalm-linux (0.21.0).
feat(logins): every account a person can log in with, as one read-only reading, 4.50.0 (NetOrk/netork#2707)to feat(logins): every account a person can log in with, as one read-only reading, 4.51.0 (NetOrk/netork#2707)