-
Notifications
You must be signed in to change notification settings - Fork 107
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
DNS resolution not working on macOS with "bind: operation not permitted" #237
Comments
I wrote a quick test to ensure the DNS server works when it can listen properly, but it seems like 9253 isn't reachable at all on your machine. Would you mind running |
ETA: Shouldn't 9253 be a UDP socket? |
Running two copies of So, I expect # keep this one running
$ puma-dev
2020/03/26 15:41:02 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /Users/norton/.puma-dev
* Domains: test
* DNS Server port: 9253
* HTTP Server port: 9280
* HTTPS Server port: 9283
! Puma dev listening on http and https
# attempt no. 1
$ puma-dev
2020/03/26 19:42:16 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /Users/norton/.puma-dev
* Domains: test
* DNS Server port: 9253
* HTTP Server port: 9280
* HTTPS Server port: 9283
! Puma dev listening on http and https
2020/03/26 19:42:16 Error listening: listen tcp 127.0.0.1:9280: bind: address already in use
# attempt no. 2
$ puma-dev -http-port 9000 -https-port 90001
2020/03/26 19:42:48 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /Users/norton/.puma-dev
* Domains: test
* DNS Server port: 9253
* HTTP Server port: 9000
* HTTPS Server port: 90001
! Puma dev listening on http and https Also, this "works," which is disconcerting. $ puma-dev -dns-port -1
2020/03/26 20:09:00 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /Users/norton/.puma-dev
* Domains: test
* DNS Server port: -1
* HTTP Server port: 9280
* HTTPS Server port: 9283
! Puma dev listening on http and https |
@thom-nic will you try running the following? puma-dev -dns-port 32000
sudo lsof -i :32000 edit: |
Confirmed that DNS port bind will fail silently. I have a WIP branch that will expose the error messages and bail. |
For some reason when I try to run on OSX, puma-dev can't seem to bind to any HTTP/S port...?
This may be part of the root cause of the issue I'm facing. Although the HTTP bind doesn't fail when running as a launch daemon, but then again in that case HTTP/S are being forwarded via launchd socket. |
Can you bind to those ports with other user processes e.g. |
I have the same issue, the firewall is stopping |
I suspect it's because |
I can't replicate the blocked behavior on my 10.14 machine. Haven't tried on 10.15 yet. Can you run the following and report what you see?
And maybe try
|
Just for the record: it is also broken on my machine running macOS 10.14.6 (Mojave) after installing the following update from Apple:
the Didn't find much about that update from Apple, but it seems to be about blocking possibly malicious processes: https://support.apple.com/en-gb/HT207005 |
@swiknaba I'm upgrading my mojave machine w/ latest security patches now and will attempt to reproduce. For anyone who can reproduce the issue and is comfortable at the command-line, I'd ask that you try to disable gatekeeper temporarily and see if that fixes the port binding issue. That, at least, will allow us to test the unsigned hypothesis.
|
Finished latest security patches, still not having any issues with port bindings with firewall and gatekeeper enabled. |
+1 Same issue for me.
|
@NoahFisher note that you had a problem binding to HTTPS, not DNS. And, in puma-dev v0.13, issues binding to dns/https fail silently, so my guess it you weren't able to bind to any of the 3 required ports. if you can install / build from master, you'll get better error messages. Given I can't recreate this issue, having trouble debugging. Any additional diagnostic information is greatly appreciated. |
@nonrational - thanks for the reply. I just built from source and included the error output below. Is there any other information that would be helpful to provide?
|
I had a working theory that SIP is involved, but if you're getting the same issue running a binary from your home directory, that rules that out. @NoahFisher grasping at straws here, but
I'm not sure what the difference between "connection refused" and "operation not permitted" error messages are, but I suspect that every participant in this thread is having a slightly different issue. 🙃 |
@nonrational - fair point! I tried on another machine today and was not able to reproduce. I tried restarting my machine today and the issue is resolved. 🤷 Thanks for you help! |
Maddeningly, I just started getting this error in tests after upgrading to Catalina. 😡 Bright side, might be able to discover root cause, at least for the "not permitted" error. Still not sure about the "connection refused." Edit: And of course it doesn't fail when being run in a debugger. |
@nonrational I use zsh so at first I couldn't get your For those using homebrew, the binary is somewhere like this:
|
I just hit this as well, and wanted to report that the suggested firewall whitelisting worked, but only with the physical path to puma-dev (homebrew sets a symlink from sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/local/Cellar/puma-dev/0.14/bin/puma-dev
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /usr/local/Cellar/puma-dev/0.14/bin/puma-dev |
Ah. Excellent find @stevenkaras! Adding a bit of portability for new versions, since PUMA_DEV_BIN_PATH="$(brew --prefix puma/puma/puma-dev)/bin/puma-dev" # /usr/local/Cellar/puma-dev/0.14/bin/puma-dev
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add "$PUMA_DEV_BIN_PATH"
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp "$PUMA_DEV_BIN_PATH" |
I've had I've tried uninstalling (
But then in
Note that here it shows the DNS port not binding. However a bit different if I run in the foreground:
Here the HTTP port isn't binding. I have no issue binding an HTTP port e.g. with I have tried repeating all this after running this:
Didn't help. Same issue with custom ports:
Any advice or suggestions? |
After a while I also see a few lines like this in
|
And....... of course, after restarting my computer a SECOND time, it all works again. (I restarted once before posting everything above). Sorry for the noise. |
This is so much wtf. macOS just gives up after a while? (This is on macOS Ventura) Yeah, I was playing around with puma-dev, installing and uninstalling it, building from source etc. (e.g. taking #322 for a spin). I can run the Lines 51 to 75 in db9ec15
with Meanwhile, on my other macOS laptop, I just checked out puma-dev from source, built it and ran I guess I will be soon rebooting my Ventura laptop... |
Puma dev's DNS resolution doesn't appear to work at all anymore on MacOS Catalina.
I've done
puma-dev -cleanup
and even uninstalled/reinstalled from homebrew, thensudo puma-dev -setup; puma-dev -install
again.However everything looks good otherwise. Puma is running, resolver file in place, responds to HTTP but not DNS on port
Summary: HTTP proxy works, but DNS does not.
The text was updated successfully, but these errors were encountered: