diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/examples/launchd/README | 12 | ||||
-rw-r--r-- | contrib/examples/launchd/com.wireguard.wg0.plist | 25 | ||||
-rw-r--r-- | contrib/examples/nat-hole-punching/README | 4 | ||||
-rwxr-xr-x | contrib/examples/reresolve-dns/reresolve-dns.sh | 2 |
4 files changed, 40 insertions, 3 deletions
diff --git a/contrib/examples/launchd/README b/contrib/examples/launchd/README new file mode 100644 index 0000000..67f8d3c --- /dev/null +++ b/contrib/examples/launchd/README @@ -0,0 +1,12 @@ +WireGuard for Launchd +===================== + +The example `com.wireguard.wg0.plist` file may be used for running wg-quick(8) +as a launchd service. Note that the `PATH` variable is modified to point to +the PATH used by Homebrew or Macports, so that it uses the non-system bash(1). + +Usage +----- + +$ sudo cp com.wireguard.wg0.plist /Library/LaunchDaemons +$ sudo launchctl load /Library/LaunchDaemons/com.wireguard.wg0.plist diff --git a/contrib/examples/launchd/com.wireguard.wg0.plist b/contrib/examples/launchd/com.wireguard.wg0.plist new file mode 100644 index 0000000..9fc0141 --- /dev/null +++ b/contrib/examples/launchd/com.wireguard.wg0.plist @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";> +<plist version="1.0"> +<dict> + <key>Label</key> + <string>com.wireguard.wg0</string> + <key>ProgramArguments</key> + <array> + <string>/usr/local/bin/wg-quick</string> + <string>up</string> + <string>/usr/local/etc/wireguard/wg0.conf</string> + </array> + <key>OnDemand</key> + <false/> + <key>RunAtLoad</key> + <true/> + <key>TimeOut</key> + <integer>90</integer> + <key>EnvironmentVariables</key> + <dict> + <key>PATH</key> + <string>/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string> + </dict> +</dict> +</plist> diff --git a/contrib/examples/nat-hole-punching/README b/contrib/examples/nat-hole-punching/README index 46e6201..99c20e5 100644 --- a/contrib/examples/nat-hole-punching/README +++ b/contrib/examples/nat-hole-punching/README @@ -9,8 +9,8 @@ Compile with: Server is 1.2.3.4 and is on the public internet accepting UDP:49918. -Client A is NAT'd and doesnt't know its IP address. -Client B is NAT'd and doesnt't know its IP address. +Client A is NAT'd and doesn't know its IP address. +Client B is NAT'd and doesn't know its IP address. Server runs: diff --git a/contrib/examples/reresolve-dns/reresolve-dns.sh b/contrib/examples/reresolve-dns/reresolve-dns.sh index e579f86..8ab3635 100755 --- a/contrib/examples/reresolve-dns/reresolve-dns.sh +++ b/contrib/examples/reresolve-dns/reresolve-dns.sh @@ -15,7 +15,7 @@ INTERFACE="${BASH_REMATCH[1]}" process_peer() { [[ $PEER_SECTION -ne 1 || -z $PUBLIC_KEY || -z $ENDPOINT ]] && return 0 - [[ $(wg show "$INTERFACE" latest-handshakes) =~ ^${PUBLIC_KEY//+/\\+}\ ([0-9]+)$ ]] || return 0 + [[ $(wg show "$INTERFACE" latest-handshakes) =~ ${PUBLIC_KEY//+/\\+}\ ([0-9]+) ]] || return 0 (( ($(date +%s) - ${BASH_REMATCH[1]}) > 135 )) || return 0 wg set "$INTERFACE" peer "$PUBLIC_KEY" endpoint "$ENDPOINT" reset_peer_section |