summarylogtreecommitdiffstats
path: root/openvpn-auth-oauth2.service
blob: e472270695c36f89b1719031018fde1e779e823f (plain)
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
62
63
64
65
#suppress inspection "DuplicateKeyInSection" for whole file

[Unit]
Description=OpenVPN authenticator
Documentation=https://github.com/jkroepke/openvpn-auth-oauth2
Wants=network-online.target openvpn.service
After=network-online.target openvpn.service openvpn@.service openvpn-server@.service
PartOf=openvpn.service openvpn@.service openvpn-server@.service

[Service]
# Run as an unprivileged user with random user id.
DynamicUser=true
User=openvpn-auth-oauth2-dynamic
Group=openvpn-auth-oauth2-dynamic
SupplementaryGroups=openvpn-auth-oauth2

ExecStart=/usr/bin/openvpn-auth-oauth2 --config ${CONFIG_FILE}
NoExecPaths=/
ExecPaths=/usr/bin/openvpn-auth-oauth2

Environment=CONFIG_FILE=/etc/openvpn-auth-oauth2/config.yaml
EnvironmentFile=-/etc/sysconfig/openvpn-auth-oauth2
#LoadCredential=openvpn-auth-oauth2:/etc/openvpn-auth-oauth2/
#ConfigurationDirectory=openvpn-auth-oauth2
#ConfigurationDirectoryMode=0750

RuntimeDirectory=openvpn-auth-oauth2

ReadWritePaths=-/run/openvpn -/run/openvpn-server

RestartSec=5s
Restart=always

# We don't need write access anywhere.
AmbientCapabilities=
CapabilityBoundingSet=
MemoryDenyWriteExecute=true
NoNewPrivileges=true
LockPersonality=true
PrivateDevices=true
PrivateTmp=true
PrivateUsers=true
ProcSubset=pid
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectProc=noaccess
ProtectSystem=strict
RemoveIPC=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
SystemCallFilter=@io-event @file-system @basic-io @system-service
SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @resources @setuid @swap
SystemCallErrorNumber=EPERM
UMask=0027

[Install]
WantedBy=multi-user.target