feat(profiles): update chrome profiles.

This commit is contained in:
Alexandre Pujol 2022-12-07 20:40:34 +00:00
parent 6ada4f7ece
commit 53e04cc10e
Failed to generate hash of commit
3 changed files with 96 additions and 25 deletions

View file

@ -7,15 +7,18 @@ abi <abi/3.0>,
include <tunables/global> include <tunables/global>
@{CHROME_INSTALLDIR} = /opt/google/chrome{,-beta,-unstable} @{chromiun_domain} = "com.google.Chrome"
@{CHROME_HOMEDIR} = @{user_config_dirs}/google-chrome{,-beta,-unstable} @{chromiun_install_dirs} = /opt/google/chrome{,-beta,-unstable}
@{CHROME_CACHEDIR} = @{user_cache_dirs}/google-chrome{,-beta,-unstable} @{chromiun_config_dirs} = @{user_config_dirs}/google-chrome{,-beta,-unstable}
@{chromiun_cache_dirs} = @{user_cache_dirs}/google-chrome{,-beta,-unstable}
@{exec_path} = @{CHROME_INSTALLDIR}/chrome{,-beta,-unstable} @{exec_path} = @{chromiun_install_dirs}/chrome{,-beta,-unstable}
profile google-chrome-chrome @{exec_path} { profile google-chrome-chrome @{exec_path} {
include <abstractions/base> include <abstractions/base>
include <abstractions/audio> include <abstractions/audio>
include <abstractions/chromium-common> include <abstractions/chromium-common>
include <abstractions/dconf-write>
include <abstractions/devices-usb>
include <abstractions/fontconfig-cache-read> include <abstractions/fontconfig-cache-read>
include <abstractions/fonts> include <abstractions/fonts>
include <abstractions/freedesktop.org> include <abstractions/freedesktop.org>
@ -26,7 +29,17 @@ profile google-chrome-chrome @{exec_path} {
include <abstractions/ssl_certs> include <abstractions/ssl_certs>
include <abstractions/thumbnails-cache-read> include <abstractions/thumbnails-cache-read>
include <abstractions/user-download-strict> include <abstractions/user-download-strict>
include <abstractions/user-read>
include <abstractions/vulkan>
capability sys_ptrace,
ptrace (read) peer=browserpass,
ptrace (read) peer=chrome-gnome-shell,
ptrace (read) peer=gnome-browser-connector-host,
ptrace (read) peer=keepassxc-proxy,
ptrace (read) peer=lsb_release,
ptrace (read) peer=xdg-settings,
ptrace (trace) peer=@{profile_name}, ptrace (trace) peer=@{profile_name},
signal (send) set=(term, kill) peer=keepassxc-proxy, signal (send) set=(term, kill) peer=keepassxc-proxy,
@ -39,14 +52,17 @@ profile google-chrome-chrome @{exec_path} {
@{exec_path} mrix, @{exec_path} mrix,
@{CHROME_INSTALLDIR}/{,**} r, @{chromiun_install_dirs}/{,**} r,
@{CHROME_INSTALLDIR}/chrome-sandbox rPx, @{chromiun_install_dirs}/*.so* mr,
@{CHROME_INSTALLDIR}/google-chrome{,-beta,-unstable} rPx, @{chromiun_install_dirs}/chrome_crashpad_handler rPx,
@{CHROME_INSTALLDIR}/nacl_helper rix, @{chromiun_install_dirs}/chrome-sandbox rPx,
@{CHROME_INSTALLDIR}/xdg-mime rix, @{chromiun_install_dirs}/google-chrome{,-beta,-unstable} rPx,
@{CHROME_INSTALLDIR}/xdg-settings rix, @{chromiun_install_dirs}/libwidevinecdm.so mr,
@{CHROME_INSTALLDIR}/libwidevinecdm.so mr, @{chromiun_install_dirs}/libwidevinecdmadapter.so mr,
@{CHROME_INSTALLDIR}/libwidevinecdmadapter.so mr, @{chromiun_install_dirs}/nacl_helper rix,
@{chromiun_install_dirs}/WidevineCdm/_platform_specific/linux_*/libwidevinecdm.so mr,
@{chromiun_install_dirs}/xdg-mime rix,
@{chromiun_install_dirs}/xdg-settings rix,
# For "google-chrome --help" # For "google-chrome --help"
/{usr/,}bin/man rPUx, /{usr/,}bin/man rPUx,
@ -56,6 +72,7 @@ profile google-chrome-chrome @{exec_path} {
/{usr/,}bin/browserpass rPx, /{usr/,}bin/browserpass rPx,
/{usr/,}bin/lsb_release rPx -> lsb_release, /{usr/,}bin/lsb_release rPx -> lsb_release,
/{usr/,}bin/xdg-desktop-menu rPx,
/{usr/,}bin/xdg-mime rPx, /{usr/,}bin/xdg-mime rPx,
/{usr/,}bin/xdg-open rPx -> child-open, /{usr/,}bin/xdg-open rPx -> child-open,
/{usr/,}bin/xdg-settings rPx, /{usr/,}bin/xdg-settings rPx,
@ -63,24 +80,25 @@ profile google-chrome-chrome @{exec_path} {
/usr/share/glib-2.0/schemas/gschemas.compiled r, /usr/share/glib-2.0/schemas/gschemas.compiled r,
/etc/fstab r, /etc/fstab r,
/etc/libva.conf r,
/var/lib/dbus/machine-id r, /var/lib/dbus/machine-id r,
/etc/machine-id r, /etc/machine-id r,
# Google Chrome home files # Google Chrome home files
owner @{HOME}/ r, owner @{HOME}/ r,
owner @{CHROME_HOMEDIR}/ rw, owner @{chromiun_config_dirs}/ rw,
owner @{CHROME_HOMEDIR}/** rwk, owner @{chromiun_config_dirs}/** rwk,
owner @{user_share_dirs}/.com.google.Chrome.* rw, owner @{user_share_dirs}/.@{chromiun_domain}.* rw,
owner @{user_cache_dirs}/ rw, owner @{user_cache_dirs}/ rw,
owner @{CHROME_CACHEDIR}/{,**/} rw, owner @{chromiun_cache_dirs}/{,**/} rw,
owner @{CHROME_CACHEDIR}/*/**/{*-,}index rw, owner @{chromiun_cache_dirs}/*/**/{*-,}index rw,
owner @{CHROME_CACHEDIR}/*/**/[a-f0-9]*_? rw, owner @{chromiun_cache_dirs}/*/**/[a-f0-9]*_? rw,
owner @{CHROME_CACHEDIR}/*/**/todelete_* rw, owner @{chromiun_cache_dirs}/*/**/todelete_* rw,
owner @{CHROME_CACHEDIR}/PnaclTranslationCache/index rw, owner @{chromiun_cache_dirs}/PnaclTranslationCache/index rw,
owner @{CHROME_CACHEDIR}/PnaclTranslationCache/data_[0-9]*[0-9] rw, owner @{chromiun_cache_dirs}/PnaclTranslationCache/data_[0-9]*[0-9] rw,
# For importing data (bookmarks, cookies, etc) from Firefox # For importing data (bookmarks, cookies, etc) from Firefox
# owner @{HOME}/.mozilla/firefox/profiles.ini r, # owner @{HOME}/.mozilla/firefox/profiles.ini r,
@ -99,6 +117,14 @@ profile google-chrome-chrome @{exec_path} {
# owner @{user_config_dirs}/chromium/*/ r, # owner @{user_config_dirs}/chromium/*/ r,
# owner @{user_config_dirs}/chromium/*/{History,Cookies,Favicons,Bookmarks} rwk, # owner @{user_config_dirs}/chromium/*/{History,Cookies,Favicons,Bookmarks} rwk,
owner /dev/shm/.@{chromiun_domain}* rw,
owner /tmp/.@{chromiun_domain}.* rw,
owner /tmp/.@{chromiun_domain}*/{,**} rw,
owner /tmp/scoped_dir*/{,**} rw,
owner /tmp/tmp.* rw,
owner /tmp/tmp.*/ rw,
owner /tmp/tmp.*/** rwk,
@{PROC}/ r, @{PROC}/ r,
@{PROC}/@{pid}/fd/ r, @{PROC}/@{pid}/fd/ r,
@{PROC}/@{pids}/stat r, @{PROC}/@{pids}/stat r,
@ -133,13 +159,20 @@ profile google-chrome-chrome @{exec_path} {
@{sys}/devices/pci[0-9]*/**/usb[0-9]/{,**/}{descriptors,manufacturer,product,serial,bConfigurationValue} r, @{sys}/devices/pci[0-9]*/**/usb[0-9]/{,**/}{descriptors,manufacturer,product,serial,bConfigurationValue} r,
@{sys}/devices/pci[0-9]*/**/usb[0-9]/**/{idProduct,idVendor,interface} r, @{sys}/devices/pci[0-9]*/**/usb[0-9]/**/{idProduct,idVendor,interface} r,
@{sys}/devices/system/cpu/cpufreq/policy[0-9]*/cpuinfo_max_freq r, @{sys}/devices/system/cpu/cpufreq/policy[0-9]*/cpuinfo_max_freq r,
@{sys}/devices/system/cpu/kernel_max r,
@{sys}/devices/system/cpu/present r,
@{sys}/devices/virtual/**/report_descriptor r, @{sys}/devices/virtual/**/report_descriptor r,
@{sys}/devices/virtual/dmi/id/product_name r, @{sys}/devices/virtual/dmi/id/product_name r,
@{sys}/devices/virtual/dmi/id/sys_vendor r, @{sys}/devices/virtual/dmi/id/sys_vendor r,
@{sys}/devices/virtual/tty/tty[0-9]/active r, @{sys}/devices/virtual/tty/tty[0-9]/active r,
/dev/ r,
/dev/hidraw[0-9]* rw,
/dev/tty rw,
/dev/video[0-9]* rw,
# Silencer # Silencer
deny @{CHROME_INSTALLDIR}/** w, deny @{chromiun_install_dirs}/** w,
deny @{user_share_dirs}/gvfs-metadata/* r, deny @{user_share_dirs}/gvfs-metadata/* r,
include if exists <local/google-chrome-chrome> include if exists <local/google-chrome-chrome>

View file

@ -0,0 +1,34 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2018-2022 Mikhail Morfikov
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /opt/google/chrome/chrome_crashpad_handler
profile google-chrome-crashpad-handler @{exec_path} flags=(complain) {
include <abstractions/base>
capability sys_ptrace,
ptrace peer=chromium-chromium,
signal (send) peer=chromium-chromium,
@{exec_path} mrix,
owner "@{HOME}/.config/google-chrome/Crash Reports/**" rwk,
owner @{PROC}/@{pid}/fd/ r,
owner @{PROC}/@{pids}/mem r,
owner @{PROC}/@{pids}/stat r,
owner @{PROC}/@{pids}/task/ r,
@{PROC}/sys/kernel/yama/ptrace_scope r,
@{sys}/devices/system/cpu/cpufreq/policy[0-9]*/scaling_cur_freq r,
@{sys}/devices/system/cpu/cpufreq/policy[0-9]*/scaling_max_freq r,
include if exists <local/google-chrome-crashpad-handler>
}

View file

@ -18,11 +18,12 @@ profile google-chrome-google-chrome @{exec_path} {
@{exec_path} r, @{exec_path} r,
/{usr/,}bin/{,ba,da}sh rix, /{usr/,}bin/{,ba,da}sh rix,
/{usr/,}bin/readlink rix, /{usr/,}bin/cat rix,
/{usr/,}bin/which{,.debianutils} rix,
/{usr/,}bin/dirname rix, /{usr/,}bin/dirname rix,
/{usr/,}bin/mkdir rix, /{usr/,}bin/mkdir rix,
/{usr/,}bin/cat rix, /{usr/,}bin/readlink rix,
/{usr/,}bin/touch rix,
/{usr/,}bin/which{,.debianutils} rix,
@{CHROME_INSTALLDIR}/chrome rPx, @{CHROME_INSTALLDIR}/chrome rPx,
@ -31,5 +32,8 @@ profile google-chrome-google-chrome @{exec_path} {
# file_inherit # file_inherit
owner @{HOME}/.xsession-errors w, owner @{HOME}/.xsession-errors w,
# Silencer
deny @{user_share_dirs}/gvfs-metadata/* r,
include if exists <local/google-chrome-google-chrome> include if exists <local/google-chrome-google-chrome>
} }