Skip to content

Instantly share code, notes, and snippets.

@brian9206
Created April 25, 2020 05:38
Show Gist options
  • Save brian9206/2a6906fdd31dca18aa431e121c4d6c18 to your computer and use it in GitHub Desktop.
Save brian9206/2a6906fdd31dca18aa431e121c4d6c18 to your computer and use it in GitHub Desktop.
/usr/lib/systemd/system/[email protected]
[Unit]
Description=OpenVPN tunnel for %I
After=syslog.target network-online.target
[email protected]
Wants=network-online.target
[email protected]
[Service]
Type=notify
PrivateTmp=true
WorkingDirectory=/etc/openvpn/client
ExecStart=/usr/sbin/openvpn --suppress-timestamps --nobind --config %i.conf
#ExecStartPost=/bin/sleep 2
#ExecStartPost=/sbin/dhclient %i
#ExecStopPre=-/sbin/dhclient -x %i
CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE CAP_SYS_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=10
DeviceAllow=/dev/null rw
DeviceAllow=/dev/net/tun rw
ProtectSystem=true
ProtectHome=true
KillMode=process
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment