feat: netOrk's own account through the current login (NetOrk/netork#1817) #67

Merged
christianmanivong merged 3 commits from feature/system-user-1817 into main 2026-11-01 12:39:42 +00:00
Owner

LocalAccountsMixin.add_service_account(name, public_key), for NetOrk/netork#1817: netOrk's own account, created through the login the driver uses today.

  • Creates the account, or reopens one that is there and keeps its other keys. It takes a key and no password.
  • Adds a sudo rule of its own, <sudoers.d>/85-service-<name> with <name> ALL=(ALL) NOPASSWD: ALL, checked with visudo before it is installed and with sudo -l afterwards. A rule that asks for a password is not enough.
  • Refuses root. Run again with the account the driver already logs in with, it only adds what is missing.
  • Same steps as add_local_account (account, then sudo and keys). Every command root runs is still one fixed command.
  • Trying the new login is up to the caller; netOrk does that before it switches a device.

Linux, FreeBSD and OpenMediaVault inherit it without changes; QNAP opts out (NAPALM/napalm-qnap-qts, same branch).

Tests: tests/test_service_account.py (16), full suite 1022 green, ratchet and napalm-standard check green.

`LocalAccountsMixin.add_service_account(name, public_key)`, for NetOrk/netork#1817: netOrk's own account, created through the login the driver uses today. - Creates the account, or reopens one that is there and keeps its other keys. It takes a key and no password. - Adds a sudo rule of its own, `<sudoers.d>/85-service-<name>` with `<name> ALL=(ALL) NOPASSWD: ALL`, checked with `visudo` before it is installed and with `sudo -l` afterwards. A rule that asks for a password is not enough. - Refuses root. Run again with the account the driver already logs in with, it only adds what is missing. - Same steps as `add_local_account` (`account`, then `sudo` and `keys`). Every command root runs is still one fixed command. - Trying the new login is up to the caller; netOrk does that before it switches a device. Linux, FreeBSD and OpenMediaVault inherit it without changes; QNAP opts out (NAPALM/napalm-qnap-qts, same branch). Tests: `tests/test_service_account.py` (16), full suite 1022 green, ratchet and `napalm-standard check` green.
christianmanivong added 1 commit 2026-11-01 11:03:14 +00:00
feat: netOrk's own account through the current login (NetOrk/netork#1817)
driver / lint (pull_request) Failing after 7s
driver / standard (pull_request) Successful in 21s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m9s
driver / test (3.13) (pull_request) Successful in 1m6s
driver / lowest (pull_request) Successful in 50s
driver / build (pull_request) Successful in 38s
driver / security (pull_request) Successful in 1m19s
CI / driver (pull_request) Failing after 2m35s
driver / publish (pull_request) Skipped
666be091e3
add_service_account(name, public_key) creates or reopens the account through
the login the driver uses today: a key and no password, and a rule of its own
in 85-service-<name> that lets it run everything as root without a password,
checked with visudo and sudo -l. Root is refused; run again with the account
the driver already logs in with, it only adds what is missing.
christianmanivong added 1 commit 2026-11-01 11:42:30 +00:00
feat: a fixed uid for netOrk's own account (NetOrk/netork#1817)
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 1m2s
driver / lowest (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m3s
driver / build (pull_request) Successful in 26s
driver / test (3.12) (pull_request) Successful in 1m10s
CI / driver (pull_request) Successful in 1m10s
driver / publish (pull_request) Skipped
3f59023f46
add_service_account(uid=) makes a new account with that uid once no other
account has it, through the driver's _account_create_with_uid; an account that
is there keeps its own, as a uid is never changed under files that carry it.
The infrastructure's build standard wants the same uid on every host.
Author
Owner

Second commit 3f59023: add_service_account(uid=). A new account gets the uid once no other account has it, through the driver hook _account_create_with_uid; an account that is already there keeps its own (infrastructure BAUSTANDARD A). The hooks: NAPALM/napalm-linux, NAPALM/napalm-bsd, NAPALM/napalm-openmediavault (OMV opts out), each on branch feature/system-user-uid-1817. Suite 1027 green.

Second commit 3f59023: `add_service_account(uid=)`. A new account gets the uid once no other account has it, through the driver hook `_account_create_with_uid`; an account that is already there keeps its own (infrastructure BAUSTANDARD A). The hooks: NAPALM/napalm-linux, NAPALM/napalm-bsd, NAPALM/napalm-openmediavault (OMV opts out), each on branch feature/system-user-uid-1817. Suite 1027 green.
christianmanivong added 1 commit 2026-11-01 12:36:38 +00:00
fix: another service's account of the same name is left alone (NetOrk/netork#1817)
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 59s
driver / lowest (pull_request) Successful in 30s
driver / security (pull_request) Successful in 55s
driver / build (pull_request) Successful in 26s
driver / test (3.12) (pull_request) Successful in 56s
CI / driver (pull_request) Successful in 56s
driver / publish (pull_request) Skipped
47751d12d6
On bw-01, netork is the satellite's own user (nologin, in docker).
add_service_account opened it, gave it the passwordless sudo rule and netOrk's
key, and only the login as it failed. An account that is there and cannot log
in (nologin, false) is now refused before anything changes.
christianmanivong merged commit 97cb8779c5 into main 2026-11-01 12:39:42 +00:00
christianmanivong deleted branch feature/system-user-1817 2026-11-01 12:39:42 +00:00
Sign in to join this conversation.