Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: AppArmor and Firefox

  1. #11
    Join Date
    Mar 2012
    Beans
    142

    Re: AppArmor and Firefox

    Hi thnewguy. First off, thank You for the attempt to improve Firefox profile. I have a request to You. Could you write/paste here or write to me a personal message with Your current, improved Firefox profile? I mean the amendments relating to access to the user directory by Firefox etc. I would be grateful!

    Oh, and one more thing. I'm thinking of creating a profile for Pidgin. As an example I would like to use profile for 12.04 Release: usr.bin.pidgin, with last revision on 2011-10-1. There is also version for 12.10 Release created on 2012-05-01. My question: Both profiles contain, for example, something like this: /usr/bin/gnome-network-preferences ix (line # 57). But I see that in Xubuntu 12.04 there is no such file in /usr/bin/ directory. What should I do? Remove this line or just comment out? Really, I do not know.

    Thanks.

  2. #12
    Join Date
    Jun 2011
    Beans
    357

    Re: AppArmor and Firefox

    I'm really just learning how to trouble shooting AppArmor, so I'm afraid I'm not in a position to help much, though perhaps someone else here can. As for my Firefox profile, this is what I have thus far in /etc/apparmor.d/usr.bin.firefox

    Code:
    # vim:syntax=apparmor
    # Author: Jamie Strandboge <jamie@canonical.com>
    
    # Declare an apparmor variable to help with overrides
    @{MOZ_LIBDIR}=/usr/lib/firefox
    
    #include <tunables/global>
    
    # We want to confine the binaries that match:
    #  /usr/lib/firefox/firefox
    #  /usr/lib/firefox/firefox
    # but not:
    #  /usr/lib/firefox/firefox.sh
    /usr/lib/firefox/firefox{,*[^s][^h]} {
      #include <abstractions/audio>
      #include <abstractions/cups-client>
      #include <abstractions/dbus-session>
      #include <abstractions/gnome>
      #include <abstractions/nameservice>
      #include <abstractions/p11-kit>
    
      # Addons
      #include <abstractions/ubuntu-browsers.d/firefox>
    
      # for networking
      network inet stream,
      network inet6 stream,
      @{PROC}/[0-9]*/net/if_inet6 r,
      @{PROC}/[0-9]*/net/ipv6_route r,
      @{PROC}/[0-9]*/net/dev r,
      @{PROC}/[0-9]*/net/wireless r,
    
      # should maybe be in abstractions
      /etc/ r,
      /etc/mime.types r,
      /etc/mailcap r,
      /etc/xdg/*buntu/applications/defaults.list    r, # for all derivatives
      /usr/share/xubuntu/applications/defaults.list r,
      owner @{HOME}/.local/share/applications/defaults.list r,
      owner @{HOME}/.local/share/applications/mimeapps.list r,
      owner @{HOME}/.local/share/applications/mimeinfo.cache r,
      owner /tmp/** m,
      owner /var/tmp/** m,
      /tmp/.X[0-9]*-lock r,
    
      /etc/timezone r,
      /etc/wildmidi/wildmidi.cfg r,
    
      # firefox specific
      /etc/firefox*/ r,
      /etc/firefox*/** r,
      /etc/xul-ext/** r,
      /etc/xulrunner-2.0*/ r,
      /etc/xulrunner-2.0*/** r,
      /etc/gre.d/ r,
      /etc/gre.d/* r,
    
      # noisy
      deny @{MOZ_LIBDIR}/** w,
      deny /usr/lib/firefox-addons/** w,
      deny /usr/lib/xulrunner-addons/** w,
      deny /usr/lib/xulrunner-*/components/*.tmp w,
      deny /.suspended r,
      deny /boot/initrd.img* r,
      deny /boot/vmlinuz* r,
      deny /var/cache/fontconfig/ w,
      deny @{HOME}/.local/share/recently-used.xbel r,
    
      # TODO: investigate
      deny /usr/bin/gconftool-2 x,
    
      # These are needed when a new user starts firefox and firefox.sh is used
      @{MOZ_LIBDIR}/** ixr,
      /usr/bin/basename ixr,
      /usr/bin/dirname ixr,
      /usr/bin/pwd ixr,
      /sbin/killall5 ixr,
      /bin/which ixr,
      /usr/bin/tr ixr,
      @{PROC}/ r,
      @{PROC}/[0-9]*/cmdline r,
      @{PROC}/[0-9]*/mountinfo r,
      @{PROC}/[0-9]*/stat r,
      owner @{PROC}/[0-9]*/task/[0-9]*/stat r,
      @{PROC}/[0-9]*/status r,
      @{PROC}/filesystems r,
      owner @{HOME}/.thumbnails/*/*.png r,
    
      /etc/mtab r,
      /etc/fstab r,
    
      # Needed for the crash reporter
      owner @{PROC}/[0-9]*/environ r,
      owner @{PROC}/[0-9]*/auxv r,
      /etc/lsb-release r,
      /usr/bin/expr ix,
      /sys/devices/system/cpu/ r,
      /sys/devices/system/cpu/** r,
    
      # about:memory
      owner @{PROC}/[0-9]*/statm r,
      owner @{PROC}/[0-9]*/smaps r,
    
      # Needed for container to work in xul builds
      /usr/lib/xulrunner-*/plugin-container ixr,
    
      # allow access to documentation and other files the user may want to look
      # at in /usr and /opt
      /usr/ r,
      /usr/** r,
      /opt/ r,
      /opt/** r,
    
      # so browsing directories works
      / r,
      /**/ r,
    
      # Default profile allows downloads to ~/Downloads and uploads from ~/Public
      owner @{HOME}/ r,
      owner @{HOME}/Public/ r,
      owner @{HOME}/Public/* r,
      owner @{HOME}/Downloads/ r,
      owner @{HOME}/Downloads/* rw,
    
      # per-user firefox configuration
      owner @{HOME}/.{firefox,mozilla}/ rw,
      owner @{HOME}/.{firefox,mozilla}/** rw,
      owner @{HOME}/.{firefox,mozilla}/**/*.{db,parentlock,sqlite}* k,
      owner @{HOME}/.{firefox,mozilla}/plugins/** rm,
      owner @{HOME}/.{firefox,mozilla}/**/plugins/** rm,
      owner @{HOME}/.config/ibus/bus/ w,
      owner @{HOME}/.gnome2/firefox*-bin-* rw,
    
      #
      # Extensions
      # /usr/share/.../extensions/... is already covered by '/usr/** r', above.
      # Allow 'x' for downloaded extensions, but inherit policy for safety
      owner @{HOME}/.mozilla/**/extensions/** mixr,
    
      deny @{MOZ_LIBDIR}/update.test w,
      deny /usr/lib/mozilla/extensions/**/ w,
      deny /usr/lib/xulrunner-addons/extensions/**/ w,
      deny /usr/share/mozilla/extensions/**/ w,
      deny /usr/share/mozilla/ w,
    
      deny @{HOME}/ w,
    
      # Miscellaneous (to be abstracted)
      # Ideally these would use a child profile. They are all ELF executables
      # so running with 'Ux', while not ideal, is ok because we will at least
      # benefit from glibc's secure execute.
      /usr/bin/mkfifo Uxr,  # investigate
      /bin/ps Uxr,
      /bin/uname Uxr,
    
      # Site-specific additions and overrides. See local/README for details.
      #include <local/usr.bin.firefox>
    }

    The above profile allows Firefox to read from my home folder (still trying to lock that down), but prevents writing to most places except for Firefox's configuration folders and the Downloads folder. I tried to lock it down further, but apparently there is a PID file somewhere and if Firefox can't create this file then it refuses to run. So this isn't a perfect solution, but it is a little more secure than running without AppArmor.

  3. #13
    Join Date
    Mar 2012
    Beans
    142

    Re: AppArmor and Firefox

    Hi, thank You thnewgu. Now it will be much easier for my to improve Firefox profile. And what about Pidgin and /usr/bin/gnome-network-preferences ix? Do You know something about this?

  4. #14
    Join Date
    Jun 2011
    Beans
    357

    Re: AppArmor and Firefox

    I haven't done any work on profiles other than web browsers,sorry.

  5. #15
    Join Date
    Jan 2008
    Location
    USA
    Beans
    971
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: AppArmor and Firefox

    Quote Originally Posted by thnewguy View Post
    Thank you, rookcifer. I changed the line in the abstractions file and that helped me focus on the Firefox profile itself. There are still some problems.

    For example, the Firefox profile by itself still allows me to write a file anywhere in my home folder, not just in my Downloads folder. A little playing around with the profile and I discovered a few things.
    It shouldn't. I have my profile setup as I described and it does not allow writing to anywhere but /Downloads.
    Occam's Razor for computers: Viruses must never be postulated without necessity -- nevius

    My Blog

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •