mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-19 09:28:17 +01:00
156 lines
4.8 KiB
Text
156 lines
4.8 KiB
Text
# vim:syntax=apparmor
|
|
# ------------------------------------------------------------------
|
|
#
|
|
# Copyright (C) 2015-2020 Mikhail Morfikov
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
# License published by the Free Software Foundation.
|
|
#
|
|
# ------------------------------------------------------------------
|
|
|
|
abi <abi/3.0>,
|
|
|
|
include <tunables/global>
|
|
|
|
@{DROPBOX_DEMON_DIR}=@{HOME}/.dropbox-dist/
|
|
@{DROPBOX_HOME_DIR}=@{HOME}/.dropbox/
|
|
@{DROPBOX_SHARE_DIR}=@{HOME}/Dropbox*/
|
|
|
|
@{exec_path} = /{usr/,}bin/dropbox
|
|
profile dropbox @{exec_path} {
|
|
include <abstractions/base>
|
|
include <abstractions/X>
|
|
include <abstractions/gtk>
|
|
include <abstractions/fonts>
|
|
include <abstractions/fontconfig-cache-read>
|
|
include <abstractions/freedesktop.org>
|
|
include <abstractions/python>
|
|
include <abstractions/nameservice-strict>
|
|
include <abstractions/qt5-settings-write>
|
|
include <abstractions/openssl>
|
|
include <abstractions/ssl_certs>
|
|
include <abstractions/deny-root-dir-access>
|
|
|
|
ptrace peer=@{profile_name},
|
|
|
|
@{exec_path} r,
|
|
|
|
/{usr/,}bin/ r,
|
|
/{usr/,}bin/python3.[0-9]* r,
|
|
|
|
# Dropbox home files
|
|
owner @{HOME}/ r,
|
|
owner @{DROPBOX_HOME_DIR}/ rw,
|
|
owner @{DROPBOX_HOME_DIR}/** rwk,
|
|
|
|
# Shared files
|
|
owner @{DROPBOX_SHARE_DIR}/ rw,
|
|
owner @{DROPBOX_SHARE_DIR}/{,**} rw,
|
|
|
|
# Dropbox proprietary demon files
|
|
owner @{DROPBOX_DEMON_DIR}/{,**} rw,
|
|
owner @{DROPBOX_DEMON_DIR}/dropboxd rwix,
|
|
owner @{DROPBOX_DEMON_DIR}/dropbox-lnx.*/dropbox rwix,
|
|
owner @{DROPBOX_DEMON_DIR}/dropbox-lnx.*/dropboxd rwix,
|
|
owner @{DROPBOX_DEMON_DIR}/dropbox-lnx.*/dropbox_py3 rwix,
|
|
owner @{DROPBOX_DEMON_DIR}/dropbox-lnx.*/wmctrl rwix,
|
|
owner @{DROPBOX_DEMON_DIR}/dropbox-lnx.*/*.so* mrw,
|
|
owner @{DROPBOX_DEMON_DIR}/dropbox-lnx.*/plugins/platforms/*.so mrw,
|
|
|
|
/{usr/,}bin/{,ba,da}sh rix,
|
|
/{usr/,}bin/readlink rix,
|
|
/{usr/,}bin/dirname rix,
|
|
/{usr/,}bin/uname rix,
|
|
/{usr/,}sbin/ldconfig rix,
|
|
/{usr/,}bin/{,@{multiarch}-}gcc-[0-9]* rix,
|
|
/{usr/,}bin/{,@{multiarch}-}objdump rix,
|
|
|
|
# Needed for updating Dropbox
|
|
owner /tmp/.dropbox-dist-new-*/{,**} rw,
|
|
owner /tmp/.dropbox-dist-new-*/.dropbox-dist/dropboxd rix,
|
|
owner /tmp/.dropbox-dist-new-*/.dropbox-dist/dropbox-lnx.*/dropbox rwix,
|
|
owner /tmp/.dropbox-dist-new-*/.dropbox-dist/dropbox-lnx.*/dropboxd rwix,
|
|
owner /tmp/.dropbox-dist-new-*/.dropbox-dist/dropbox-lnx.*/*.so mrw,
|
|
owner @{HOME}/.dropbox-dist-old*/{,**} rw,
|
|
owner @{HOME}/.dropbox-dist-tmp-*/{,**} rw,
|
|
|
|
# For autostart
|
|
deny owner @{HOME}/.config/autostart/dropbox.desktop rw,
|
|
|
|
# What's this for?
|
|
/{usr/,}bin/mount mrix,
|
|
@{sys}/devices/virtual/block/dm-[0-9]*/dm/name r,
|
|
@{sys}/devices/virtual/block/loop[0-9]/ r,
|
|
@{sys}/devices/virtual/block/loop[0-9]/loop/{autoclear,backing_file} r,
|
|
@{run}/mount/utab r,
|
|
|
|
deny @{PROC}/ r,
|
|
# Dropbox doesn't sync without the 'stat' file
|
|
owner @{PROC}/@{pid}/stat r,
|
|
#
|
|
deny owner @{PROC}/@{pid}/statm r,
|
|
deny owner @{PROC}/@{pid}/io r,
|
|
deny @{PROC}/@{pid}/net/tcp{,6} r,
|
|
deny @{PROC}/@{pid}/net/udp{,6} r,
|
|
# When "cmdline" is blocked, Dropbox has some issues while starting:
|
|
# The Dropbox daemon is not installed! Run "dropbox start -i" to install the daemon
|
|
@{PROC}/@{pid}/cmdline r,
|
|
#
|
|
owner @{PROC}/@{pid}/fd/ r,
|
|
owner @{PROC}/@{pid}/fdinfo/* r,
|
|
owner @{PROC}/@{pid}/task/ r,
|
|
owner @{PROC}/@{pid}/task/@{tid}/stat r,
|
|
owner @{PROC}/@{pid}/task/@{tid}/comm r,
|
|
deny owner @{PROC}/@{pid}/oom_{,score_}adj rw,
|
|
owner @{PROC}/@{pid}/mounts r,
|
|
owner @{PROC}/@{pid}/mountinfo r,
|
|
deny @{PROC}/version r,
|
|
# To remove the following error:
|
|
# RuntimeWarning: 'sin' and 'sout' swap memory stats couldn't be determined and were set to 0
|
|
# ([Errno 13] Permission denied: '/proc/vmstat')
|
|
@{PROC}/vmstat r,
|
|
|
|
# Dropbox first tries the /tmp/ dir, and if it's denied it uses the /var/tmp/ dir instead
|
|
owner /tmp/dropbox-antifreeze-* rw,
|
|
owner /tmp/[a-zA-z0-9]* rw,
|
|
owner /tmp/#[0-9]*[0-9] rw,
|
|
owner /var/tmp/etilqs_* rw,
|
|
|
|
@{run}/systemd/users/[0-9]* r,
|
|
|
|
deny @{sys}/module/apparmor/parameters/enabled r,
|
|
|
|
# External apps
|
|
/{usr/,}bin/xdg-open rCx -> open,
|
|
/{usr/,}bin/lsb_release rPx -> child-lsb_release,
|
|
|
|
# Allowed apps to open
|
|
/{usr/,}lib/firefox/firefox rPUx,
|
|
|
|
|
|
profile open {
|
|
include <abstractions/base>
|
|
include <abstractions/xdg-open>
|
|
|
|
/{usr/,}bin/xdg-open mr,
|
|
|
|
/{usr/,}bin/{,ba,da}sh rix,
|
|
/{usr/,}bin/gawk rix,
|
|
/{usr/,}bin/readlink rix,
|
|
/{usr/,}bin/basename rix,
|
|
|
|
owner @{HOME}/ r,
|
|
|
|
owner @{run}/user/[0-9]*/ r,
|
|
|
|
# Allowed apps to open
|
|
/{usr/,}lib/firefox/firefox rPUx,
|
|
|
|
# file_inherit
|
|
owner @{HOME}/.xsession-errors w,
|
|
|
|
}
|
|
|
|
include if exists <local/dropbox>
|
|
}
|