All of lore.kernel.org
 help / color / mirror / Atom feed
From: Norbert Lange <nolange79@gmail.com>
To: Arnout Vandecappelle <arnout@mind.be>
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>,
	"Yann E . MORIN" <yann.morin.1998@free.fr>,
	buildroot <buildroot@buildroot.org>
Subject: Re: [Buildroot] [PATCH v6 1/4] package/dbus-broker: new package
Date: Wed, 27 Jul 2022 21:24:26 +0200	[thread overview]
Message-ID: <CADYdroM-JfgzWwB8D8a-w7qSyGFkuF1z3DJ7pG7w7gRDi300HQ@mail.gmail.com> (raw)
In-Reply-To: <289f02de-d0f2-347f-28be-0cfe52478990@mind.be>


[-- Attachment #1.1: Type: text/plain, Size: 6082 bytes --]

Arnout Vandecappelle <arnout@mind.be> schrieb am Mi., 27. Juli 2022, 21:09:

>
>
> On 27/07/2022 19:31, Norbert Lange wrote:
> >
> >
> > Arnout Vandecappelle <arnout@mind.be <mailto:arnout@mind.be>> schrieb
> am Mi.,
> > 27. Juli 2022, 19:05:
> >
> >
> >
> >     On 27/07/2022 15:47, Norbert Lange wrote:
> >      > Am Mi., 27. Juli 2022 um 13:08 Uhr schrieb Arnout Vandecappelle
> >      > <arnout@mind.be <mailto:arnout@mind.be>>:
> [snip]
> >      >>    So to me the proper approach seems to change dbus itself so
> the daemon is
> >      >> optional, i.e. only libdbus is installed if the daemon is not
> enabled,
> >     similar
> >      >> to e.g. libcurl. BR2_PACKAGE_DBUS_DAEMON should default to y
> because
> >     that's what
> >      >> most people want. We'd have to go through existing packages to
> check if they
> >      >> depend on libdbus or on the daemon - mostly it will be the
> first. If
> >     there is a
> >      >> package that really needs the daemon (I don't actually think
> so), then
> >     we might
> >      >> need to introduce a virtual package for the daemon. Regardless,
> dbus-broker
> >      >> should depend on !BR2_PACKAGE_DBUS_DAEMON.
> >
> >        Looking more detailed at it, this seems too complicated. dbus
> doesn't
> >     offer a
> >     way to install only the library. Also in terms of rootfs size, the
> only
> >     difference is the dbus-daemon and dbus-launch binaries, plus a few
> config
> >     files.
> >     Not really sufficient to make it worth it.
> >
> >        What I will do, I think, is to include logic in dbus to remove the
> >     activation
> >     units (both the service and the socket) when dbus-broker is enabled.
> It is
> >     slightly messy because dbus.mk <http://dbus.mk> and dbus-broker.mk
> >     <http://dbus-broker.mk> become fairly tightly woven
> >     together, but I think it's worth it from a usability perspective.
> >
> >
> > Sounds messy too,
>
>   Agreed. But the only unmessy thing that I found so far is to not use
> dbus-broker at all if original dbus is selected, and I think that that
> pretty
> much defeats the purpose of including dbus-broker.
>
> > I would rather have a dbus-common package that includes the socket an
> config
> > files (and creates the user if necessary).
>
>   That is a good idea. However, it only works for the two dbus
> configuration
> files, not for the systemd units, so it only solves half of the mess. And
> the
> added benefit is not that great. Also, they don't change very often any
> more
> upstream (the last change is from 12/21, before that it's 12/17). So in
> the end
> we decided not to go for dbus-common.
>
>
> > That package would download dbus, but not build it, instead just copy
> over those
> > files.
> > Kinda like util-linux-libs
> >
> >
> >      > Debian does something similar, including splitting of the xml
> config files
> >      > and actual daemons into their own packages.
> >      >
> >      > see [1].
> >      >
> >      >>> Note about the user: the path to the system bus socket is a
> so-called
> >      >>> "well-known location": it is expected to be there, by spec.
> Moving it
> >      >>> elsewhere is going to break existing programs. So, the user
> running the
> >      >>> system bus daemon must be able to create that socket.
> >      >>>
> >      >>> As we may have two packages providing a system bus daemon, they
> have to
> >      >>> be both able to create the socket, and thus must both be able
> to write
> >      >>> in the directory containing the socket. And since they can be
> switched
> >      >>> at runtime, they must be running as the same user.
> >      >>>
> >      >>> We can't just reference the original dbus user, so we duplicate
> the
> >      >>> entry. What is important, is that the user be named 'dbus', as
> that's
> >      >>> what we use in both cases.
> >      >>
> >      >>    If it's a virtual package, then the user could be created by
> the virtual
> >      >> package itself.
> >
> >        It won't be a virtual package, so no longer relevant.
> >
> >
> >      > with systemd you probably dont even need a real user for the
> isolation
> >      > benefits.
> >      > So maybe this would just be necessary if dbus utilities are used,
> >      > you can also just let systemd create that user dynamically:
> >      >
> >      > [Service]
> >      > ...
> >      > User=dbus
> >      > Group=dbus > DynamicUser=true
> >
> >        If we do this both in the dbus and the dbus-broker units, then
> indeed we can
> >     remove the dbus user.
> >
> >
> > AFAIR the reason for the dbus to be a system user is that dbus-launch
> can setuid
> > into it.
> > So it only works without system user if dbus-launch is not used.
> Dbus-broker
> > delegates this functionality to system (dbus activation)
>
>   Well, the service file still calls dbus-broker-launch, which I guess
> does
> setuid because the upstream service file doesn't have any User= or Group=
>

I meant Dbus-launch, dbus-broker-launch *does not use setuid* which depends
on filesystem/inode permissions and uid.
If you prefix a ! In the service file dbus-broker-launch will be run as
root, and since this is the only way the executable is used (unlike dbus)
the dynamic user uid is enough.

Hence dbus-broker-launch works with random/dynamic uids, while dbus-launch
needs a stable one.


>   I think we'll just stick to what we have now, and keep the upstream
> service
> file rather than hacking our own...
>
>   Regards,
>   Arnout
>
> >
> >
> >        If I add this just to dbus-broker, but dbus still creates a
> static user, is
> >     this going to give a problem for systemd? I.e. does systemd support a
> >     DynamicUser=true if the user exists already statically? I think so...
> >
> >
> > Think so too.
> >
> >
> >        Regards,
> >        Arnout
> >
> >      > ExecStart=!/usr/bin/dbus-broker-launch --scope system --audit
> >      > ExecReload=!/usr/bin/busctl call org.freedesktop.DBus
> >      > /org/freedesktop/DBus org.freedesktop.DBus ReloadConfig
> >
> >     [snip]
> >
> >
> > Norbert
> >
>

[-- Attachment #1.2: Type: text/html, Size: 8708 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2022-07-27 19:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-09 22:16 [Buildroot] [PATCH v6 1/4] package/dbus-broker: new package Norbert Lange
2022-01-09 22:16 ` [Buildroot] [PATCH v6 2/4] package/systemd: do not force dbus if dbus-broker is available Norbert Lange
2022-01-09 22:16 ` [Buildroot] [PATCH v6 3/4] support/testsuite: de-duplicate the systemd runtime tests Norbert Lange
2022-07-27 15:04   ` Arnout Vandecappelle
2022-01-09 22:16 ` [Buildroot] [PATCH v6 4/4] support/run-test: add test for systemd using dbus-broker Norbert Lange
2022-07-27 10:56 ` [Buildroot] [PATCH v6 1/4] package/dbus-broker: new package Arnout Vandecappelle
2022-07-27 13:47   ` Norbert Lange
2022-07-27 17:05     ` Arnout Vandecappelle
2022-07-27 17:31       ` Norbert Lange
2022-07-27 19:09         ` Arnout Vandecappelle
2022-07-27 19:24           ` Norbert Lange [this message]

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=CADYdroM-JfgzWwB8D8a-w7qSyGFkuF1z3DJ7pG7w7gRDi300HQ@mail.gmail.com \
    --to=nolange79@gmail.com \
    --cc=arnout@mind.be \
    --cc=buildroot@buildroot.org \
    --cc=eric.le.bihan.dev@free.fr \
    --cc=yann.morin.1998@free.fr \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.