aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--nixos.nix1
-rw-r--r--options.nix1
-rw-r--r--test.nix28
3 files changed, 29 insertions, 1 deletions
diff --git a/nixos.nix b/nixos.nix
index c5729ada..103ff6e7 100644
--- a/nixos.nix
+++ b/nixos.nix
@@ -118,6 +118,7 @@ in
};
map_real_uid = app.mapRealUid;
no_new_session = app.tty;
+ direct_wayland = app.insecureWayland;
filesystem =
let
bind = src: { inherit src; };
diff --git a/options.nix b/options.nix
index 7f44ef4c..4da0f341 100644
--- a/options.nix
+++ b/options.nix
@@ -146,6 +146,7 @@ in
mapRealUid = mkEnableOption "mapping to priv-user uid";
dev = mkEnableOption "access to all devices";
tty = mkEnableOption "access to the controlling terminal";
+ insecureWayland = mkEnableOption "direct access to the Wayland socket";
net = mkEnableOption "network access" // {
default = true;
diff --git a/test.nix b/test.nix
index 78361596..5f41d40a 100644
--- a/test.nix
+++ b/test.nix
@@ -81,7 +81,7 @@ nixosTest {
mkdir -p ~/.config/sway
(sed s/Mod4/Mod1/ /etc/sway/config &&
echo 'output * bg ${pkgs.nixos-artwork.wallpapers.simple-light-gray.gnomeFilePath} fill' &&
- echo 'output Virtual-1 res 1280x768') > ~/.config/sway/config
+ echo 'output Virtual-1 res 1680x1050') > ~/.config/sway/config
sway --validate
systemd-cat --identifier=sway sway && touch /tmp/sway-exit-ok
@@ -149,6 +149,18 @@ nixosTest {
};
}
{
+ name = "da-foot";
+ verbose = true;
+ insecureWayland = true;
+ share = pkgs.foot;
+ packages = [ pkgs.foot ];
+ command = "foot";
+ capability = {
+ dbus = false;
+ pulse = false;
+ };
+ }
+ {
name = "strace-failure";
verbose = true;
share = pkgs.strace;
@@ -323,6 +335,20 @@ nixosTest {
machine.send_chars("exit\n")
machine.wait_until_fails("pgrep alacritty")
+ # Start app (foot) with direct Wayland access:
+ swaymsg("exec da-foot")
+ wait_for_window("u0_a4@machine")
+ machine.send_chars("clear; wayland-info && touch /tmp/success-direct\n")
+ machine.wait_for_file("/tmp/fortify.1000/tmpdir/4/success-direct")
+ collect_state_ui("foot_direct")
+ check_state("da-foot", 1)
+ # Verify acl on XDG_RUNTIME_DIR:
+ print(machine.succeed("getfacl --absolute-names --omit-header --numeric /run/user/1000 | grep 1000004"))
+ machine.send_chars("exit\n")
+ machine.wait_until_fails("pgrep foot")
+ # Verify acl cleanup on XDG_RUNTIME_DIR:
+ machine.wait_until_fails("getfacl --absolute-names --omit-header --numeric /run/user/1000 | grep 1000004")
+
# Test syscall filter:
print(machine.fail("sudo -u alice -i XDG_RUNTIME_DIR=/run/user/1000 strace-failure"))