me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

Package the Vinix account seeds and protect local accounts during upgrades

diviocity committed 6 days ago · 7dafff80bc0c1f931106d3b2a5d7d5cc1004e517 View patch
Unverified signature 4 files changed +107 -1
PROFILES.md +1 -1

@@ -44,7 +44,7 @@ Both desktop builders then remove `libOSMesa.so*`, `libGLU.so*` and `libxatracke

4444| `ssl_client` | The `ssl-client` port builds `/usr/bin/ssl_client` against OpenSSL. Its x86_64 fixture verifies a trusted peer and rejects an unrelated CA and a wrong hostname. BusyBox wget still needs a guest test with the release applet configuration. |

4545| `musl-utils`, `scanelf` | The source-built `musl-utils` supplies `getconf`, `getent`, `iconv`, `ldconfig` and a target-specific musl `ldd` wrapper. Its `ldconfig` script uses the packaged `scanelf` from pax-utils. Both ports passed x86_64 recipe checks and installed together in the signed userland root. Verify the arm64 toolchain against its own loader. |

4646| `alpine-release` | `vinix-release` supplies the OS identity and banners. The image builder supplies the image-specific `/etc/vinix-release` tag. |

47-| `alpine-baselayout`, `alpine-baselayout-data` | Map the release's final paths, including account databases, shell profiles, network service tables and runtime directory links. Keep the Vinix account stage's handling of existing databases and verify edited configuration survives an upgrade. |

47+| `alpine-baselayout`, `alpine-baselayout-data` | `vinix-accounts` supplies Vinix's initial account databases. A signed upgrade preserved edited passwd, group and shadow, and made the changed group defaults available in `group.pacnew`. Compare the old amd64 service accounts with consumers before deploying the compact Vinix defaults. Remaining paths include shell profiles, the network registries, runtime links and the release-specific init configuration. |

4848| `apk-tools`, `alpine-keys` | Build target vpac and its OpenPGP dependencies. Update the Vinix `pkg` frontend, package persistence and release image checks that currently use APK paths. Install the release public key through a trusted image and verify on both architectures that vpac rejects a tampered package. |

4949

5050The pinned archives and live v3.21 indexes in the November 2026 worker inventory yield 239 input rows per architecture, including 229 distinct binary names and 135 source origins. Of the 229 names, 50 occur only through X11 index dependencies. Keep the per-architecture inventory outside Git beside its input hashes.

tests/FEED.md +11 -0

@@ -58,6 +58,17 @@ test "$(readlink "$client/root/usr/bin/uname")" = ../../bin/uname

5858grep -Fx ID=vinix "$client/root/etc/os-release"

5959```

6060

61+### Preserve account databases on upgrade

62+

63+The account seed uses the locked root account from Vinix’s own account service. On a builder configured for native vpac builds, this fixture creates two private signed snapshots. The second snapshot adds a vendor group to the package defaults.

64+

65+```sh

66+PATH="$work:$PATH" python3 tests/accounts-upgrade.py vinix-accounts/PKGBUILD.vile \

67+ "$work/keys" "$work/accounts-upgrade" x86_64

68+```

69+

70+The worker installed the first snapshot, added a locked fixture account and upgraded the same root. vpac kept all three edited databases, retained mode 0600 on shadow and wrote the changed default group to `/etc/group.pacnew`. The receipt at `foundation/receipts/accounts-upgrade-01.log` has SHA-256 `34a898a73168702748ae211a6d1b673a445b99e063f5ed8880583f612d46e294`.

71+

6172### Reuse a signed SDK

6273

6374For a later SDK, publish the cumulative archive set to a new repository directory and install the desired package names into a new SDK. A remote builder can unpack a relative snapshot and set `VPAC_MAKEPKG_ROOT` and `VPAC_MAKEPKG_DB` to its extracted `root` and `db` directories.

tests/accounts-upgrade.py new file +69 -0

@@ -0,0 +1,69 @@

1+"""Upgrade a signed Vinix account seed over locally edited, locked test accounts."""

2+import argparse

3+from pathlib import Path

4+import shutil

5+import stat

6+import subprocess

7+

8+

9+def command(*args):

10+ subprocess.run(args, check=True)

11+

12+

13+def test(args):

14+ args.work.mkdir()

15+ src = args.work / "vinix-accounts"

16+ src.mkdir()

17+ recipe = src / "PKGBUILD.vile"

18+ shutil.copyfile(args.recipe, recipe)

19+ manifest = args.work / "manifest"

20+ command("vpac", "--native-build", recipe, manifest)

21+ old, = manifest.read_text().splitlines()

22+ old_feed = args.work / "old-feed"

23+ new_feed = args.work / "new-feed"

24+ command("feed", "publish", args.keys, old_feed, args.arch, old)

25+ client = args.work / "client"

26+ command("feed", "install", args.keys, old_feed, args.arch, client, "--fakeroot", "vinix-accounts")

27+ etc = client / "root/etc"

28+ edited = {}

29+ for name, entry in [("passwd", "fixture:x:45000:45000:Test:/nonexistent:/bin/false"),

30+ ("group", "fixture:x:45000:"), ("shadow", "fixture:!:0:0:99999:7:::")]:

31+ path = etc / name

32+ with path.open("a") as output:

33+ output.write(entry + "\n")

34+ edited[name] = path.read_bytes()

35+ # Only the private test snapshot changes the packaged default group.

36+ text = recipe.read_text()

37+ start = " #:package, fn() {"

38+ if text.count(start) != 1 or text.count("#:pkgrel, 1,") != 1:

39+ raise ValueError("update fixture must match the original recipe")

40+ text = text.replace("#:pkgrel, 1,", "#:pkgrel, 2,")

41+ recipe.write_text(text.replace(start, start + '\n run("sed", "-i", "$a vendor:x:45001:", "group")'))

42+ command("vpac", "--native-build", recipe, manifest)

43+ new, = manifest.read_text().splitlines()

44+ command("feed", "publish", args.keys, new_feed, args.arch, new)

45+ config = (client / "config.vile").read_text()

46+ if config.count("/old-feed/") != 1:

47+ raise ValueError("expected exactly one initial feed in client configuration")

48+ upgrade_config = client / "upgrade.vile"

49+ upgrade_config.write_text(config.replace("/old-feed/", "/new-feed/"))

50+ command("fakeroot", "--", "vpac", "--config", upgrade_config, "u", "--sync", "--noconfirm")

51+ for name, value in edited.items():

52+ if (etc / name).read_bytes() != value:

53+ raise RuntimeError(f"local {name} entries changed on upgrade")

54+ if stat.S_IMODE((etc / "shadow").stat().st_mode) != 0o600:

55+ raise RuntimeError("installed shadow permissions changed")

56+ if "vendor:x:45001:" not in (etc / "group.pacnew").read_text().splitlines():

57+ raise RuntimeError("new packaged group defaults were not preserved for review")

58+ db = client / "db/local"

59+ if not (db / "vinix-accounts-0.1.0-2").is_dir() or (db / "vinix-accounts-0.1.0-1").exists():

60+ raise RuntimeError("account seed version did not upgrade")

61+ print("Account seed upgrade preserved local passwd, group, private shadow and the new group defaults.")

62+

63+

64+if __name__ == "__main__":

65+ parser = argparse.ArgumentParser(description=__doc__)

66+ for name in ["recipe", "keys", "work"]:

67+ parser.add_argument(name, type=lambda path: Path(path).resolve())

68+ parser.add_argument("arch", choices=["x86_64", "aarch64"])

69+ test(parser.parse_args())

vinix-accounts/PKGBUILD.vile new file +26 -0

@@ -0,0 +1,26 @@

1+defpkgbuild(vinix-accounts,

2+ #:pkgname, "vinix-accounts",

3+ #:pkgver, "0.1.0",

4+ #:pkgrel, 1,

5+ #:pkgdesc, "Initial account databases from the Vinix account service",

6+ #:arch, [#:any],

7+ #:url, "https://github.com/vlang/vinix",

8+ #:license, "GPL-2.0-or-later",

9+ #:backup, ["etc/passwd", "etc/group", "etc/shadow"],

10+ #:source, ["https://raw.githubusercontent.com/vlang/vinix/a58255423edea821aef9b2a0d10cb4091d59355a/tools/accounts/defaults/passwd",

11+ "https://raw.githubusercontent.com/vlang/vinix/a58255423edea821aef9b2a0d10cb4091d59355a/tools/accounts/defaults/group",

12+ "https://raw.githubusercontent.com/vlang/vinix/a58255423edea821aef9b2a0d10cb4091d59355a/tools/accounts/defaults/shadow"],

13+ #:sha256sums, ["79492b90d473e2387338ef1518dfbceb9e3392ae5740235a6696621e42218efa",

14+ "7a696fcfba89a55a6d73fa1a03c7f071fad2141340027b17a25db249e26b9be8",

15+ "5dffe858d3df0b14106a1bae99da509d4820468fcbb134044627fced7c2534e7"],

16+ #:check, fn() {

17+ run("grep", "-Fx", "root:x:0:0:root:/root:/bin/sh", "passwd")

18+ run("grep", "-Fx", "root:x:0:", "group")

19+ run("grep", "-Eq", "^root:[!*]", "shadow")

20+ },

21+ #:package, fn() {

22+ for-each(fn(file) {

23+ run("install", "-Dm644", file, string-append(pkgdir(), "/etc/", file))

24+ }, list("passwd", "group"))

25+ run("install", "-Dm600", "shadow", string-append(pkgdir(), "/etc/shadow"))

26+ })