Skip to content

Commit

Permalink
Extend apparmor profile for firefox so that is can manage its own mem…
Browse files Browse the repository at this point in the history
…ory and external USB devices
  • Loading branch information
moritzheiber committed Nov 18, 2024
1 parent f45d68c commit 572172f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions mitamae/apparmor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apparmor_content = <<~APPARMOR
/sys/class/ r,
/sys/bus/ r,
/sys/class/hidraw/ r,
/run/udev/data/c24{1,7,9}:* r,
/sys/devices/**/hidraw/hidraw*/uevent r,
/dev/hidraw* rw,
@{PROC}/[0-9]*/oom_score_adj rw,
@{PROC}/[0-9]*/cgroup r,
APPARMOR

firefox_apparmor_file = '/etc/apparmor.d/local/usr.bin.firefox'

file firefox_apparmor_file do
action :edit
block do |content|
content << apparmor_content
end
not_if "grep -qFx '#{apparmor_content.lines.first.strip}' #{firefox_apparmor_file}"
notifies :restart, 'service[apparmor]', :immediately
end

service 'apparmor' do
action :nothing
end
1 change: 1 addition & 0 deletions mitamae/mitamae.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
include_recipe 'apt'
include_recipe 'repos'
include_recipe 'packages'
include_recipe 'apparmor'
include_recipe 'docker'
include_recipe 'hashicorp'
include_recipe 'configuration'
Expand Down

0 comments on commit 572172f

Please sign in to comment.