feat: netOrk's own account with a fixed uid on FreeBSD (NetOrk/netork#1817)
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 1m3s
driver / test (3.12) (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 56s
driver / lowest (pull_request) Successful in 31s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m16s
CI / driver (pull_request) Successful in 2m39s
driver / publish (pull_request) Skipped

_account_create_with_uid makes it with pw useradd -u <uid> -m -w no.
This commit is contained in:
Christian Manivong committed 2026-11-01 12:42:30 +01:00
1 parent f394610468
commit b89ad07991
3 files changed
+26

No files matched your search

+2
View File
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added ### Added
- netOrk's own account with a fixed uid on FreeBSD (NetOrk/netork#1817):
`_account_create_with_uid` makes it with `pw useradd -u <uid> -m -w no`.
- Personal accounts on FreeBSD (NetOrk/netork#1793), through napalm-device-types' - Personal accounts on FreeBSD (NetOrk/netork#1793), through napalm-device-types'
`LocalAccountsMixin`: `get_local_accounts()`, `add_local_account()` and `LocalAccountsMixin`: `get_local_accounts()`, `add_local_account()` and
`lock_local_account()` with `pw useradd -m -w no`, `chpass -p` for the password hash, `lock_local_account()` with `pw useradd -m -w no`, `chpass -p` for the password hash,
+17
View File
@@ -29,6 +29,23 @@ class FreeBSDLocalAccountsMixin(LocalAccountsMixin):
create = ["pw", "useradd", "-n", name, "-m", "-s", self.ACCOUNT_SHELL, "-w", "no"] create = ["pw", "useradd", "-n", name, "-m", "-s", self.ACCOUNT_SHELL, "-w", "no"]
return [create, *self._set_password(name, password_hash)] return [create, *self._set_password(name, password_hash)]
def _account_create_with_uid(self, name: str, uid: int) -> list[list[str]]:
return [
[
"pw",
"useradd",
"-n",
name,
"-u",
str(uid),
"-m",
"-s",
self.ACCOUNT_SHELL,
"-w",
"no",
]
]
def _account_open( def _account_open(
self, name: str, password_hash: str | None, *, locked: bool self, name: str, password_hash: str | None, *, locked: bool
) -> list[list[str]]: ) -> list[list[str]]:
+7
View File
@@ -97,3 +97,10 @@ def test_leaving_a_group_is_pw_groupmod() -> None:
"-d", "-d",
"alice", "alice",
] ]
def test_netorks_own_account_is_made_with_its_uid() -> None:
"""NetOrk/netork#1817: a fixed uid on every host, no password."""
assert _Driver()._account_create_with_uid("netork", 900) == [
["pw", "useradd", "-n", "netork", "-u", "900", "-m", "-s", "/bin/sh", "-w", "no"]
]