• should postrm script purge system-users?

    From Peymaneh@21:1/5 to All on Fri Dec 23 22:20:01 2022
    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------2cQHTLZxoOpamqDbLmQshLBG
    Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64

    RGVhciBtZW50b3JzIGxpc3QsDQoNCmEgcGFja2FnZSB0aGF0IEkgbWFpbnRhaW5bMV0gY3Jl YXRlcyBhIG5ldyBzeXN0ZW0tdXNlciBhbmQgLWdyb3VwIA0KKCJjYWRkeSIpIGFuZCBjcmVh dGVzIGEgaG9tZWRpcmVjdG9yeSBpbiAvdmFyL2xpYi9jYWRkeSB1cG9uIA0KaW5zdGFsbGF0 aW9uWzJdIGludGVuZGVkIGZvciB0aGUgc3lzdGVtZCBzZXJ2aWNlIGZpbGUuDQoNCldoZW4g cHVyZ2luZyB0aGUgcGFja2FnZSwgYWxsIG9mIHRoZXNlIGFyZSBjdXJyZW50bHkgbGVmdCBv biB0aGUgc3lzdGVtLg0KDQpJdCB3YXMgc3VnZ2VzdGVkIHRvIG1lIHRoYXQgdGhlIG5vdCBv bmx5IHRoZSBkaXJlY3RvcmllcywgYnV0IGFsc28gdXNlciANCmFuZCBncm91cCBzaG91bGQg YmUgcmVtb3ZlZC5bM10gYnV0IGkgYW0gdW5zdXJlIGlmIHB1cmdpbmcgZXZlbiB1c2VycyAN CmZyb20gdGhlIHN5c3RlbSBjb3VsZCBtYXliZSBhIGJhZCBpZGVhLCBiZWNhdXNlIHRoZXkg c3RpbGwgbWlnaHQgYmUgDQpvd25lcnMgb2Ygb3RoZXIgZmlsZXMgb24gdGhlIHN5c3RlbT8N Cg0KVGhlIGRlYmlhbiB3aWtpIGFuZCBwb2xpY3kgb25seSBjb3ZlcnMgcmVtb3ZhbCBvZiBm aWxlcy9kaXJzIGFuZCBkb2VzIA0Kbm90IHNlZW0gdG8gbWVudGlvbiB0aGUgaGFuZGxpbmcg b2Ygc3lzdGVtIHVzZXJzLi4NCg0KUGV5bWFuZWgNCg0KcHM6IHBsZWFzZSBrZWVwIG1lIGlu IENDLCBpIGFtIG5vdCBtZW1iZXIgb2YgdGhlIGxpc3QNCg0KLS0tDQpbMV0gaHR0cHM6Ly9z YWxzYS5kZWJpYW4ub3JnL2dvLXRlYW0vcGFja2FnZXMvY2FkZHkvDQpbMl0gDQpodHRwczov L3NhbHNhLmRlYmlhbi5vcmcvZ28tdGVhbS9wYWNrYWdlcy9jYWRkeS8tL2Jsb2IvZGViaWFu L3NpZC9kaXN0L3NjcmlwdHMvcG9zdGluc3RhbGwuc2gNClszXSBodHRwczovL2J1Z3MuZGVi aWFuLm9yZy9jZ2ktYmluL2J1Z3JlcG9ydC5jZ2k/YnVnPTEwMjIyNjANCg==

    --------------2cQHTLZxoOpamqDbLmQshLBG--

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

    wnsEABYIACMWIQSxU0gdtznMh6PWXc8GICPKPga91QUCY6YbOAUDAAAAAAAKCRAGICPKPga91T/n AP9JFsE9qRKAQ6rNRj4PT+j7rIky3fRFH8LK+S1BksxoHQEAwm2s/a1IfsyNuCv8HfaAIIjKqu+q bTxCwFV5lOES2A0=
    =Rcaf
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lorenzo@21:1/5 to Peymaneh on Sat Dec 24 04:50:01 2022
    Hello,

    [ I'm not a DD nor an expert, so you may want to wait for others opinion
    too ]

    On Fri, 23 Dec 2022 21:18:48 +0000
    Peymaneh <peymaneh@posteo.net> wrote:

    Dear mentors list,

    a package that I maintain[1] creates a new system-user and -group
    ("caddy") and creates a homedirectory in /var/lib/caddy upon
    installation[2] intended for the systemd service file.

    When purging the package, all of these are currently left on the
    system.

    It was suggested to me that the not only the directories, but also
    user and group should be removed.[3] but i am unsure if purging even
    users from the system could maybe a bad idea, because they still
    might be owners of other files on the system?

    I don't think there is a fixed rule to follow on this: the safest thing
    (for reason you mentioned above and others too) is to leave everything
    on the system and lock the user.
    On the other hand leaving files around and not freeing the UID has a
    cost, so if you know that the user doesn't leave files around or that it
    writes only to some predictable location it might worth to search and
    remove all files owned by the user and then remove the user on purge.
    Removing non empty home and files around requires some extra check, see
    links at the bottom


    The debian wiki and policy only covers removal of files/dirs and does
    not seem to mention the handling of system users..

    Peymaneh

    ps: please keep me in CC, i am not member of the list

    ---
    [1] https://salsa.debian.org/go-team/packages/caddy/
    [2] https://salsa.debian.org/go-team/packages/caddy/-/blob/debian/sid/dist/scripts/postinstall.sh

    user created with 'nologin', so only the caddy service should create
    files with that user?
    But I see that you also add the www-data supplementary group, so I
    guess it your service write/read also somewhere else under /var ?
    You should know this as maintainer or you can ask to upstream.

    [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1022260

    Lorenzo

    For reference, see also

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=981918 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%23848239 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=848240

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrey Rakhmatullin@21:1/5 to Peymaneh on Wed Dec 28 21:50:01 2022
    On Fri, Dec 23, 2022 at 09:18:48PM +0000, Peymaneh wrote:
    Dear mentors list,

    a package that I maintain[1] creates a new system-user and -group ("caddy") and creates a homedirectory in /var/lib/caddy upon installation[2] intended for the systemd service file.

    When purging the package, all of these are currently left on the system.

    It was suggested to me that the not only the directories, but also user and group should be removed.[3] but i am unsure if purging even users from the system could maybe a bad idea, because they still might be owners of other files on the system?

    The debian wiki and policy only covers removal of files/dirs and does not seem to mention the handling of system users..
    There is currently no policy on this but the project consensus is that
    once created users shouldn't be removed.
    See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=228692

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