Skip to content

Instantly share code, notes, and snippets.

@ssoriche
Created October 3, 2018 13:04
Show Gist options
  • Save ssoriche/92a0315ccc453702c2f8190756e3d3c6 to your computer and use it in GitHub Desktop.
Save ssoriche/92a0315ccc453702c2f8190756e3d3c6 to your computer and use it in GitHub Desktop.
When running macOS firewall and wireguard installed from home-brew, the following script will open the firewall. Run after installation and every upgrade of `wireguard-tools` as the path to `wg-quick` will change.
#!/bin/bash
fix_wireguard() {
local fw='/usr/libexec/ApplicationFirewall/socketfilterfw'
local wg_sym="$(which wg-quick)"
local wg_abs="$(greadlink -f $wg_sym)"
sudo "$fw" --setglobalstate off
sudo "$fw" --add "$wg_sym"
sudo "$fw" --unblockapp "$wg_sym"
sudo "$fw" --add "$wg_abs"
sudo "$fw" --unblockapp "$wg_abs"
sudo "$fw" --setglobalstate on
}
fix_wireguard;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment