-
Notifications
You must be signed in to change notification settings - Fork 951
🐛 Local network permissions when running as non-root on macOS #1460
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
Comments
I think I know what is happening: Per https://developer.apple.com/forums/thread/759955, local network permissions are not applied to processes running as root (this explains why it's working as a launch daemon).
It might require |
This issue was fixed in Go 1.24: golang/go#68678 The homebrew bottle was built with 1.22.5 and without
|
I think this is an issue on the |
Fixes cloudflare#1460. This required fixing new `go vet` findings: ``` tunnelrpc/pogs/configuration_manager.go:99:22: non-constant format string in call to fmt.Errorf tunnelrpc/pogs/session_manager.go:130:22: non-constant format string in call to fmt.Errorf ingress/ingress.go:116:20: non-constant format string in call to (*github.com/rs/zerolog.Event).Msgf ingress/origin_proxy.go:77:21: non-constant format string in call to (*github.com/rs/zerolog.Event).Msgf cmd/cloudflared/tunnel/subcommands.go:764:31: non-constant format string in call to github.com/cloudflare/cloudflared/cmd/cloudflared/cliutil.UsageError ```
Fixes cloudflare#1460. This required fixing new `go vet` findings: ``` tunnelrpc/pogs/configuration_manager.go:99:22: non-constant format string in call to fmt.Errorf tunnelrpc/pogs/session_manager.go:130:22: non-constant format string in call to fmt.Errorf ingress/ingress.go:116:20: non-constant format string in call to (*github.com/rs/zerolog.Event).Msgf ingress/origin_proxy.go:77:21: non-constant format string in call to (*github.com/rs/zerolog.Event).Msgf cmd/cloudflared/tunnel/subcommands.go:764:31: non-constant format string in call to github.com/cloudflare/cloudflared/cmd/cloudflared/cliutil.UsageError ```
@DevinCarr, I believe this bug affects a whole class of users (those who run cloudflared on macOS) and the workaround of running the service as root has negative security implications. |
Recent macOS versions require user permissions to use local network access. This can only be granted for binaries which have a LC_UUID load command. Go 1.24 adds the UUID by default, but the fix was backported to Go 1.22.9 and 1.23 where it requires passing `-B gobuildid` to the linker. Cloudflared uses Cloudflare's Go fork which is based on Go 1.22.5 which doesn't have the backport. Because of this, cloudflare can't talk to any machine on the local network (`no route to host`) when it's runnning as a non-root user. Upstream bug: cloudflare/cloudflared#1460 This workaround updates the Go fork to `go1.22.12-devel-cf` and adds `-B gobuildid` so that the binary now has a UUID: ``` ❯ dwarfdump --uuid /opt/homebrew/bin/cloudflared UUID: F2088E17-03A1-34B1-F12C-0DF01F00BA32 (arm64) /opt/homebrew/bin/cloudflared ```
Recent macOS versions require user permissions to use local network access. This can only be granted for binaries which have a LC_UUID load command. Go 1.24 adds the UUID by default, but the fix was backported to Go 1.22.9 and 1.23 where it requires passing `-B gobuildid` to the linker. Cloudflared uses Cloudflare's Go fork which is based on Go 1.22.5 which doesn't have the backport. Because of this, cloudflare can't talk to any machine on the local network (`no route to host`) when it's runnning as a non-root user. Upstream bug: cloudflare/cloudflared#1460 This workaround updates the Go fork to `go1.22.12-devel-cf` and adds `-B gobuildid` so that the binary now has a UUID: ``` ❯ dwarfdump --uuid /opt/homebrew/bin/cloudflared UUID: F2088E17-03A1-34B1-F12C-0DF01F00BA32 (arm64) /opt/homebrew/bin/cloudflared ```
Recent macOS versions require user permissions to use local network access. This can only be granted for binaries which have a LC_UUID load command. Go 1.24 adds the UUID by default, but the fix was backported to Go 1.22.9 and 1.23 where it requires passing `-B gobuildid` to the linker. Cloudflared uses Cloudflare's Go fork which is based on Go 1.22.5 which doesn't have the backport. Because of this, cloudflare can't talk to any machine on the local network (`no route to host`) when it's runnning as a non-root user. Upstream bug: cloudflare/cloudflared#1460 This workaround updates the Go fork to `go1.22.12-devel-cf` and adds `-B gobuildid` so that the binary now has a UUID: ``` ❯ dwarfdump --uuid /opt/homebrew/bin/cloudflared UUID: F2088E17-03A1-34B1-F12C-0DF01F00BA32 (arm64) /opt/homebrew/bin/cloudflared ```
Recent macOS versions require user permissions to access the local network. This can only be granted for binaries which have a LC_UUID load command. Go 1.24 adds the UUID by default, but the fix was backported to Go 1.22.9 and 1.23 where it requires passing `-B gobuildid` to the linker. cloudflared uses Cloudflare's Go fork which is based on Go 1.22.5 and doesn't have the backport. Because of this, cloudflared can't talk to any machine on the local network (no route to host) when it's runnning as a non-root user. This workaround updates the Go fork to go1.22.12-devel-cf and adds `-B gobuildid` so that the binary now has a UUID: ``` ❯ dwarfdump --uuid /opt/homebrew/bin/cloudflared UUID: F2088E17-03A1-34B1-F12C-0DF01F00BA32 (arm64) /opt/homebrew/bin/cloudflared ``` Fixes cloudflare#1460
Recent macOS versions require user permissions to access the local network. This can only be granted for binaries which have a LC_UUID load command. Go 1.24 adds the UUID by default, but the fix was backported to Go 1.22.9 and 1.23 where it requires passing `-B gobuildid` to the linker. cloudflared uses Cloudflare's Go fork which is based on Go 1.22.5 and doesn't have the backport. Because of this, cloudflared can't talk to any machine on the local network (no route to host) when it's runnning as a non-root user. This workaround updates the Go fork to go1.22.12-devel-cf and adds `-B gobuildid` so that the binary now has a UUID: ``` ❯ dwarfdump --uuid /opt/homebrew/bin/cloudflared UUID: F2088E17-03A1-34B1-F12C-0DF01F00BA32 (arm64) /opt/homebrew/bin/cloudflared ``` Fixes cloudflare#1460
Recent macOS versions require user permissions to access the local network. This can only be granted for binaries which have a LC_UUID load command. Go 1.24 adds the UUID by default, but the fix was backported to Go 1.22.9 and 1.23 where it requires passing `-B gobuildid` to the linker. cloudflared uses Cloudflare's Go fork which is based on Go 1.22.5 and doesn't have the backport. Because of this, cloudflared can't talk to any machine on the local network (no route to host) when it's runnning as a non-root user. This workaround updates the Go fork to go1.22.12-devel-cf and adds `-B gobuildid` so that the binary now has a UUID: ``` ❯ dwarfdump --uuid /opt/homebrew/bin/cloudflared UUID: F2088E17-03A1-34B1-F12C-0DF01F00BA32 (arm64) /opt/homebrew/bin/cloudflared ``` Fixes cloudflare#1460
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
When I run
cloudflared
as a non-root user, installed withcloudflared service install
, it can't access any backend service in the local network. Each access results in a log entry like this:Any backend on the localhost is accessible, so the tunnel is working overall.
There are no network issues and I can reach this IP just from the host. After
launchctl unload ~/Library/LaunchAgents/com.cloudflare.cloudflared.plist
andsudo cloudflared service install
, the same cloudflared binary with the same command line arguments is able to serve the backends on the local network.To Reproduce
Steps to reproduce the behavior:
cloudflared
to run as a local userlaunchctl bootstrap gui/501 ~/Library/LaunchAgents/com.cloudflare.cloudflared.plist
to start itExpected behavior
I expect
cloudflared
to behave identically when run asroot
or a different user.Environment and versions
Logs and errors
See above
Additional context
When debugging the issue over Apple Remote Desktop, I got a popup asking whether
cloudflared
should be allowed local network access. I clicked "yes" and verified that/opt/homebrew/Cellar/cloudflared/2025.4.2/bin/cloudflared
is enabled in System Preferences / Privacy & Security / Local Network.I assume this is related to macOS's security mechanisms.
The text was updated successfully, but these errors were encountered: