patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Cc: Yureka Lilian <yureka@cyberchaos.dev>,
	Demi Marie Obenour <demiobenour@gmail.com>
Subject: [PATCH v3 3/3] host/rootfs: run router as non-root
Date: Tue,  9 Dec 2025 13:54:45 +0100	[thread overview]
Message-ID: <20251209125442.719952-6-hi@alyssa.is> (raw)
In-Reply-To: <20251209125442.719952-2-hi@alyssa.is>

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
v3: no change

 host/rootfs/image/etc/group                                   | 1 +
 host/rootfs/image/etc/passwd                                  | 1 +
 .../vm-services/template/data/service/spectrum-router/run     | 4 +++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/host/rootfs/image/etc/group b/host/rootfs/image/etc/group
index e3ade468..299ea68a 100644
--- a/host/rootfs/image/etc/group
+++ b/host/rootfs/image/etc/group
@@ -13,3 +13,4 @@ disk:x:11:
 cdrom:x:12:
 tape:x:13:
 kvm:x:14:
+router:x:15:router
diff --git a/host/rootfs/image/etc/passwd b/host/rootfs/image/etc/passwd
index 29f3b252..8c579ce8 100644
--- a/host/rootfs/image/etc/passwd
+++ b/host/rootfs/image/etc/passwd
@@ -1 +1,2 @@
 root:x:0:0:System administrator:/:/bin/sh
+router:x:15:15::/:/bin/nologin
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/run
index ec26b76f..2c6626e3 100755
--- a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/run
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/spectrum-router/run
@@ -11,13 +11,15 @@ fdmove -c 3 0
 s6-ipcserver-socketbinder -a 0770 /run/router/${VM}
 fdmove -c 4 0
 
+redirfd -r 0 /dev/null
+
 # Notify readiness.
 if {
   fdmove -c 5 1
   echo
 }
 
-redirfd -r 0 /dev/null
+s6-setuidgid router
 
 bwrap
   --unshare-all
-- 
2.51.0


  parent reply	other threads:[~2025-12-09 12:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 12:54 [PATCH v3 1/3] tools/router: use socket activation Alyssa Ross
2025-12-09 12:54 ` [PATCH v3 2/3] host/rootfs: put router app sockets in own dir Alyssa Ross
2025-12-14  0:13   ` Alyssa Ross
2025-12-09 12:54 ` Alyssa Ross [this message]
2025-12-14  0:13   ` [PATCH v3 3/3] host/rootfs: run router as non-root Alyssa Ross
2025-12-14  0:13 ` [PATCH v3 1/3] tools/router: use socket activation Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251209125442.719952-6-hi@alyssa.is \
    --to=hi@alyssa.is \
    --cc=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=yureka@cyberchaos.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).