feat(local-accounts): a deleted key can take the password with it
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 14s
driver / test (3.13) (pull_request) Successful in 1m12s
driver / types (pull_request) Successful in 1m20s
driver / test (3.12) (pull_request) Successful in 1m21s
driver / lowest (pull_request) Successful in 33s
driver / build (pull_request) Successful in 38s
driver / security (pull_request) Successful in 1m17s
CI / driver (pull_request) Successful in 3m5s
driver / publish (pull_request) Skipped

napalm-device-types 4.29.0 lets remove_local_account_keys clear the password and sudo too (NetOrk/netork#2033). This driver's _account_clear_password already does the work; a test pins the commands, and the floor rises to 4.29.0.
This commit is contained in:
Christian Manivong committed 2026-11-04 15:22:51 +01:00
1 parent 6727f0a79c
commit 9551b7434a
3 files changed
+22 -2

No files matched your search

+5 -1
View File
@@ -14,9 +14,13 @@ All notable changes to this driver. The format follows
account open, and `add_local_account(..., clear_password=True)` removes the password
(`usermod -p '*'`, as napalm-linux does): the account logs in with its key only and has
no sudo. Keys the person added stay.
- A deleted key can take the password with it on OpenMediaVault (NetOrk/netork#2033):
through napalm-device-types' `remove_local_account_keys(..., clear_password=True)` the
keys go through OMV's key store, the password goes (`usermod -p '*'`), and so does
sudo. The account stays open and in `_ssh`.
### Changed
- Needs napalm-device-types 4.28.0 and napalm-linux 0.17.0.
- Needs napalm-device-types 4.29.0 and napalm-linux 0.17.0.
### Added
- Scheduled jobs (NetOrk/netork#1933, #18), on top of napalm-linux's reading and writers.
+1 -1
View File
@@ -27,7 +27,7 @@ classifiers = [
]
dependencies = [
"napalm>=4.0",
"napalm-device-types>=4.28.0",
"napalm-device-types>=4.29.0",
"napalm-linux>=0.17.0",
]
+16
View File
@@ -367,3 +367,19 @@ def test_a_deleted_key_goes_through_omv_and_the_account_stays_open() -> None:
assert result["success"], result["output"]
assert omv.users["alice"]["sshpubkeys"] == []
assert not [c for c, _ in driver.ran if c.startswith(("usermod", "gpasswd"))]
def test_a_deleted_key_takes_the_password_and_sudo_with_it_on_omv() -> None:
"""NetOrk/netork#2033: the key goes through OMV, the password with usermod as on
napalm-linux, and sudo; the account stays open and in _ssh."""
omv = Omv()
driver = _Account(omv)
result = driver.remove_local_account_keys("alice", [OWN_KEY], clear_password=True)
assert result["success"], result["output"]
assert [s["step"] for s in result["steps"]] == ["keys", "password", "sudo"]
assert omv.users["alice"]["sshpubkeys"] == []
assert ("usermod -p '*' alice", True) in driver.ran
assert ("rm -f -- /etc/sudoers.d/80-account-alice", True) in driver.ran
assert not [c for c, _ in driver.ran if c.startswith("gpasswd -d alice _ssh")]