Skip to content

Instantly share code, notes, and snippets.

@yurrriq
Forked from ashgillman/openconnect_wrapper
Created April 25, 2019 02:00
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 yurrriq/c0b7f3f9f38bc3f5483b945d898f79a0 to your computer and use it in GitHub Desktop.
Save yurrriq/c0b7f3f9f38bc3f5483b945d898f79a0 to your computer and use it in GitHub Desktop.
openconnect launchd
#!/bin/bash
# /etc/openconnect_wrapper
# swap out SIGTERM for openconnect-friendly SIGINT
_term() {
kill -INT "$child" 2>/dev/null
}
trap _term SIGTERM
cat | /usr/local/bin/openconnect "$@" &
child=$!
wait "$child"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key> <true/>
<key>Label</key> <string>vpn.openconnect</string>
<key>StandardInPath</key> <string>/etc/vpn_secret</string>
<key>RunAtLoad</key> <true/>
<key>ProgramArguments</key>
<array>
<string>/etc/openconnect_wrapper</string>
<string>--authgroup=__AUTHGROUP__</string>
<string>--user=__USER__</string>
<string>__VPN_URL__</string>
</array>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment