• Re: systemd-sysusers [Re: Seeking consensus for some changes in adduser

    From Luca Boccassi@21:1/5 to Michael Biebl on Thu Mar 10 22:50:01 2022
    On Thu, 10 Mar 2022 at 20:24, Michael Biebl <biebl@debian.org> wrote:

    Hi Marc,

    have you considered a more declarative approach as provided by systemd-sysusers (8)?

    I'm a fan of less manual maintainer scripts code and maybe
    systemd-sysusers is an answer to that, especially given that we split
    out the systemd-sysusers binary into a standalone binary which should
    help facilitate that.

    Regards,
    Michael

    +1 for declarative approach

    Kind regards,
    Luca Boccassi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Haber@21:1/5 to All on Fri Mar 11 10:50:01 2022
    On Thu, 10 Mar 2022 20:59:50 +0100, Michael Biebl <biebl@debian.org>
    wrote:
    have you considered a more declarative approach as provided by >systemd-sysusers (8)?

    No. This thread is about evolving adduser. Not getting rid of it.

    514 packages in Debian match "adduser.*--system".

    Feel free to offer a declarative thing and encourage maintainers to
    migrate. adduser is going to continue to offer a stable interface for
    existing packages for the time being. It has been adduser's goal for
    20 years now to be as declarative as possible in a maintainer script
    by doing everything necessary, just requiring the package to have one
    line in the right place in the script.

    Greetings
    Marc

    P.S.: I got involved with adduser 20 years ago because the then
    debhelper maintainer brushed off my suggestion to have a dh call for
    creating system users. Back then, this approach was as declarative as
    it could get.
    --
    -------------------------------------- !! No courtesy copies, please !! ----- Marc Haber | " Questions are the | Mailadresse im Header Mannheim, Germany | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon Richter@21:1/5 to Michael Biebl on Fri Mar 11 12:30:01 2022
    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --IevWIXd30ujzZ9HaGOo9cYWRVFBvLtrNm
    Content-Type: text/plain; charset=utf-8; format=flowed
    Content-Language: en-US
    Content-Transfer-Encoding: quoted-printable

    Hi,

    On 3/10/22 8:59 PM, Michael Biebl wrote:

    have you considered a more declarative approach as provided by systemd-sysusers (8)?

    We currently don't have a good mechanism for leaving configuration
    behind on purge, which we've historically done with user accounts to
    avoid reuse of UIDs that may own resources, so we'd still have to create
    the declarations from a postinst.

    Simon


    --IevWIXd30ujzZ9HaGOo9cYWRVFBvLtrNm--

    -----BEGIN PGP SIGNATURE-----

    iQEzBAEBCgAdFiEEtjuqOJSXmNjSiX3Tfr04e7CZCBEFAmIrLasACgkQfr04e7CZ CBGDaQgAsERvKO/NfJXYXtUWuCbtnjvvSeR+UhDkLhyVWU2ZfrND1uh0qzn5jRAR 6uP/7eE/BHn+sc62qmn35ncIaSVJXbBq673MHsAy90shWJ+0WGjGDI9gnLxfVbgn yQgycAHcdZ43RGz4ir6M8/2PYFKoGi1FNPvWBUH6Y+ZOwpWOt6EokxkMOSaWTjWE j6KmDOS4d5UOaXryVTf3QJdOtW3tqcIjL7qvX4Qw3ScX40EFzq6D3TKQxftLavi/ cvmJ9fraJm1klihYVtDJvAr9agTDf5nCSfjB71MTo/BJizoXEQ/X7lOXlqZmqvf0 lsWRdlSAuYU2y74nDqZaLoSllL14Vg==
    =Gsj5
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Simon McVittie@21:1/5 to Simon Richter on Fri Mar 11 16:00:01 2022
    On Fri, 11 Mar 2022 at 12:08:27 +0100, Simon Richter wrote:
    On 3/10/22 8:59 PM, Michael Biebl wrote:
    have you considered a more declarative approach as provided by systemd-sysusers (8)?

    We currently don't have a good mechanism for leaving configuration behind on purge, which we've historically done with user accounts to avoid reuse of UIDs that may own resources, so we'd still have to create the declarations from a postinst.

    Why would that be desirable? systemd-sysusers isn't a NSS plugin that
    magics users into existence without them existing (unlike libnss-systemd,
    which is part of the implementation of DynamicUser). Instead,
    systemd-sysusers reads its declarative source files and uses them
    to populate the state of the system user database (in practice that
    usually means /etc/passwd). If the user already exists in the system user database, then it won't go away just because the source file was removed.

    Using flatpak as my example of a "modern" package that creates a system
    user (which is named _flatpak as per Policy §9.2.1), what we currently
    do is:

    install flatpak
    postinst invokes adduser
    adduser adds _flatpak to /etc/passwd

    remove flatpak
    nothing special happens
    _flatpak continues to exist in /etc/passwd
    (some packages use usermod -L here, but I'm not clear on what
    benefit that provides, so flatpak currently doesn't)

    purge flatpak
    nothing special happens
    _flatpak continues to exist in /etc/passwd

    and the equivalent if we were relying on sysusers would be this:

    install flatpak
    /usr/lib/sysusers.d/flatpak.conf is created
    postinst or trigger invokes systemd-sysusers
    systemd-sysusers adds _flatpak to /etc/passwd

    remove flatpak
    /usr/lib/sysusers.d/flatpak.conf is removed
    _flatpak continues to exist in /etc/passwd

    purge flatpak
    nothing special happens
    _flatpak continues to exist in /etc/passwd

    In fact flatpak already installs /usr/lib/sysusers.d/flatpak.conf - partly because its upstream developer wants to support distros that already
    rely on sysusers to manage system uids, partly as a small step towards stateless systems being able to boot with an empty /etc, and partly as
    a way to document in a declarative way that flatpak "owns" the _flatpak account. It doesn't currently make use of that file in the postinst,
    because Policy recommends using adduser (imperatively), but it could if
    we wanted to.

    On a system where flatpak has ever been installed (even if it was
    subsequently removed), the only situation in which the _flatpak user would cease to exist would be if it was explicitly removed from /etc/passwd,
    perhaps as part of a "factory reset" procedure. If that happens,
    I think the correct behaviour would be to recreate it (if flatpak is
    still installed and still needs it) or leave it absent (otherwise) -
    which is what systemd-sysusers would "naturally" do on the next reboot,
    if left to do its job.

    smcv

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marco d'Itri@21:1/5 to Simon Richter on Fri Mar 11 16:10:02 2022
    On Mar 11, Simon Richter <sjr@debian.org> wrote:

    We currently don't have a good mechanism for leaving configuration behind on purge, which we've historically done with user accounts to avoid reuse of UIDs that may own resources, so we'd still have to create the declarations from a postinst.
    While this is a reasonable concern I do not think that it is generally
    true nowadays for system processes.
    Also thanks to piuparts, nowadays packages that leave files around after
    being purged should be a really small number. Actually I cannot think of
    any, so this should be considered the exception rather than the norm.

    So I totally support transitioning to systemd-sysusers.

    --
    ciao,
    Marco

    -----BEGIN PGP SIGNATURE-----

    iHUEABYIAB0WIQQnKUXNg20437dCfobLPsM64d7XgQUCYitiOAAKCRDLPsM64d7X gQ3ZAQDm+V+kJOD+SmnUObt03FblOcSNV6HDNS7C+Z8a2Rn6NwD/Uu0CEgfb0nyE UqQRNpRlBKx4gwTHllGwhtsnxVvQfQs=
    =+qo5
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Biebl@21:1/5 to All on Fri Mar 11 18:20:01 2022
    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------Za3PuO0KkQC4wwB5hNEqOj52
    Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64

    DQpBbSAxMS4wMy4yMiB1bSAxNTozNyBzY2hyaWViIFNpbW9uIE1jVml0dGllOg0KPiBhbmQg dGhlIGVxdWl2YWxlbnQgaWYgd2Ugd2VyZSByZWx5aW5nIG9uIHN5c3VzZXJzIHdvdWxkIGJl IHRoaXM6DQo+IA0KPiAgICAgIGluc3RhbGwgZmxhdHBhaw0KPiAgICAgICAgICAvdXNyL2xp Yi9zeXN1c2Vycy5kL2ZsYXRwYWsuY29uZiBpcyBjcmVhdGVkDQo+ICAgICAgICAgIHBvc3Rp bnN0IG9yIHRyaWdnZXIgaW52b2tlcyBzeXN0ZW1kLXN5c3VzZXJzDQoNCkFuIGltcG9ydGFu dCBkaXN0aW5jdGlvbiBpcyB0aGF0IHRoaXMgcG9zdGluc3QgY2FuIGJlIGdlbmVyYXRlZCBl YXNpbHkgDQppbnN0ZWFkIG9mIGhhdmluZyB0byBiZSB3cml0dGVuIG1hbnVhbGx5Lg0KDQpB Y3R1YWxseSwgd2UgZG8gdGhhdCBhbHJlYWR5IHZpYSB0aGUgZGhfc3lzdGVtZHN5c3VzZXJz IGRoIGFkZG9uLg0KDQpSZWdhcmRzLA0KTWljaGFlbA0K

    --------------Za3PuO0KkQC4wwB5hNEqOj52--

    -----BEGIN PGP SIGNATURE-----

    wsF5BAABCAAjFiEECbOsLssWnJBDRcxUauHfDWCPItwFAmIrgJkFAwAAAAAACgkQauHfDWCPItxH Hg//SlgkU4md481EKnb1doTJ/1L4z0d2WLrTa1k2mLD0tC5YE2/FXIbrD2LymbBE+RCEsBS2xN6+ /i8arkx6sAJi61Ncm5OV9s1uxhlubTBhVF7P8CXbPFF+HjtJS0vB3rqtw1kHLTCNgKGuN8dldxfZ E2RL3hIZMaSUkNOO8fd3Rfj6531ZHbVSWDTMjSxpSz4DRo4oonB9xdQh77lW0Y9VB6ByzsjCYreY 0j+nVXiYsJx1ByjxW4eWhaTBcy2x/BULscbxKtfSkgZ50BCZwwnffHpUB1lnGsQ2qG/UoAa2kmRb AEyG9eBUKP5HWdN1ugIdZmqLmpNMKUsG5EnBZO0JpbcxMV9+ewWMy7CpwLVTIk4ShzxmIijmr2M4 DThj5VB7zf++oQDEJIlSWKJYavpFjmgD6YS49cZ9qa4x14amAojluSJEf747o4Ot6JqTD+603jA7 ZsAWmvb/FH06NvWRtqJNmGCS4vyDoA3h18ZcRSfWGLvA+Pgmo2Bat5VidZHtx9B29YLNTMVYVeKQ HTZJhH6wpodaSctcsyqy4HtjpShG0VAwLjL9zOSdkkYfipIBL1q/zrFkuX1nvlAi1D8+w2qewCPX KJO2jk6rC/cQwEUCfYpsmjUWv4aH/Bb+t4pU6cWZHbXOeGV2bZ9n1CACQVDt8eQ89WDNrmqs7ChA OiA=
    =j6tb
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)