feat: personal accounts the way OMV's web UI makes them (NetOrk/netork#1793) #12

Merged
christianmanivong merged 1 commits from feat/local-accounts into main 2026-10-31 23:44:55 +00:00
Owner

Part of NetOrk/netork#1793. OMV inherits napalm-linux's personal accounts (NAPALM/napalm-linux#50, on NAPALM/napalm-device-types#62). Those two need to be merged first: CI pre-installs both from main.

Why OMV needs its own variant

  • OMV's sshd has AllowGroups root _ssh. An account made with plain useradd is refused.
  • OMV keeps a user's keys in its own database (sshpubkeys, RFC 4716). Its ssh module deploys them to /var/lib/openmediavault/ssh/authorized_keys/<user>, a directory the user cannot write to. sshd reads that file next to ~/.ssh.
  • OMV creates a home only when its home directory setting is on, so ~/.ssh may not exist.

What it does

  • Create: UserMgmt.setUser with groups: ["_ssh"], then usermod -p <hash>. setUser takes a plain password, netOrk holds only the hash, and an empty password tells OMV to leave the password alone.
  • Open again: napalm-linux's commands, then gpasswd -a <name> _ssh, so an account made outside OMV gets in too.
  • Keys: added and removed through setUser, keeping the user's other fields (email, groups, comment, shell). On lock, the ~/.ssh files go as well. Reading an account back includes OMV's deployed file (_account_key_files).
  • Applying: each setUser applies exactly the modules it made dirty (OMV 8: postfix, ssh). A module left pending in the web UI stays pending.
  • Lock: napalm-linux's expiry (usermod -L -e 1), which OMV leaves alone.
  • Like the web UI, setUser gives the account OMV's primary group users. That includes an account made outside OMV.

Verified

A fresh OMV 8 (Synchrony, Debian 13) in QEMU, tested with the real driver over SSH and sudo -S:

  • new account: made by OMV, in users + _ssh, key deployed, SSH and sudo work
  • lock: SSH refused (255), OMV's keys emptied
  • reopen without sudo: SSH works, sudo is refused
  • an account made with useradd (refused before, 255) gets in after add_local_account
  • nothing is left dirty afterwards, and a module marked dirty beforehand (apt) stays dirty

A bug found that way and fixed here: account creation first ran setUser without applying. That left postfix dirty, and the keys step then took it for someone else's pending change.

Part of NetOrk/netork#1793. OMV inherits napalm-linux's personal accounts (NAPALM/napalm-linux#50, on NAPALM/napalm-device-types#62). Those two need to be merged first: CI pre-installs both from `main`. ## Why OMV needs its own variant - OMV's sshd has `AllowGroups root _ssh`. An account made with plain `useradd` is refused. - OMV keeps a user's keys in its own database (`sshpubkeys`, RFC 4716). Its `ssh` module deploys them to `/var/lib/openmediavault/ssh/authorized_keys/<user>`, a directory the user cannot write to. sshd reads that file next to `~/.ssh`. - OMV creates a home only when its home directory setting is on, so `~/.ssh` may not exist. ## What it does - **Create:** `UserMgmt.setUser` with `groups: ["_ssh"]`, then `usermod -p <hash>`. `setUser` takes a plain password, netOrk holds only the hash, and an empty password tells OMV to leave the password alone. - **Open again:** napalm-linux's commands, then `gpasswd -a <name> _ssh`, so an account made outside OMV gets in too. - **Keys:** added and removed through `setUser`, keeping the user's other fields (email, groups, comment, shell). On lock, the `~/.ssh` files go as well. Reading an account back includes OMV's deployed file (`_account_key_files`). - **Applying:** each `setUser` applies exactly the modules it made dirty (OMV 8: `postfix`, `ssh`). A module left pending in the web UI stays pending. - **Lock:** napalm-linux's expiry (`usermod -L -e 1`), which OMV leaves alone. - Like the web UI, `setUser` gives the account OMV's primary group `users`. That includes an account made outside OMV. ## Verified A fresh OMV 8 (Synchrony, Debian 13) in QEMU, tested with **the real driver** over SSH and `sudo -S`: - new account: made by OMV, in `users` + `_ssh`, key deployed, SSH and sudo work - lock: SSH refused (255), OMV's keys emptied - reopen without sudo: SSH works, sudo is refused - an account made with `useradd` (refused before, 255) gets in after `add_local_account` - nothing is left dirty afterwards, and a module marked dirty beforehand (`apt`) stays dirty A bug found that way and fixed here: account creation first ran `setUser` without applying. That left `postfix` dirty, and the keys step then took it for someone else's pending change.
christianmanivong added 1 commit 2026-10-31 22:43:59 +00:00
feat: personal accounts the way OMV's web UI makes them (NetOrk/netork#1793)
driver / standard (pull_request) Failing after 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Failing after 1m13s
driver / test (3.13) (pull_request) Failing after 1m6s
driver / test (3.12) (pull_request) Failing after 1m17s
driver / lowest (pull_request) Failing after 29s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Failing after 2m25s
driver / publish (pull_request) Skipped
d477fb1a76
napalm-linux adds and locks accounts with shadow-utils and keys in ~/.ssh.
OMV's sshd lets in only root and _ssh, and OMV keeps a user's keys in its
own database, deploying them to /var/lib/openmediavault/ssh/authorized_keys.
So a new account is made by UserMgmt.setUser in _ssh, one made outside OMV
joins _ssh when it is opened, and keys go through setUser. Each call applies
the modules it made dirty (postfix, ssh) and leaves what was pending in the
web UI pending. setUser takes a plain password, netOrk only the hash, so the
hash is set with usermod -p. The lock stays napalm-linux's expiry.

Checked on a fresh OMV 8 (Debian 13) with the real driver over SSH and
sudo -S: a new account logs in with its key and uses sudo, is refused
after locking with OMV's keys emptied, logs in again after reopening; an
account made outside OMV is let in once it joined _ssh; a module left
dirty before stays dirty.
christianmanivong merged commit 403899916f into main 2026-10-31 23:44:55 +00:00
christianmanivong deleted branch feat/local-accounts 2026-10-31 23:44:55 +00:00
Sign in to join this conversation.