Bug restarting WireGuard using launchd on macOS
Alessio Nossa
alessio.nossa+list at gmail.com
Mon Jun 20 20:51:54 UTC 2022
Hello,
I am running WireGuard (installed with wireguard-tools, using
HomeBrew) on macOS 12.4, launched using launchd. All works fine until
I try to restart it, always with launchd.
When WireGuard interface is restarted, it looks like it crashes/gets
deactivated immediately: if I run 'wg show' nothing is displayed, but
on the "server" peer I can see that the "Latest handshake" report the
time elapsed since last "com.example.wg.restartWg.plist" execution.
The launchd configurations, that I saved at "/Library/LaunchDaemons/"
are available at
https://gist.github.com/alessionossa/78f69b9451a130240e2057acbd4eb7f8
The log at "/tmp/com.example.wg.restartWg.err" of is
06/20/22 21:51:18
[+] Interface for wg1 is utun0
[#] rm -f /var/run/wireguard/utun0.sock
[#] rm -f /var/run/wireguard/wg1.name
--- Restarting... ---
[#] wireguard-go utun
[+] Interface for wg1 is utun0
[#] wg setconf utun0 /dev/fd/63
[#] ifconfig utun0 inet 10.181.0.5/32 10.181.0.5 alias
[#] ifconfig utun0 up
[#] route -q -n add -inet 10.181.0.3/32 -interface utun0
[#] route -q -n add -inet 10.181.0.254/32 -interface utun0
[#] route -q -n add -inet 10.181.0.11/32 -interface utun0
[+] Backgrounding route monitor
--- Restarted! ---
06/20/22 21:56:20
wg-quick: `wg1' is not a WireGuard interface
--- Restarting... ---
[#] wireguard-go utun
[+] Interface for wg1 is utun0
[#] wg setconf utun0 /dev/fd/63
[#] ifconfig utun0 inet 10.181.0.5/32 10.181.0.5 alias
[#] ifconfig utun0 up
[#] route -q -n add -inet 10.181.0.3/32 -interface utun0
[#] route -q -n add -inet 10.181.0.254/32 -interface utun0
[#] route -q -n add -inet 10.181.0.11/32 -interface utun0
[+] Backgrounding route monitor
If some more Information is needed to debug the issue, I am available.
Best regards,
Alessio Nossa
More information about the WireGuard
mailing list