2021-01-10 16:35:07 +01:00
|
|
|
# vim:syntax=apparmor
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Copyright (C) 2020-2021 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>
|
|
|
|
|
|
|
|
@{exec_path} = /{usr/,}bin/arduino
|
|
|
|
profile arduino @{exec_path} {
|
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/consoles>
|
|
|
|
include <abstractions/nameservice-strict>
|
|
|
|
include <abstractions/gtk>
|
|
|
|
include <abstractions/fonts>
|
|
|
|
include <abstractions/fontconfig-cache-read>
|
|
|
|
include <abstractions/freedesktop.org>
|
2021-02-13 15:00:16 +01:00
|
|
|
include <abstractions/devices-usb>
|
2021-01-10 16:35:07 +01:00
|
|
|
|
|
|
|
network inet dgram,
|
|
|
|
network inet6 dgram,
|
|
|
|
network inet stream,
|
|
|
|
network inet6 stream,
|
|
|
|
network netlink raw,
|
|
|
|
|
2021-02-13 15:00:16 +01:00
|
|
|
ptrace (read) peer=arduino//open,
|
|
|
|
ptrace (read) peer=arduino-builder,
|
|
|
|
|
2021-01-10 16:35:07 +01:00
|
|
|
@{exec_path} mr,
|
|
|
|
|
2021-02-13 15:00:16 +01:00
|
|
|
/{usr/,}bin/{,ba,da}sh rix,
|
2021-01-10 16:35:07 +01:00
|
|
|
/{usr/,}bin/id rix,
|
|
|
|
/{usr/,}bin/{,e}grep rix,
|
|
|
|
/{usr/,}bin/groups rix,
|
2021-02-13 15:00:16 +01:00
|
|
|
/{usr/,}bin/sed rix,
|
|
|
|
/{usr/,}bin/cat rix,
|
|
|
|
/{usr/,}bin/chmod rix,
|
2021-01-10 16:35:07 +01:00
|
|
|
/{usr/,}bin/avrdude rix,
|
|
|
|
|
|
|
|
/{usr/,}bin/xdg-open rCx -> open,
|
|
|
|
|
2021-02-13 15:00:16 +01:00
|
|
|
/{usr/,}bin/dpkg-architecture rPx,
|
|
|
|
/{usr/,}bin/arduino-builder rPx,
|
|
|
|
|
2021-01-10 16:35:07 +01:00
|
|
|
/{usr/,}lib/jvm/java-[0-9]*-openjdk-*/bin/java rix,
|
|
|
|
/{usr/,}lib/jvm/java-[0-9]*-openjdk-*/lib/server/classes.jsa mr,
|
|
|
|
/usr/share/java/*.jar r,
|
|
|
|
/etc/java-[0-9]*-openjdk/** r,
|
2021-02-13 15:00:16 +01:00
|
|
|
/etc/ssl/certs/java/cacerts r,
|
|
|
|
owner @{HOME}/.java/fonts/*/ rw,
|
2021-01-10 16:35:07 +01:00
|
|
|
owner @{HOME}/.java/fonts/*/fcinfo[0-9]*.tmp rw,
|
|
|
|
owner @{HOME}/.java/fonts/*/fcinfo-*.properties rw,
|
|
|
|
|
2021-02-13 15:00:16 +01:00
|
|
|
include <abstractions/dconf>
|
|
|
|
owner @{run}/user/[0-9]*/dconf/user rw,
|
2021-01-10 16:35:07 +01:00
|
|
|
|
2021-02-13 15:00:16 +01:00
|
|
|
/usr/share/arduino/{,**} r,
|
|
|
|
/usr/share/arduino-builder/{,**} r,
|
2021-01-10 16:35:07 +01:00
|
|
|
|
2021-02-13 15:00:16 +01:00
|
|
|
/usr/share/doc/arduino/{,**} r,
|
|
|
|
/usr/share/doc/arduino-core/{,**} r,
|
2021-01-10 16:35:07 +01:00
|
|
|
|
2021-02-13 15:00:16 +01:00
|
|
|
owner @{HOME}/ r,
|
|
|
|
owner @{HOME}/.arduino{,15}/{,**} rw,
|
|
|
|
owner @{HOME}/Arduino/{,**} rw,
|
|
|
|
owner @{HOME}/sketchbook/{,**} rw,
|
2021-01-10 16:35:07 +01:00
|
|
|
|
|
|
|
owner @{HOME}/.Xauthority r,
|
|
|
|
|
|
|
|
/tmp/ r,
|
2021-02-13 15:00:16 +01:00
|
|
|
owner /tmp/cc*.{s,res,c,o,ld,le} rw,
|
2021-01-10 16:35:07 +01:00
|
|
|
owner /tmp/hsperfdata_*/ rw,
|
|
|
|
owner /tmp/hsperfdata_*/@{pid} rw,
|
|
|
|
owner /tmp/untitled[0-9]*.tmp rw,
|
2021-02-13 15:00:16 +01:00
|
|
|
owner /tmp/untitled[0-9]*.tmp/{,**} rw,
|
2021-01-10 16:35:07 +01:00
|
|
|
owner /tmp/console[0-9]*.tmp rw,
|
2021-02-13 15:00:16 +01:00
|
|
|
owner /tmp/console[0-9]*.tmp/{,**} rw,
|
2021-01-10 16:35:07 +01:00
|
|
|
owner /tmp/build[0-9]*.tmp rw,
|
2021-02-13 15:00:16 +01:00
|
|
|
owner /tmp/build[0-9]*.tmp/{,**} rw,
|
|
|
|
owner /tmp/arduino_{build,cache}_[0-9]*/{,**} rw,
|
|
|
|
owner /tmp/{library,package}_index.json*.tmp* rw,
|
|
|
|
owner /tmp/arduino_modified_sketch_[0-9]*/{,**} rw,
|
2021-01-10 16:35:07 +01:00
|
|
|
|
|
|
|
owner @{run}/lock/tmp* rw,
|
|
|
|
owner @{run}/lock/LCK..ttyS[0-9]* rw,
|
|
|
|
|
|
|
|
/usr/share/glib-2.0/schemas/gschemas.compiled r,
|
|
|
|
|
|
|
|
owner @{PROC}/@{pid}/fd/ r,
|
|
|
|
owner @{PROC}/@{pid}/coredump_filter rw,
|
|
|
|
owner @{PROC}/@{pid}/mountinfo r,
|
|
|
|
owner @{PROC}/@{pid}/cgroup r,
|
|
|
|
owner @{PROC}/@{pid}/stat r,
|
2021-02-13 15:00:16 +01:00
|
|
|
# For java
|
|
|
|
@{PROC}/@{pids}/stat r,
|
|
|
|
#
|
2021-01-10 16:35:07 +01:00
|
|
|
owner @{PROC}/@{pid}/cmdline r,
|
|
|
|
@{PROC}/@{pid}/net/if_inet6 r,
|
|
|
|
@{PROC}/@{pid}/net/ipv6_route r,
|
|
|
|
|
|
|
|
/etc/fstab r,
|
|
|
|
|
|
|
|
/etc/avrdude.conf r,
|
|
|
|
|
2021-03-13 09:47:36 +01:00
|
|
|
@{sys}/fs/cgroup/{,**} r,
|
2021-02-13 15:00:16 +01:00
|
|
|
@{sys}/class/tty/ r,
|
|
|
|
@{sys}/devices/pci[0-9]*/**/usb[0-9]/**/{idVendor,idProduct,manufacturer,serial,product} r,
|
2021-01-10 16:35:07 +01:00
|
|
|
|
|
|
|
/dev/ttyS[0-9]* rw,
|
2021-02-13 15:00:16 +01:00
|
|
|
/dev/ttyACM[0-9]* rw,
|
2021-01-10 16:35:07 +01:00
|
|
|
|
|
|
|
# Silencer
|
|
|
|
deny /usr/share/arduino/** w,
|
|
|
|
|
|
|
|
|
|
|
|
profile open {
|
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/xdg-open>
|
|
|
|
|
|
|
|
/{usr/,}bin/xdg-open mr,
|
|
|
|
|
2021-02-13 15:00:16 +01:00
|
|
|
/{usr/,}bin/{,ba,da}sh rix,
|
|
|
|
/{usr/,}bin/gawk rix,
|
|
|
|
/{usr/,}bin/readlink rix,
|
|
|
|
/{usr/,}bin/basename rix,
|
2021-01-10 16:35:07 +01:00
|
|
|
|
|
|
|
owner @{HOME}/ r,
|
|
|
|
|
|
|
|
owner @{run}/user/[0-9]*/ r,
|
|
|
|
|
|
|
|
# Allowed apps to open
|
|
|
|
/{usr/,}lib/firefox/firefox rPUx,
|
|
|
|
/{usr/,}bin/spacefm rPUx,
|
|
|
|
|
|
|
|
# file_inherit
|
|
|
|
owner @{HOME}/.xsession-errors w,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
include if exists <local/arduino>
|
|
|
|
}
|