feat: personal accounts with shadow-utils, locked by expiry (NetOrk/netork#1793)
driver / standard (pull_request) Failing after 17s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Failing after 1m17s
driver / test (3.12) (pull_request) Failing after 1m19s
driver / test (3.13) (pull_request) Failing after 1m7s
driver / lowest (pull_request) Failing after 41s
driver / build (pull_request) Successful in 42s
driver / security (pull_request) Successful in 1m29s
CI / driver (pull_request) Failing after 3m19s
driver / publish (pull_request) Skipped

LinuxDriver mixes in napalm-device-types' LocalAccountsMixin with
useradd -m -s /bin/bash, usermod and gpasswd -d. A locked account is an
expired one (usermod -L -e 1): PAM refuses it a key login too, where a
"!" in front of the password stops only the password. Opening it again
lifts the expiry and gives the old password back.

Checked on Debian 13 and Rocky Linux 9 containers with sshd and sudo:
key login works after adding, is refused after locking and works again
after reopening; the sudo rule takes effect with the person's password;
membership of sudo/wheel goes when sudo is not wanted.
This commit is contained in:
Christian Manivong committed 2026-10-31 23:24:27 +01:00
1 parent 7550b884b0
commit c5be71adac
4 files changed
+177

No files matched your search

+2
View File
@@ -72,6 +72,7 @@ from netmiko import ConnectHandler
from netmiko.exceptions import NetmikoAuthenticationException, NetmikoTimeoutException
from napalm_linux._hostname import HostnameMixin
from napalm_linux._local_accounts import LinuxLocalAccountsMixin
from napalm_linux._shell import PROMPT_RE as _PROMPT_RE
from napalm_linux._shell import prepare_shell
from napalm_linux._sudo_history import LinuxSudoHistoryMixin
@@ -307,6 +308,7 @@ def render_snmpd_conf(settings: SnmpAgentSettingsDict) -> str:
class LinuxDriver(
LinuxSudoHistoryMixin,
LinuxLocalAccountsMixin,
SnmpAgentMixin,
EnsurePackageMixin,
AptProxyMixin,