feat(local-accounts): a deleted key can take the password with it #23

Merged
christianmanivong merged 1 commits from feat/remove-keys-clear-password into main 2026-11-04 14:48:14 +00:00
3 changed files with 22 additions and 2 deletions

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")]