Skip to content

Commit cabc1c6

Browse files
topimiettinenpoettering
authored andcommitted
units: add ProtectClock=yes
Add `ProtectClock=yes` to systemd units. Since it implies certain `DeviceAllow=` rules, make sure that the units have `DeviceAllow=` rules so they are still able to access other devices. Exclude timesyncd and timedated.
1 parent c3362c2 commit cabc1c6

6 files changed

+8
-0
lines changed

units/systemd-journal-remote.service.in

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ NoNewPrivileges=yes
2121
PrivateDevices=yes
2222
PrivateNetwork=yes
2323
PrivateTmp=yes
24+
ProtectClock=yes
2425
ProtectControlGroups=yes
2526
ProtectHome=yes
2627
ProtectHostname=yes

units/systemd-journald.service.in

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ LockPersonality=yes
2525
MemoryDenyWriteExecute=yes
2626
NoNewPrivileges=yes
2727
OOMScoreAdjust=-250
28+
ProtectClock=yes
2829
Restart=always
2930
RestartSec=0
3031
RestrictAddressFamilies=AF_UNIX AF_NETLINK

units/systemd-logind.service.in

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ LockPersonality=yes
3636
MemoryDenyWriteExecute=yes
3737
NoNewPrivileges=yes
3838
PrivateTmp=yes
39+
ProtectClock=yes
3940
ProtectControlGroups=yes
4041
ProtectHome=yes
4142
ProtectHostname=yes

units/systemd-networkd.service.in

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ ExecStart=!!@rootlibexecdir@/systemd-networkd
2626
LockPersonality=yes
2727
MemoryDenyWriteExecute=yes
2828
NoNewPrivileges=yes
29+
ProtectClock=yes
2930
ProtectControlGroups=yes
3031
ProtectHome=yes
3132
ProtectKernelModules=yes

units/systemd-resolved.service.in

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ MemoryDenyWriteExecute=yes
2828
NoNewPrivileges=yes
2929
PrivateDevices=yes
3030
PrivateTmp=yes
31+
ProtectClock=yes
3132
ProtectControlGroups=yes
3233
ProtectHome=yes
3334
ProtectKernelModules=yes

units/systemd-udevd.service.in

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Before=sysinit.target
1616
ConditionPathIsReadWrite=/sys
1717

1818
[Service]
19+
DeviceAllow=block-* rwm
20+
DeviceAllow=char-* rwm
1921
Type=notify
2022
# Note that udev also adjusts the OOM score internally and will reset the value internally for its workers
2123
OOMScoreAdjust=-1000
@@ -27,6 +29,7 @@ ExecReload=udevadm control --reload --timeout 0
2729
KillMode=mixed
2830
TasksMax=infinity
2931
PrivateMounts=yes
32+
ProtectClock=yes
3033
ProtectHostname=yes
3134
MemoryDenyWriteExecute=yes
3235
RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6

0 commit comments

Comments
 (0)