Part of NetOrk/netork#1793. FreeBSDDriver mixes in napalm-device-types' LocalAccountsMixin (NAPALM/napalm-device-types#62), which needs to be merged first. CI pre-installs device-types main until that release is on PyPI.
Commands
Create: pw useradd -n <name> -m -s /bin/sh -w no, then chpass -p <hash> <name> when a password hash is given. chpass takes the crypt(3) string from root.
Lock: pw lock <name>, only when the account is not locked yet, because pw refuses a second lock. The *LOCKED* prefix makes sshd refuse a key login too. That matters here: nuageinit sets UsePAM no, so nothing else would refuse it.
Open again: pw unlock <name> when locked, plus chpass -p for a new hash.
Lock state: getent passwd <name> as root. getpwnam(3) shows the password field to root only. Only the prefix is looked at.
Leave a group: pw groupmod <group> -d <name>. The admin group is wheel.
Sudo rule: /usr/local/etc/sudoers.d/80-account-<name>. The port's sudoers ends in @includedir /usr/local/etc/sudoers.d, confirmed on the VM.
Verified
FreeBSD 15.1-RELEASE-p6 cloud image in QEMU, set up by nuageinit, tested with the real driver over SSH with sudo -S:
add with sudo: key login works, and sudo takes the person's password
lock: key login is refused (ssh 255), keys and sudo are gone
reopen without sudo: key login works, sudo is refused
an account in wheel leaves it
the login user's own account and root are refused
OpenBSD is left out (OpenBSDDriver offers none of it, and a test pins that) while OpenBSD work is deferred.
Part of NetOrk/netork#1793. `FreeBSDDriver` mixes in napalm-device-types' `LocalAccountsMixin` (NAPALM/napalm-device-types#62), which needs to be merged first. CI pre-installs device-types `main` until that release is on PyPI.
## Commands
- Create: `pw useradd -n <name> -m -s /bin/sh -w no`, then `chpass -p <hash> <name>` when a password hash is given. chpass takes the crypt(3) string from root.
- Lock: `pw lock <name>`, only when the account is not locked yet, because pw refuses a second lock. The `*LOCKED*` prefix makes sshd refuse a key login too. That matters here: nuageinit sets `UsePAM no`, so nothing else would refuse it.
- Open again: `pw unlock <name>` when locked, plus `chpass -p` for a new hash.
- Lock state: `getent passwd <name>` as root. getpwnam(3) shows the password field to root only. Only the prefix is looked at.
- Leave a group: `pw groupmod <group> -d <name>`. The admin group is `wheel`.
- Sudo rule: `/usr/local/etc/sudoers.d/80-account-<name>`. The port's sudoers ends in `@includedir /usr/local/etc/sudoers.d`, confirmed on the VM.
## Verified
FreeBSD 15.1-RELEASE-p6 cloud image in QEMU, set up by nuageinit, tested with **the real driver** over SSH with `sudo -S`:
- add with sudo: key login works, and `sudo` takes the person's password
- lock: key login is refused (ssh 255), keys and sudo are gone
- reopen without sudo: key login works, sudo is refused
- an account in `wheel` leaves it
- the login user's own account and `root` are refused
OpenBSD is left out (`OpenBSDDriver` offers none of it, and a test pins that) while OpenBSD work is deferred.
FreeBSDDriver mixes in napalm-device-types' LocalAccountsMixin: pw useradd
-m -w no, chpass -p for the password hash, pw lock/unlock and pw groupmod
-d. A locked account carries *LOCKED*, which sshd refuses a key login too
(nuageinit sets UsePAM no, so nothing else would). getpwnam(3) shows the
password field to root only, so the lock is read with getent as root and
only its prefix is looked at. The sudo rule goes to the sudo package's
/usr/local/etc/sudoers.d.
Checked on a FreeBSD 15.1 cloud image with the real driver over SSH and
sudo -S: key login works after adding and after reopening and is refused
after locking, sudo takes the person's password, wheel is left when sudo
is not wanted. OpenBSD is left out for now.
CI pre-installs napalm-device-types from main until the release with
LocalAccountsMixin is on PyPI.
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.
Part of NetOrk/netork#1793.
FreeBSDDrivermixes in napalm-device-types'LocalAccountsMixin(NAPALM/napalm-device-types#62), which needs to be merged first. CI pre-installs device-typesmainuntil that release is on PyPI.Commands
pw useradd -n <name> -m -s /bin/sh -w no, thenchpass -p <hash> <name>when a password hash is given. chpass takes the crypt(3) string from root.pw lock <name>, only when the account is not locked yet, because pw refuses a second lock. The*LOCKED*prefix makes sshd refuse a key login too. That matters here: nuageinit setsUsePAM no, so nothing else would refuse it.pw unlock <name>when locked, pluschpass -pfor a new hash.getent passwd <name>as root. getpwnam(3) shows the password field to root only. Only the prefix is looked at.pw groupmod <group> -d <name>. The admin group iswheel./usr/local/etc/sudoers.d/80-account-<name>. The port's sudoers ends in@includedir /usr/local/etc/sudoers.d, confirmed on the VM.Verified
FreeBSD 15.1-RELEASE-p6 cloud image in QEMU, set up by nuageinit, tested with the real driver over SSH with
sudo -S:sudotakes the person's passwordwheelleaves itrootare refusedOpenBSD is left out (
OpenBSDDriveroffers none of it, and a test pins that) while OpenBSD work is deferred.