mirror of
https://github.com/marcoallegretti/WEFT_OS.git
synced 2026-11-22 08:13:59 +00:00
fix(nixos): show the session and install the mount helper setuid
The VM ran without graphics, so the desktop could not be seen, and weft-appd was pointed at the mount helper's store path, which cannot be set-user-ID, so verified package images could not mount. The VM opens a graphics window, with tty0 as the primary console and the serial console as a secondary one. weft-mount-helper is installed through security.wrappers, setuid root and executable only by the users group, built to run cryptsetup's veritysetup, and weft-appd uses /run/wrappers/bin/weft-mount-helper.
This commit is contained in:
parent
076ed95eb1
commit
bc649d17c4
3 changed files with 23 additions and 5 deletions
|
|
@ -144,9 +144,9 @@ See `infra/nixos/weft-packages.nix` for the package derivations. Its `outputHash
|
|||
Logging in on tty1 starts the user target `weft-session.target`, which binds `graphical-session.target` (that one refuses a manual start) and wants `weft-compositor`, then `weft-servo-shell` with the system UI page its package installs, and `weft-appd` with the runtime, app shell, file portal and mount helper packages. Run as a systemd user service, the compositor publishes its socket as `WAYLAND_DISPLAY` to the user manager before reporting readiness, so the units after it, and the app shells weft-appd starts, connect to it. The units in `infra/systemd/` are the same session for an installation outside Nix, as user units under `weft-session.target`. The image is not yet bootable to a working desktop:
|
||||
|
||||
- the Servo source hash in `outputHashes` is still a placeholder, so no package builds until a Nix build reports it;
|
||||
- the shell packages do not enable `servo-embed`, so `weft-servo-shell` and `weft-app-shell` exit at startup;
|
||||
- the VM runs without graphics (`virtualisation.graphics = false` in `infra/nixos/configuration.nix`, for a serial console), so the session's output is not shown;
|
||||
- `WEFT_MOUNT_HELPER` names the mount helper's store path, which cannot be setuid, so verified images cannot be mounted; a setuid wrapper would be needed.
|
||||
- the shell packages do not enable `servo-embed`, so `weft-servo-shell` and `weft-app-shell` exit at startup.
|
||||
|
||||
The VM opens a graphics window; `tty0` is its primary console and the serial console a secondary one. `weft-mount-helper` is installed setuid root through `security.wrappers` at `/run/wrappers/bin/weft-mount-helper`, built to run cryptsetup's `veritysetup`.
|
||||
|
||||
## CI
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@
|
|||
fsType = "ext4";
|
||||
};
|
||||
|
||||
# The session is graphical: tty0 is the primary console, and the serial
|
||||
# console stays available as a secondary one for debugging.
|
||||
virtualisation = {
|
||||
graphics = false;
|
||||
graphics = true;
|
||||
memorySize = 4096;
|
||||
cores = 4;
|
||||
diskSize = 20480;
|
||||
|
|
@ -48,6 +50,18 @@
|
|||
services.getty.autologinUser = "weft";
|
||||
|
||||
security.polkit.enable = true;
|
||||
|
||||
# weft-mount-helper mounts verified package images and must run as root;
|
||||
# the Nix store cannot hold set-user-ID programs. Only the session user's
|
||||
# group may run it, and it mounts only in the caller's own runtime
|
||||
# directory (see crates/weft-mount-helper).
|
||||
security.wrappers.weft-mount-helper = {
|
||||
source = "${pkgs.weft.weft-mount-helper}/bin/weft-mount-helper";
|
||||
owner = "root";
|
||||
group = "users";
|
||||
setuid = true;
|
||||
permissions = "u+rx,g+x";
|
||||
};
|
||||
services.dbus.enable = true;
|
||||
|
||||
services.udev.packages = [ pkgs.libinput ];
|
||||
|
|
@ -134,7 +148,7 @@
|
|||
"WEFT_RUNTIME_BIN=${pkgs.weft.weft-runtime}/bin/weft-runtime"
|
||||
"WEFT_APP_SHELL_BIN=${pkgs.weft.weft-app-shell}/bin/weft-app-shell"
|
||||
"WEFT_FILE_PORTAL_BIN=${pkgs.weft.weft-file-portal}/bin/weft-file-portal"
|
||||
"WEFT_MOUNT_HELPER=${pkgs.weft.weft-mount-helper}/bin/weft-mount-helper"
|
||||
"WEFT_MOUNT_HELPER=/run/wrappers/bin/weft-mount-helper"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -82,5 +82,9 @@ in {
|
|||
weft-mount-helper = mkWeftPkg {
|
||||
pname = "weft-mount-helper";
|
||||
extraBuildInputs = with pkgs; [ cryptsetup ];
|
||||
# The helper runs setuid and takes no program from its caller's PATH.
|
||||
extraEnv = {
|
||||
WEFT_VERITYSETUP = "${pkgs.cryptsetup}/bin/veritysetup";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue