cannot create directory outside of $HOME

Bug #490230 reported by David Hugh-Jones
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
evince (Ubuntu)
Fix Released
Medium
Jamie Strandboge
Lucid
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: evince

Evince cannot create a directory using the "create directory" button from the gnome file dialog. It reports an error "Cannot create directory: permission denied". This does not happen if I create the directory within /home/, but it happens if I create it in a mounted windows partition (to which I have write access). This seems to be an apparmor problem (cf. bug #489170): /var/log/messages reports

Nov 30 08:59:54 dave-laptop kernel: [ 1778.955484] type=1503 audit(1259567994.230:32): operation="mkdir" pid=2821 parent=1 profile="/usr/bin/evince" requested_mask="w::" denied_mask="w::" fsuid=1000 ouid=1000 name=2F77696E646F77732F446F63756D656E747320616E642053657474696E67732F446176652F4D7920446F63756D656E74732F746573742F

ProblemType: Bug
Architecture: i386
CheckboxSubmission: 448ddb0c4aba421c090cbccd4f031a21
CheckboxSystem: cfcd60a3bf8b6d8468a7e0a360390eb1
Date: Mon Nov 30 08:54:57 2009
DistroRelease: Ubuntu 9.10
ExecutablePath: /usr/bin/evince
Package: evince 2.28.1-0ubuntu1.2
ProcEnviron:
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-15.50-generic
SourcePackage: evince
Uname: Linux 2.6.31-15-generic i686
XsessionErrors:
 (gnome-settings-daemon:1829): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
 (gnome-settings-daemon:1829): GLib-CRITICAL **: g_propagate_error: assertion `src != NULL' failed
 (polkit-gnome-authentication-agent-1:1879): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed
 (nautilus:1863): Eel-CRITICAL **: eel_preferences_get_boolean: assertion `preferences_is_initialized ()' failed
 (gnome-panel:1862): Gdk-WARNING **: /build/buildd/gtk+2.0-2.18.3/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window

Revision history for this message
David Hugh-Jones (davidhughjones) wrote :
Changed in evince (Ubuntu):
assignee: nobody → Jamie Strandboge (jdstrand)
assignee: Jamie Strandboge (jdstrand) → nobody
importance: Undecided → Low
Changed in evince (Ubuntu):
status: New → Confirmed
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Thank you for using Ubuntu and taking the time to report a bug. This path is:
Decoded: /windows/Documents and Settings/Dave/My Documents/test/

AppArmor has denied access to this directory because it is not a standard location for files, therefore you must adjust your profile to allow access to the /windows folder. This can be done by adding the following to /etc/apparmor.d/usr.bin.evince:
  /windows/** rw,

Followed by:
$ sudo apparmor_parser -r -T -W /etc/apparmor.d/usr.bin.evince

Keep in mind that if there is a flaw in evince or (much more likely) one of the image/PDF libraries, opening a malicious file could allow an attacker to write to this directory. See http://en.opensuse.org/AppArmor_Geeks#Anatomy_of_a_Profile for more information on AppArmor profiling.

Changed in evince (Ubuntu):
status: Confirmed → Invalid
status: Invalid → Won't Fix
summary: - cannot create directory from file dialog
+ cannot create directory outside of $HOME
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I should clarify the position. /windows is a non-FHS directory that will not be supported by the shipped file (but can of course be adjusted by the user). FHS directories like /mnt and /media should be supported. I mistakenly thought this was already supported, but these are not. I adjust the profile accordingly.

Changed in evince (Ubuntu):
assignee: nobody → Jamie Strandboge (jdstrand)
importance: Low → Medium
status: Won't Fix → Triaged
Revision history for this message
David Hugh-Jones (davidhughjones) wrote : Re: [Bug 490230] Re: cannot create directory from file dialog

Jamie

All well and good, but

(1) this is going to affect everybody who has a Windows partition
mounted on anything but /home. That does not seem very user-friendly.

(2) AFAICS, in apparmor, every different application will have its own
settings. The old way: I could manage permissions in /etc/fstab. (If I
had to change them at all.) The new way: I have to manage permissions
using apparmor, application by application. So I have to learn an
obscure configuration file syntax. And if I get something wrong then I
open my system to vulnerabilities. This is far from "Linux for human
beings". It is also unlikely to ensure security. At the moment only I
can write to /windows: will your suggested workaround allow any user
of evince to do it? I don't know. But I'm tempted to apply the
workaround anyway, and ignore your thoughtful warning. Result: worse
security, because user behaviour has not been taken account of.

Cheers
David

Revision history for this message
David Hugh-Jones (davidhughjones) wrote : Re: [Bug 490230] Re: cannot create directory outside of $HOME

just read this after my previous comment. it's good that by default
/media and /mnt will have these permissions. But... where did my
/windows directory come from? didn't ubuntu put it there? at least,
other people seem to have a /windows partition and I don't remember
making that naming decision myself.

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

David,

"At the moment only I can write to /windows: will your suggested workaround allow any user of evince to do it?" -- Normal discretionary access controls are still in effect. By adding the rule I mentioned to your profile, users will have read and write access to /windows if normal unix permissions allow it.

As for why /windows is there at all, I don't know. I do see in https://help.ubuntu.com/community/Fstab that the recommended place to mount your windows partition is /media/windows. If an Ubuntu application is creating and using directories outside of the Filesystem Hierarchy Standard (FHS), then that is a separate bug in that application. The evince AppArmor profile should support mountable media via FHS, and I will fix that.

Changed in evince (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted evince into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in evince (Ubuntu Lucid):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
David Hugh-Jones (davidhughjones) wrote :

After a clean install of Lucid, my windows directory is definitely mounted as /windows, and I made no choice about that... I will file a bug in the appropriate place.

Revision history for this message
Colin Watson (cjwatson) wrote :

David, are you able to test the update in lucid-proposed to check whether it fixes the crash you reported? The proposed update fixes five Ubuntu bugs, and this is the only one left unvalidated. Thanks in advance.

Revision history for this message
David Hugh-Jones (davidhughjones) wrote : Re: [Bug 490230] Re: cannot create directory outside of $HOME

Hi Colin

I still get the same problem, but this is because my Windows drive is
mounted in a non-standard location, no?

David

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package evince - 2.30.1-0ubuntu3

---------------
evince (2.30.1-0ubuntu3) lucid-proposed; urgency=low

  [ Jamie Strandboge ]
  * debian/apparmor-profile.abstraction: allow writes to removable media
    (LP: #490230)

  [ Didier Roche ]
  * debian/patches/03_fix_opening_hash_filename.patch:
    Fix opening files with '#' in its name (LP: #578996)

evince (2.30.1-0ubuntu2) UNRELEASED; urgency=low

  * add debian/patches/02_fix_dot_dir_creation.patch:
    fix dot dir creation when launching evince directly (LP: #571725)

evince (2.30.1-0ubuntu1) UNRELEASED; urgency=low

  * New upstream release:
    Bug fixes:
    - Make inverted colors mode work in presentation mode too
      (#614693, Carlos Garcia Campos)
    - Respect GNOME22_USER_DIR env variable (#613637, Ray Strode)
    - Fix loading of local documents when uri contains a page
      destination (#616515, Carlos Garcia Campos)
    - Take default settings from last document opened. Fixes
      regression caused by migration to gio metadata (#606090, Carlos
      Garcia Campos) (LP: #544639, #503372)
    - Update icons to match gnome-icon-theme appearance (#614747,
      Hylke Bons, Carlos Garcia Campos)
    - Make sure there's a new valid page range before updating caches
      (fdo#27599, Carlos Garcia Campos)
    - Update FSF address everywhere (#514607, Arun Persaud)
    - Fix loading of compressed password-protected documents (#613959,
      Carlos Garcia Campos)
    - Close previewer window with control + w (#612972, Carlos Garcia
      Campos)
    - Fix keybindings in previewer window (#612972, Carlos Garcia
      Campos)
    Translation updates
 -- Didier Roche <email address hidden> Thu, 13 May 2010 16:31:06 +0200

Changed in evince (Ubuntu Lucid):
status: Fix Committed → Fix Released
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

I'm marking as 'verification-done' since the fix landed in lucid.

tags: added: verification-done
removed: verification-needed
Changed in evince (Ubuntu):
status: Fix Committed → 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.