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.
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.
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.
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.
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.
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.
LocalAccountsMixin.add_service_account(name, public_key), for NetOrk/netork#1817: netOrk's own account, created through the login the driver uses today.<sudoers.d>/85-service-<name>with<name> ALL=(ALL) NOPASSWD: ALL, checked withvisudobefore it is installed and withsudo -lafterwards. A rule that asks for a password is not enough.add_local_account(account, thensudoandkeys). Every command root runs is still one fixed command.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 andnapalm-standard checkgreen.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.