<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 10, 2024 at 5:51 PM Divine Eguzouwa <<a href="mailto:divine.eguzouwa@gmail.com">divine.eguzouwa@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Assuming: <font face="monospace">run0</font> (and all of systemd for that matter) security works by sandboxing a service's "cgroup-namespace environment" (i.e., through <font face="monospace">User=/Group=,</font> and/or <font face="monospace">NoNewPrivilages=</font>, and/or etc.) and directly executing the given command therin...</div></div></blockquote><div><br></div><div>Most of those parameters actually have nothing to do with cgroups. For example, User= is just a regular process-level setreuid(), the same as you would get from doas/su/runuser.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div>I have a chain of services that executes a process belonging to <font face="monospace">User=/Group=one,</font><font face="arial, sans-serif"> that will read from a specific directory belonging to </font><font face="monospace">User=/Group=two</font><font face="arial, sans-serif">, subsequently resulting in running a </font><font face="monospace">/bin</font><font face="arial, sans-serif"> executable that belongs to </font><font face="monospace">User=/Group=ANY</font><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Please walk me through how to model </font><font face="monospace">run0 --user</font><font face="arial, sans-serif"> to accomplish this in an "environment" <i>without authentication</i>? So far I keep bumping into "</font><font face="monospace">Failed to start transient service unit: Interactive authentication required.</font><font face="arial, sans-serif">" errors which leads me to believe that my earlier assumption is incorrect</font></div></div></blockquote><div><br></div><div>I don't think run0 is meant for such use at all; starting transient services in batch would be better done through systemd-run (or the corresponding D-Bus API) – assuming you need them to be independent services at all, that is.</div><div><br></div><div>Both use the same authorization method (PolicyKit) – you could write an /etc/polkit-1 rule to allow a certain user to create transient units – but I don't know if that can be granular enough to only allow userA>userB transitions. Most likely it will be "all or nothing", i.e. if you allow userA to call run0/systemd-run, that user will be able to become *any* user... A chain of predefined .service units might work better.<br></div></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>