Skip to content

Commit

Permalink
Merge pull request openSUSE#646 from aschnell/master
Browse files Browse the repository at this point in the history
added systemd sandboxing for services
  • Loading branch information
aschnell authored Apr 28, 2021
2 parents a39f690 + 062b6ad commit 75c0971
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 1 deletion.
11 changes: 11 additions & 0 deletions data/boot.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@ ConditionPathExists=/etc/snapper/configs/root
[Service]
Type=oneshot
ExecStart=/usr/bin/snapper --config root create --cleanup-algorithm number --description "boot"

CapabilityBoundingSet=CAP_CHOWN CAP_FSETID CAP_SETFCAP CAP_SYS_ADMIN CAP_SYS_MODULE CAP_IPC_LOCK CAP_SYS_NICE
LockPersonality=true
NoNewPrivileges=false
PrivateNetwork=true
ProtectControlGroups=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelTunables=true
RestrictAddressFamilies=AF_UNIX
RestrictRealtime=true
11 changes: 11 additions & 0 deletions data/cleanup.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@ Type=simple
ExecStart=/usr/lib/snapper/systemd-helper --cleanup
IOSchedulingClass=idle
CPUSchedulingPolicy=idle

CapabilityBoundingSet=CAP_CHOWN CAP_FSETID CAP_SETFCAP CAP_SYS_ADMIN CAP_SYS_MODULE CAP_IPC_LOCK CAP_SYS_NICE
LockPersonality=true
NoNewPrivileges=false
PrivateNetwork=true
ProtectControlGroups=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelTunables=true
RestrictAddressFamilies=AF_UNIX
RestrictRealtime=true
11 changes: 11 additions & 0 deletions data/snapperd.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,14 @@ Documentation=man:snapperd(8)
Type=dbus
BusName=org.opensuse.Snapper
ExecStart=/usr/sbin/snapperd

CapabilityBoundingSet=CAP_CHOWN CAP_FSETID CAP_SETFCAP CAP_SYS_ADMIN CAP_SYS_MODULE CAP_IPC_LOCK CAP_SYS_NICE
LockPersonality=true
NoNewPrivileges=false
PrivateNetwork=true
ProtectControlGroups=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelTunables=true
RestrictAddressFamilies=AF_UNIX
RestrictRealtime=true
21 changes: 21 additions & 0 deletions data/systemd-sandboxing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

Notes about systemd sandboxing
------------------------------

CapabilityBoundingSet=CAP_SYS_ADMIN is needed to get the btrfs default
subvolume id.

ProtectClock=true breaks LVM - strange.

CAP_SYS_MODULE is needed for LVM (creating snapshots, loads
dm_snapshot).

ProtectKernelModules=true breaks LVM.

CapabilityBoundingSet=CAP_SYS_NICE is also needed by LVM.

ProtectHome=true breaks diff for LVM.

SystemCallFilter=@mount breaks almost everything with older systemd,
e.g. on SLE15 SP1.

10 changes: 10 additions & 0 deletions data/timeline.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ Documentation=man:snapper(8) man:snapper-configs(5)
Type=simple
ExecStart=/usr/lib/snapper/systemd-helper --timeline

CapabilityBoundingSet=CAP_CHOWN CAP_FSETID CAP_SETFCAP CAP_SYS_ADMIN CAP_SYS_MODULE CAP_IPC_LOCK CAP_SYS_NICE
LockPersonality=true
NoNewPrivileges=false
PrivateNetwork=true
ProtectControlGroups=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelTunables=true
RestrictAddressFamilies=AF_UNIX
RestrictRealtime=true
5 changes: 5 additions & 0 deletions package/snapper.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Apr 28 10:17:14 CEST 2021 - [email protected]

- added systemd sandboxing for services

-------------------------------------------------------------------
Mon Apr 19 09:56:40 CEST 2021 - [email protected]

Expand Down
1 change: 0 additions & 1 deletion snapper/Lvm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ namespace snapper

if (!umount(info_dir, "snapshot"))
throw UmountSnapshotFailedException();

}

try
Expand Down

0 comments on commit 75c0971

Please sign in to comment.