-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: add macosx-firwall script to avoid popups
Currently, there are a number of popups that get displayed when running the tests asking to accept incoming network connections. Rules can be added manually to the socket firewall on Mac OS X but getting this right might not be obvious and quite a lot of time can be wasted trying to get the rules right. This script hopes to simplify things a little so that it can be re-run when needed. The script should be runnable from both the projects root directory and from the tools directory, for example: $ sudo ./tools/macosx-firewall.sh Fixes: #8911 PR-URL: #10114 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
- Loading branch information
1 parent
3a460d5
commit cc5bd9a
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
# Script that adds rules to Mac OS X Socket Firewall to avoid | ||
# popups asking to accept incoming network connections when | ||
# running tests. | ||
SFW="/usr/libexec/ApplicationFirewall/socketfilterfw" | ||
TOOLSDIR="`dirname \"$0\"`" | ||
TOOLSDIR="`( cd \"$TOOLSDIR\" && pwd) `" | ||
ROOTDIR="`( cd \"$TOOLSDIR/..\" && pwd) `" | ||
OUTDIR="$TOOLSDIR/../out" | ||
# Using cd and pwd here so that the path used for socketfilterfw does not | ||
# contain a '..', which seems to cause the rules to be incorrectly added | ||
# and they are not removed when this script is re-run. Instead the new | ||
# rules are simply appended. By using pwd we can get the full path | ||
# without '..' and things work as expected. | ||
OUTDIR="`( cd \"$OUTDIR\" && pwd) `" | ||
NODE_RELEASE="$OUTDIR/Release/node" | ||
NODE_DEBUG="$OUTDIR/Debug/node" | ||
NODE_LINK="$ROOTDIR/node" | ||
CCTEST_RELEASE="$OUTDIR/Release/cctest" | ||
CCTEST_DEBUG="$OUTDIR/Debug/cctest" | ||
|
||
if [ -f $SFW ]; | ||
then | ||
# Duplicating these commands on purpose as the symbolic link node might be | ||
# linked to either out/Debug/node or out/Release/node depending on the | ||
# BUILDTYPE. | ||
$SFW --remove "$NODE_DEBUG" | ||
$SFW --remove "$NODE_DEBUG" | ||
$SFW --remove "$NODE_RELEASE" | ||
$SFW --remove "$NODE_RELEASE" | ||
$SFW --remove "$NODE_LINK" | ||
$SFW --remove "$CCTEST_DEBUG" | ||
$SFW --remove "$CCTEST_RELEASE" | ||
|
||
$SFW --add "$NODE_DEBUG" | ||
$SFW --add "$NODE_RELEASE" | ||
$SFW --add "$NODE_LINK" | ||
$SFW --add "$CCTEST_DEBUG" | ||
$SFW --add "$CCTEST_RELEASE" | ||
|
||
$SFW --unblock "$NODE_DEBUG" | ||
$SFW --unblock "$NODE_RELEASE" | ||
$SFW --unblock "$NODE_LINK" | ||
$SFW --unblock "$CCTEST_DEBUG" | ||
$SFW --unblock "$CCTEST_RELEASE" | ||
else | ||
echo "SocketFirewall not found in location: $SFW" | ||
fi |