Re: [systemd-devel] dbus-broker can be used for a "user" type bus accessible over tcp or not?

2025-01-20 Thread Mantas Mikulėnas
On Tue, Jan 21, 2025 at 8:47 AM Erik Slagter wrote: > Hi Lennart, > > That is exactly the answer I expected, if only because apparently > systemd does it exactly that ;-) > > But not everything needs to be enterprise-grade. This is going to run > inside my own house in a piece of network that's c

Re: [systemd-devel] switch-root, init, SIGHUP

2025-01-20 Thread Brian Masney
Hey James, On Mon, Jan 20, 2025 at 1:21 PM James Muir (jamesmui) wrote: > I think the SIGHUP must come from the new PID 1. I don't know if this will help you, however here is a program that I wrote last year that starts a service in the initramfs, it survives the systemd killing spree during the

Re: [systemd-devel] switch-root, init, SIGHUP

2025-01-20 Thread James Muir (jamesmui)
> > It is not clear to me if the '@' is necessary because the process is > > invoked using the "init" kernel parameter. > > That detail doesn't matter. It's irrelevant how the process gets > started. In particular as I understand you you fork()ed once, > i.e. init= starts PID 1, but this is not PID

Re: [systemd-devel] dbus-broker can be used for a "user" type bus accessible over tcp or not?

2025-01-20 Thread Erik Slagter
Hi Lennart, That is exactly the answer I expected, if only because apparently systemd does it exactly that ;-) But not everything needs to be enterprise-grade. This is going to run inside my own house in a piece of network that's completely trusted. I can completely imagine it's not sane to

Re: [systemd-devel] systemd-devel] dbus-broker can be used for a "user" type bus accessible over tcp or not?

2025-01-20 Thread Simon McVittie
On Mon, 20 Jan 2025 at 20:19:01 +0100, Erik Slagter wrote: > So I'd rather have dbus-broker listening to a TCP socket and if that can't > be done, using dbus-daemon. Please don't do either of these. Having a D-Bus "user bus" (session bus) listening on TCP and willing to execute arbitrary code was

Re: [systemd-devel] switch-root, init, SIGHUP

2025-01-20 Thread Lennart Poettering
On Mo, 20.01.25 18:21, James Muir (jamesmui) (james...@cisco.com) wrote: > > Are you sure you are setting argv[0][0] properly? the killing spree we > > do on switch root should exclude processes marked like that. > > When I check /proc//cmdline, I see the '@' character. > > It is not clear to me i

Re: [systemd-devel] dbus-broker can be used for a "user" type bus accessible over tcp or not?

2025-01-20 Thread Lennart Poettering
On Mo, 20.01.25 18:53, Erik Slagter (e...@slagter.name) wrote: > Hi, > > I am trying to have a remotely accessible dbus. I'd love to discuss all > considerations, but for the moment let's just assume I need it. Sorry, but letting D-Bus listen on TCP is a terrible idea, there's not sane authentica

Re: [systemd-devel] systemd-devel] dbus-broker can be used for a "user" type bus accessible over tcp or not?

2025-01-20 Thread Erik Slagter
Additionally: As a learning experiment I made an socat construction from a listening TCP socket to connecting Unix socket. And it works! Of course this is dirty beyond words and I certainly don't have the courage to try this on the main session or even system bus ;-) So I'd rather have dbus-

Re: [systemd-devel] switch-root, init, SIGHUP

2025-01-20 Thread James Muir (jamesmui)
> > I have a program, init-jm, that forks and executes > > /usr/lib/systemd/systemd in the parent (using execl() ) while the > > child collects some stats in a loop. > > Uh, you can do this, but it's not trivial to get right: you need to > move yourself down the cgroup tree, because otherwise you'l

[systemd-devel] dbus-broker can be used for a "user" type bus accessible over tcp or not?

2025-01-20 Thread Erik Slagter
Hi, I am trying to have a remotely accessible dbus. I'd love to discuss all considerations, but for the moment let's just assume I need it. I already learned that you cannot have the "system" or "session" dbus listening to tcp, as it can run only one socket and it must be a "unix" type socke

Re: [systemd-devel] switch-root, init, SIGHUP

2025-01-20 Thread Lennart Poettering
On Sa, 18.01.25 05:40, James Muir (jamesmui) (james...@cisco.com) wrote: > I have a program, init-jm, that forks and executes > /usr/lib/systemd/systemd in the parent (using execl() ) while the > child collects some stats in a loop. Uh, you can do this, but it's not trivial to get right: you need

Re: [systemd-devel] switch-root, init, SIGHUP

2025-01-20 Thread James Muir (jamesmui)
> I suspect that your process has a controlling tty based on this comment > in the killall() function at src/shared/killall.c: > >if (send_sighup) { >/* Optionally, also send a SIGHUP signal, but only if the process > has a controlling > * tty. This is useful to allow h

Re: [systemd-devel] switch-root, init, SIGHUP

2025-01-20 Thread Brian Masney
Hi James, On Sat, Jan 18, 2025 at 05:40:17AM +, James Muir (jamesmui) wrote: > I have a program, init-jm, that forks and executes /usr/lib/systemd/systemd > in the parent (using execl() ) while the child collects some stats in a loop. > > The child sets its argv[0][0] to ‘@’. > > init-jm is