Skip to content

Commit aefc1f8

Browse files
jrx-codeclaude
andcommitted
fix: rewrite AppArmor profile — fix "Can't load profile" install error
- network: use broad `network,` + `deny network raw,` instead of per-type rules - Add S6-Overlay/Bashio paths required by HA base images - Add /bin/** and /usr/bin/** ix for shell utilities - Use `deny /proc/** wl,` pattern instead of explicit proc/sys reads - Add capability net_bind_service - Add /usr/local/lib/** mr for Python shared libraries Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8e02bd1 commit aefc1f8

1 file changed

Lines changed: 37 additions & 18 deletions

File tree

ha-sandbox/apparmor.txt

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,59 @@
33
profile ha_security_sandbox flags=(attach_disconnected,mediate_deleted) {
44
#include <abstractions/base>
55

6-
# Network access (git clone, API calls, MQTT)
7-
network inet stream,
8-
network inet dgram,
9-
network inet6 stream,
10-
network inet6 dgram,
6+
# Full network access (git clone, API calls, MQTT)
7+
network,
8+
deny network raw,
119

12-
# Application files
13-
/app/** r,
14-
/run.sh rx,
10+
# Capabilities
11+
capability net_bind_service,
12+
13+
# S6-Overlay / Bashio
14+
/usr/lib/bashio/** ix,
15+
/etc/s6/** ix,
16+
/run/{s6,s6-rc*,service}/** ix,
17+
/package/** ix,
18+
/command/** ix,
19+
/etc/services.d/** rwix,
20+
/etc/cont-init.d/** rwix,
21+
/etc/cont-finish.d/** rwix,
22+
23+
# Shell and system binaries
24+
/bin/** ix,
25+
/usr/bin/** ix,
1526

1627
# Python
17-
/usr/local/bin/python3* rix,
18-
/usr/local/lib/python3*/** r,
28+
/usr/local/bin/python3* ix,
29+
/usr/local/lib/** mr,
1930
/usr/lib/python3*/** r,
2031

2132
# Git
2233
/usr/bin/git rix,
2334
/usr/libexec/git-core/** rix,
2435

25-
# Data directories
36+
# Application files
37+
/app/** r,
38+
/run.sh rx,
39+
40+
# Deny dangerous proc/sys writes, allow reads via glob
41+
deny /proc/** wl,
42+
deny /sys/** wl,
43+
44+
# General read + specific write areas
45+
/ r,
46+
/** r,
47+
/tmp/** rwk,
2648
/data/** rw,
2749
/share/ha-sandbox/** rw,
50+
/run/{,**} rwk,
51+
/dev/tty rw,
2852

2953
# Config
3054
/config.yaml r,
3155

32-
# Temp
33-
/tmp/** rw,
34-
/proc/** r,
35-
/sys/fs/cgroup/** r,
36-
37-
# DNS resolution
56+
# DNS
57+
/etc/resolv.conf rw,
3858
/etc/hosts r,
39-
/etc/resolv.conf r,
4059
/etc/nsswitch.conf r,
4160

4261
# SSL certificates

0 commit comments

Comments
 (0)