Skip to content
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

OSX Firewall is pedantic with unsigned executables #199

Closed
gcochard opened this issue Oct 17, 2014 · 4 comments
Closed

OSX Firewall is pedantic with unsigned executables #199

gcochard opened this issue Oct 17, 2014 · 4 comments

Comments

@gcochard
Copy link

Is it possible to grab signed binaries so the OSX firewall won't freak out every time an app tries to listen as a server? The installer served by nodejs.org include signed binaries, while the binaries in the binary archives are not signed.

Not sure if this is an issue with n or if joyent needs to fix this.

@tjwebb tjwebb closed this as completed Oct 18, 2014
@gcochard
Copy link
Author

Essentially, if I install node via the installer on nodejs.org, I can start a server in node without the OSX firewall complaining. If I use n to switch to a different version, it is using an unsigned binary and thus the OSX firewall will ask to allow connections every time I try to bind to a port.

If it is possible for n to download and install signed binaries, this would fix the problem. Looking through the n source, it seems like this is not a trivial change so the only other solution is for joyent to sign the binaries distributed in .tar.gz format.

@tjwebb
Copy link
Collaborator

tjwebb commented Oct 18, 2014

I can start a server in node

I do not know what this means. I'm not sure why your OS would complain unless you're trying to bind to a privileged port, such as port 80, which you should never, ever do with node.js for any reason.

If you can give me more info about what change is needed in the n script, or submit a PR, I can look into this further.

@gcochard
Copy link
Author

It's a new feature in OSX. If the firewall is turned on, it will prompt for each binary that tries to bind a port. If the binary is signed, it remember the rule. If the binary is unsigned, it asks each time. Doesn't need to be a privileged port.

Here is a code sample that triggers the behavior.

var http = require('http');
var server = http.createServer(function(req,res){
    res.writeHead(200,'text/plain');
    res.end('hello world');
});
server.listen(9999);

Here's some bash code to get at the nodejs files packed in the OSX installer .pkg file:

# expand the pkg file
pkgutil --expand node-v0.10.31.pkg /tmp/node-v0.10.31
# get at local.pkg which is the nodejs archive
cd /tmp/node-v0.10.31/local.pkg/
# gunzip and pipe to cpio
cat Payload | gzip -d | cpio -id
# payload has same directory structure as tarball

Assumptions: pkgutil is installed on the target system. I am not sure if this is installed in a base system or if it requires xcode's command line tools to be installed.

@gcochard
Copy link
Author

I will submit a PR.

gcochard added a commit to gcochard/n that referenced this issue Oct 20, 2014
Mac os's firewall can be a pain when unsigned binaries want to
listen to ports (privileged or not) and will not remember firewall
permissions for the unsigned binary. This commit addresses the issue
by downloading the `.pkg` file from nodejs.org and unpacking it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants