Personal accounts on FreeBSD now follow what the person changes. See NetOrk/netork#2013.
Needs the napalm-device-types release first (NAPALM/napalm-device-types#90, assumed to be 4.28.0). The floor is raised to napalm-device-types>=4.28.0.
Replace a key (add_local_account(..., replaces=[...])) and remove keys (remove_local_account_keys) use the mixin's key-file implementation. As the person, it reads ~/.ssh/authorized_keys{,2} and runs install -m 600 with the kept lines, or rm -f when nothing is left. Root only runs test -e.
Clear the password (add_local_account(..., clear_password=True)): chpass -p '*' <name>. The sudo step removes /usr/local/etc/sudoers.d/80-account-<name> and runs pw groupmod wheel -d <name>.
Why *
* is the field pw useradd -w no gives a new key-only account, and that already logs in with a key. No hash matches it. sshd takes only *LOCKED* (the pw lock prefix) for a locked account, so the key still works with or without PAM. chpass -p is what the driver already uses to set a hash. A locked account is unlocked by the account step (pw unlock) before the password step runs.
Tests
Fixtures only, no device. Two tests failed first: test_clearing_the_password_leaves_the_star_pw_gives_a_key_only_account and test_removing_the_password_runs_chpass_and_takes_sudo_away. New tests also pin the replace and remove commands. 192 tests pass against the device-types branch. ruff, napalm-standard check and ratchet are clean, and mypy reports nothing in napalm_bsd.
## What
Personal accounts on FreeBSD now follow what the person changes. See NetOrk/netork#2013.
**Needs the napalm-device-types release first** (NAPALM/napalm-device-types#90, assumed to be 4.28.0). The floor is raised to `napalm-device-types>=4.28.0`.
- **Replace a key** (`add_local_account(..., replaces=[...])`) and **remove keys** (`remove_local_account_keys`) use the mixin's key-file implementation. As the person, it reads `~/.ssh/authorized_keys{,2}` and runs `install -m 600` with the kept lines, or `rm -f` when nothing is left. Root only runs `test -e`.
- **Clear the password** (`add_local_account(..., clear_password=True)`): `chpass -p '*' <name>`. The `sudo` step removes `/usr/local/etc/sudoers.d/80-account-<name>` and runs `pw groupmod wheel -d <name>`.
## Why `*`
`*` is the field `pw useradd -w no` gives a new key-only account, and that already logs in with a key. No hash matches it. sshd takes only `*LOCKED*` (the `pw lock` prefix) for a locked account, so the key still works with or without PAM. `chpass -p` is what the driver already uses to set a hash. A locked account is unlocked by the `account` step (`pw unlock`) before the `password` step runs.
## Tests
Fixtures only, no device. Two tests failed first: `test_clearing_the_password_leaves_the_star_pw_gives_a_key_only_account` and `test_removing_the_password_runs_chpass_and_takes_sudo_away`. New tests also pin the replace and remove commands. 192 tests pass against the device-types branch. ruff, `napalm-standard check` and `ratchet` are clean, and mypy reports nothing in `napalm_bsd`.
napalm-device-types 4.28.0 lets add_local_account remove the old keys
(replaces) and the password (clear_password), and adds
remove_local_account_keys. The key changes run through the mixin's own
key files as the person; the password goes with chpass -p '*', the
field pw useradd -w no writes, which sshd does not take for a lock.
See NetOrk/netork#2013
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.
What
Personal accounts on FreeBSD now follow what the person changes. See NetOrk/netork#2013.
Needs the napalm-device-types release first (NAPALM/napalm-device-types#90, assumed to be 4.28.0). The floor is raised to
napalm-device-types>=4.28.0.add_local_account(..., replaces=[...])) and remove keys (remove_local_account_keys) use the mixin's key-file implementation. As the person, it reads~/.ssh/authorized_keys{,2}and runsinstall -m 600with the kept lines, orrm -fwhen nothing is left. Root only runstest -e.add_local_account(..., clear_password=True)):chpass -p '*' <name>. Thesudostep removes/usr/local/etc/sudoers.d/80-account-<name>and runspw groupmod wheel -d <name>.Why
**is the fieldpw useradd -w nogives a new key-only account, and that already logs in with a key. No hash matches it. sshd takes only*LOCKED*(thepw lockprefix) for a locked account, so the key still works with or without PAM.chpass -pis what the driver already uses to set a hash. A locked account is unlocked by theaccountstep (pw unlock) before thepasswordstep runs.Tests
Fixtures only, no device. Two tests failed first:
test_clearing_the_password_leaves_the_star_pw_gives_a_key_only_accountandtest_removing_the_password_runs_chpass_and_takes_sudo_away. New tests also pin the replace and remove commands. 192 tests pass against the device-types branch. ruff,napalm-standard checkandratchetare clean, and mypy reports nothing innapalm_bsd.