[snap] Permission denied on Private encrypted folder

Bug #1848919 reported by Alex N.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
AppArmor
Fix Released
Low
Jamie Strandboge
snapd
Fix Released
Low
Jamie Strandboge
apparmor (Ubuntu)
Fix Released
Medium
Jamie Strandboge
chromium-browser (Ubuntu)
Invalid
Low
Unassigned
snapd (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

When accessing the Private (/home/username/Private, Encrypted Directory) folder (e.g. via "Link save as...") it shows "Could not read contents of Private, Error opening directory ...: Permission denied"

Package: chromium-browser
Version: 77.0.3865.120-0ubuntu1~snap1

Alex N. (a-nox)
description: updated
Revision history for this message
Olivier Tilloy (osomon) wrote :

I can reliably reproduce the issue after creating an encrypted Private directory with ecryptfs-setup-private (see https://help.ubuntu.com/community/EncryptedPrivateDirectory#Setup_Your_Encrypted_Private_Directory).

The problem stems from the fact that the home interface doesn't allow reading/writing to hidden folders in $HOME, and the ~/Private folder is actually backed by encrypted data in ~/.Private.

This is not specific to chromium, other strictly confined snaps using the home interface would be similarly affected.

Interestingly, saving a file to the folder still works, despite the error and the fact that the file dialog is unable to show the contents of the folder.

Changed in chromium-browser (Ubuntu):
status: New → Confirmed
summary: - [snap] Permission denied on Private folder
+ [snap] Permission denied on Private encrypted folder
Changed in chromium-browser (Ubuntu):
importance: Undecided → Low
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Encrypted home is typically setup as ~/.Private, not ~/Private and the policy already allows:

  owner @{HOME}/.Private/** mrixwlk,
  owner @{HOMEDIRS}/.ecryptfs/*/.Private/** mrixwlk,

The home interface should already allow ~/Private. What is the denial you see in the logs?

Revision history for this message
Olivier Tilloy (osomon) wrote :

Indeed I can see the rules you mention in /etc/apparmor.d/abstractions/base, which is included by /var/lib/snapd/apparmor/profiles/snap.chromium.chromium.

However I can reliably reproduce the issue, and I'm seeing the following denial:

  AVC apparmor="DENIED" operation="open" profile="snap.chromium.chromium" name="/home/ubuntu/.Private/" pid=11167 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Ok, that is a read on /home/ubuntu/.Private/. Is the encrypted home mounted at the time of the denial?

Revision history for this message
Olivier Tilloy (osomon) wrote :

Yes, it is mounted:

ubuntu@bionicvm:~$ mount | grep Private
/home/ubuntu/.Private on /home/ubuntu/Private type ecryptfs (rw,nosuid,nodev,relatime,ecryptfs_fnek_sig=11d8701311f9dc77,ecryptfs_sig=4ca5cd476d88b7cd,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs)

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Ok, I'll fix this in the next batch of policy updates for snapd.

Changed in snapd (Ubuntu):
assignee: nobody → Jamie Strandboge (jdstrand)
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Olivier Tilloy (osomon) wrote :

Thanks Jamie.
I'll mark the bug invalid for chromium. Even though chromium is visibly affected, the root cause has been identified and is going to be fixed soon.

Changed in chromium-browser (Ubuntu):
status: Confirmed → Invalid
Changed in snapd (Ubuntu):
status: Triaged → In Progress
Changed in apparmor:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → Jamie Strandboge (jdstrand)
Revision history for this message
Jamie Strandboge (jdstrand) wrote :
Changed in snapd (Ubuntu):
assignee: Jamie Strandboge (jdstrand) → nobody
Changed in snapd:
importance: Undecided → Low
assignee: nobody → Jamie Strandboge (jdstrand)
milestone: none → 2.42.3
Changed in snapd (Ubuntu):
status: In Progress → Triaged
Changed in snapd:
status: New → In Progress
Changed in apparmor:
status: Triaged → In Progress
Changed in apparmor:
status: In Progress → Fix Released
Changed in apparmor (Ubuntu):
assignee: nobody → Jamie Strandboge (jdstrand)
importance: Undecided → Medium
status: New → In Progress
Changed in snapd:
status: In Progress → Fix Released
Changed in snapd (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apparmor - 2.13.3-7ubuntu4

---------------
apparmor (2.13.3-7ubuntu4) focal; urgency=medium

  * debian/apparmor.service: add /var/lib/snapd/apparmor/profiles to
    RequiresMountsFor since Ubuntu's rc.apparmor.functions looks for it
    (LP: #1871148)
  * libnss-systemd.patch: allow accessing the libnss-systemd VarLink sockets
    and DBus APIs. Patch partially based on work by Simon Deziel.
    (LP: #1796911, LP: #1869024)
  * upstream-mr-424-kerberos-dot-dirs.patch: abstractions/kerberosclient:
    allow reading /etc/krb5.conf.d/
  * upstream-mr-442-gnome-user-themes.patch: gnome abstraction: allow reading
    per-user themes from $XDG_DATA_HOME (Closes: #930031)
  * upstream-mr-443-ecryptfs-dirs.patch: abstractions/base: allow read access
    to top-level ecryptfs directories (LP: #1848919)
  * upstream-mr-445-uuidd-request.patch: abstractions/base: allow read access
    to /run/uuidd/request
  * upstream-mr-464-Mesa_i915_perf_interface.patch: let Mesa check if the
    kernel supports the i915 perf interface. Patch from Debian

 -- Jamie Strandboge <email address hidden> Mon, 06 Apr 2020 17:47:20 +0000

Changed in apparmor (Ubuntu):
status: In Progress → Fix Released
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.