Skip to content

Instantly share code, notes, and snippets.

@crabvk
Created July 21, 2020 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crabvk/831af175eeb6fd6c5d7be28ef5cc6cca to your computer and use it in GitHub Desktop.
Save crabvk/831af175eeb6fd6c5d7be28ef5cc6cca to your computer and use it in GitHub Desktop.
OpenConnect systemd service file
[Unit]
Description=OpenConnect VPN tunnel for %I
After=syslog.target network-online.target
Wants=network-online.target
[Service]
Type=forking
PrivateTmp=true
WorkingDirectory=/etc/openconnect
EnvironmentFile=/etc/openconnect/%i.env
ExecStart=/usr/bin/bash -c 'echo $PASSWORD | /usr/bin/openconnect -b --passwd-on-stdin --config %i.conf $SERVER'
CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE
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