-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools: add macosx-firewall script to avoid popups #10114
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7a5201d
tools: add macosx-firwall script to avoid popups
danbev c39bf95
fix long line
danbev d255df9
quote variables to allow for paths with spaces
danbev e546655
add comment explaining the usage of cd and pwd
danbev 4f29ee5
show usage os running the script
danbev 46ad909
fix lone line
danbev cef43de
add cctest to firewall script
danbev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) `" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a comment explaining the use of pwd (what you wrote in your comment earlier)? |
||
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the cd + pwd to ensure the directory exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is really so that the path added is the full path without the
..
in it. This is what is displayed when the command is run (if using..
in that path that is):But the entry when running
/usr/libexec/ApplicationFirewall/socketfilterfw --listapps
shows up without the path. Running the script again will not remove these paths, instead the new rules will just be added and the list will grow. But with the full path (without..
) it works as expected and the rules are removed and added properly.