-
Notifications
You must be signed in to change notification settings - Fork 48
/
nohang.service.in
61 lines (52 loc) · 1.7 KB
/
nohang.service.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
[Unit]
Description=Sophisticated low memory handler
Documentation=man:nohang(8) https://github.com/hakavlad/nohang
Conflicts=nohang-desktop.service
After=sysinit.target
[Service]
ExecStart=:TARGET_SBINDIR:/nohang --monitor --config :TARGET_SYSCONFDIR:/nohang/nohang.conf
Slice=hostcritical.slice
SyslogIdentifier=nohang
KillMode=mixed
Restart=always
RestartSec=0
CPUSchedulingResetOnFork=true
RestrictRealtime=yes
TasksMax=25
MemoryMax=100M
MemorySwapMax=100M
UMask=0027
ProtectSystem=strict
ReadWritePaths=/var/log
InaccessiblePaths=/home /root
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
ProtectHostname=true
MemoryDenyWriteExecute=yes
RestrictNamespaces=yes
LockPersonality=yes
PrivateTmp=true
DeviceAllow=/dev/kmsg rw
DevicePolicy=closed
# Capabilities whitelist:
# CAP_KILL is required to send signals
# CAP_IPC_LOCK is required to mlockall()
# CAP_SYS_PTRACE is required to check /proc/[pid]/exe realpathes
# CAP_DAC_READ_SEARCH is required to read /proc/[pid]/environ files
# CAP_DAC_OVERRIDE fixes #94
# CAP_DAC_READ_SEARCH CAP_AUDIT_WRITE CAP_SETUID CAP_SETGID CAP_SYS_RESOURCE
# are required to send GUI notifications
# CAP_SYSLOG is required to check /dev/kmsg for OOM events
CapabilityBoundingSet=CAP_KILL CAP_IPC_LOCK CAP_SYS_PTRACE \
CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDE CAP_AUDIT_WRITE CAP_SETUID CAP_SETGID \
CAP_SYS_RESOURCE CAP_SYSLOG
# `PrivateNetwork=true` breaks GUI notifications on oldstable distros
# (Debian 8, CentOS 7, Linux Mint 18). On modern distros you can set
# PrivateNetwork=true for security reasons.
#PrivateNetwork=true
# Set realtime CPU scheduling policy if you want
#CPUSchedulingPolicy=rr
#CPUSchedulingPriority=1
[Install]
WantedBy=multi-user.target