canonical / pebble

Take control of your internal daemons!
GNU General Public License v3.0
137 stars 52 forks source link

feat(daemon): support additional admin UIDs via PEBBLE_ADMINS #345

Closed hpidcock closed 5 months ago

hpidcock commented 6 months ago

This PR proposes a means for the Pebble daemon to authenticate additional local unix users as admins through a new environment variable, $PEBBLE_ADMINS. This environment variable is a comma , delimited unordered list of UIDs that represent admins in addition to the defaults (e.g. root and the user running the daemon).

The use case for this is in Juju, where we have a charm container (the pebble client) and the workload container (the pebble daemon), both running as different non-root users. The charm container needs to be able to connect to and control the pebble process in the neighbouring container.

It is expected that the following should not work:

$ sudo pebble run &
$ pebble exec echo hello
error: access denied (try with sudo)

But with this PR, this is expected that the following should work:

$ sudo PEBBLE_ADMINS=1000 pebble run &
$ pebble exec echo hello
hello

JU091