-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathhardened-vector.service
56 lines (49 loc) · 1.23 KB
/
hardened-vector.service
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
# Experimental service configuration for a hardened Vector
#
# This has not been widely tested on all OSes and with all Vector
# configurations, but can be used as a basis for limiting the Vector service
# capabilities
[Unit]
Description=Vector
Documentation=https://vector.dev
After=network-online.target
Requires=network-online.target
[Service]
EnvironmentFile=-/etc/default/vector
User=vector
Group=vector
ExecStartPre=/usr/bin/vector validate
ExecStart=/usr/bin/vector
ExecReload=/usr/bin/vector validate
ExecReload=/bin/kill -HUP $MAINPID
Restart=no
# capabilities
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
# sandboxing
ProtectHostname=yes
ProtectClock=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectSystem=strict
ProtectHome=yes
StateDirectory=vector
ProtectControlGroups=yes
PrivateTmp=yes
PrivateDevices=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
LockPersonality=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
NoNewPrivileges=yes
RemoveIPC=yes
RestrictNamespaces=yes
# syscall filtering
SystemCallFilter=@system-service @debug
SystemCallArchitectures=native
# process properties
UMask=077
[Install]
WantedBy=multi-user.target