Last active
August 1, 2019 20:15
-
-
Save boichee/34739c360bc2aa3b97f81adb51ec59de to your computer and use it in GitHub Desktop.
A shell function for macOS that allows mosh-server to send/receive traffic without having to deactivate the firewall
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mosh Server on macOS Mojave is blocked by the packet filter. | |
# Modifying the pf.conf for pfctl is not enough to make it work. | |
# The following function does, however, seem to allow the necessary | |
# traffic to pass through the firewall | |
fix_mosh_server() { ✔ 10037 13:10:10 | |
local fw='/usr/libexec/ApplicationFirewall/socketfilterfw' | |
local mosh_sym="$(which mosh-server)" | |
local mosh_abs="$(greadlink -f $mosh_sym)" | |
sudo "$fw" --setglobalstate off | |
sudo "$fw" --add "$mosh_sym" | |
sudo "$fw" --unblockapp "$mosh_sym" | |
sudo "$fw" --add "$mosh_abs" | |
sudo "$fw" --unblockapp "$mosh_abs" | |
sudo "$fw" --setglobalstate on | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment