Sudoers snapd.conf will be ignored

Bug #1882215 reported by Frank Quinn
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
snapd
Fix Released
Medium
Maciej Borzecki

Bug Description

There is a sudoers configuration file in an ubuntu 20.04 install of snapd:

root@locutus:/etc/sudoers.d# dpkg -S /etc/sudoers.d/99-snapd.conf
snapd: /etc/sudoers.d/99-snapd.conf

Which contains:

# Allow snap-provided applications to work with sudo

Defaults secure_path += /snap/bin

However I don't believe this file gets parsed. I tried to create my own similar file 01-xxxx.conf alongside it for entirely unrelated reasons assuming the file name was consistent and it didn't work. On closer inspection it looks like sudo ignores any included files containing a period.

https://stackoverflow.com/questions/21640770/file-in-etc-sudoers-d-file-not-being-read-by-sudo/21640893

I don't really use snap in my environment so don't know if there's any impact to the above, but thought I'd be a good citizen and report.

Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

And on top of that, secure_path cannot be overwritten or appended to. We stopped shipping the file on Fedora and Arch. It should be dropped from the deb too.

Changed in snapd:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Maciej Borzecki (maciek-borzecki)
Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

I've proposed a PR removing the file from snapd https://github.com/snapcore/snapd/pull/8885

Changed in snapd:
status: Confirmed → In Progress
Changed in snapd:
status: In Progress → Fix Committed
Zygmunt Krynicki (zyga)
Changed in snapd:
milestone: none → 2.46
Zygmunt Krynicki (zyga)
Changed in snapd:
status: Fix Committed → Fix Released
Revision history for this message
Dimitri Papadopoulos (dimitri-papadopoulos) wrote :

Yet I can still find the file in Ubuntu 20.04, although the current version of snapd is 2.49:

$ dpkg -S /etc/sudoers.d/99-snapd.conf
snapd: /etc/sudoers.d/99-snapd.conf
$
$ dpkg -l snapd
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-============================================
ii snapd 2.49.2+20.04 amd64 Daemon and tooling that enable snap packages
$

Revision history for this message
Ian Johnson (anonymouse67) wrote :

@Dimitri, is that a fresh installation of 20.04 or has it been around for a while? I don't think we remove the file on systems that got it before, but it shouldn't be installed on fresh, new images like 20.04.2 for example

Revision history for this message
Dimitri Papadopoulos (dimitri-papadopoulos) wrote :

Ah, it might be a left-over from a previous release. Yet, I seem to recall this machine runs a clean Ubuntu 20.04 installation.

$ sudo rm /etc/sudoers.d/99-snapd.conf
$
$ sudo apt reinstall snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 10 not upgraded.
[...]
$
$ ls /etc/sudoers.d/99-snapd.conf
ls: cannot access '/etc/sudoers.d/99-snapd.conf': No such file or directory
$

Revision history for this message
Dimitri Papadopoulos (dimitri-papadopoulos) wrote :

I don't have much experience with DEB packaging, but perhaps /etc/sudoers.d/99-snapd.conf is not properly removed when updating the snapd package.

Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :

AFAIU existing conf files get special treatment even if the new version of the package does not ship them. The filas are still considered as owned by the package and do not get automatically removed.

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.