Services can only run as root

Bug #1617314 reported by Stuart Bishop
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Snapcraft
Invalid
Undecided
Unassigned
Snappy
Triaged
High
Jamie Strandboge

Bug Description

PostgreSQL refuses to run as root and upstream very deliberately made it so this behaviour cannot be turned off. Even if I had a way of creating a user when the snap is installed, trying to drop privs with setuid/setgid fails.

My only current work around is to patch the source, removing the checks myself. Even if I could convince the extremely conservative upstream to rethink their choice and allow the checks to be disabled at configure or runtime it would not be available until the next major release.

I'd like for daemons to be able to drop their privileges. Lots of daemons try to drop privileges (usually to restricted accounts like nobody or daemon), so this should be possible without patching.

I'd like it possible to create users and groups as a snap preinstallation step. And I'd like to be able to declare these users and groups in snapcraft.yaml.

Stuart Bishop (stub)
summary: - Cannot run daemons as non-root
+ Services can only run as root
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I feel like there is already a bug on this but I can't seem to find it.

snap-confine now has the ability to filter arguments. This allows us to create policy for setuid, etc. Initially we will allow dropping to a non-root user that is already on the system (eg, 'daemon') which would fix this bug for you.

Eventually I think it would be nice to have snapcraft.yaml support for requesting a particular user. This needs to be designed, but I suspect allowing, opt-in, a user name that is the SNAP_NAME would be a stop along the path.

tags: added: snapd-interface
Changed in snapcraft:
status: New → Invalid
Changed in snappy:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I plan to implement the policy changes for using an already existing user in the coming weeks and that will appear as part of a future snapd release sometime after GA.

Changed in snappy:
assignee: nobody → Jamie Strandboge (jdstrand)
Revision history for this message
Lars Tangvald (lars-tangvald) wrote :

Just to note, this affects MySQL in the same way. The daemon will not run as root, so currently we can't store data in SNAP_DATA/SNAP_COMMON

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.