| 1 |
[Unit] |
| 2 |
Description=OpenVPN authenticator |
| 3 |
Documentation=https://github.com/jkroepke/openvpn-auth-oauth2 |
| 4 |
Requires=network-online.target |
| 5 |
Wants=network-online.target nss-lookup.target openvpn.service |
| 6 |
After=network-online.target nss-lookup.target basic.target openvpn.service [email protected] [email protected] |
| 7 |
PartOf=openvpn.service [email protected] [email protected] |
| 8 |
StartLimitIntervalSec=30 |
| 9 |
StartLimitBurst=3 |
| 10 |
|
| 11 |
[Service] |
| 12 |
Restart=on-failure |
| 13 |
RestartSec=30 |
| 14 |
# Run as an unprivileged user with random user id. |
| 15 |
DynamicUser=true |
| 16 |
User=openvpn-auth-oauth2-dynamic |
| 17 |
Group=openvpn-auth-oauth2-dynamic |
| 18 |
SupplementaryGroups=openvpn-auth-oauth2 |
| 19 |
|
| 20 |
ExecStart=/usr/bin/openvpn-auth-oauth2 --config ${OPENVPN_AUTH_OAUTH2_CONFIG_FILE} |
| 21 |
NoExecPaths=/ |
| 22 |
ExecPaths=/usr/bin/openvpn-auth-oauth2 /usr/bin/env /usr/bin/kill |
| 23 |
ExecReload=/usr/bin/env kill -USR1 $MAINPID |
| 24 |
Environment=OPENVPN_AUTH_OAUTH2_CONFIG_FILE=/etc/openvpn-auth-oauth2/config.yaml |
| 25 |
#LoadCredential=openvpn-auth-oauth2:/etc/openvpn-auth-oauth2/ |
| 26 |
#ConfigurationDirectory=openvpn-auth-oauth2 |
| 27 |
#ConfigurationDirectoryMode=0750 |
| 28 |
RuntimeDirectory=openvpn-auth-oauth2 |
| 29 |
ReadWritePaths=-/run/openvpn -/run/openvpn-server |
| 30 |
|
| 31 |
# We don't need write access anywhere. |
| 32 |
AmbientCapabilities= |
| 33 |
CapabilityBoundingSet= |
| 34 |
MemoryDenyWriteExecute=true |
| 35 |
NoNewPrivileges=true |
| 36 |
LockPersonality=true |
| 37 |
PrivateDevices=true |
| 38 |
PrivateTmp=true |
| 39 |
PrivateUsers=true |
| 40 |
ProcSubset=pid |
| 41 |
ProtectClock=true |
| 42 |
ProtectControlGroups=true |
| 43 |
ProtectHome=true |
| 44 |
ProtectHostname=true |
| 45 |
ProtectKernelLogs=true |
| 46 |
ProtectKernelModules=true |
| 47 |
ProtectKernelTunables=true |
| 48 |
ProtectProc=noaccess |
| 49 |
ProtectSystem=strict |
| 50 |
RemoveIPC=true |
| 51 |
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 |
| 52 |
RestrictNamespaces=true |
| 53 |
RestrictRealtime=true |
| 54 |
RestrictSUIDSGID=true |
| 55 |
SystemCallArchitectures=native |
| 56 |
SystemCallFilter=@io-event @file-system @basic-io @system-service |
| 57 |
SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @resources @setuid @swap |
| 58 |
SystemCallErrorNumber=EPERM |
| 59 |
UMask=0027 |
| 60 |
|
| 61 |
[Install] |
| 62 |
WantedBy=multi-user.target |