Skip to content

Commit 79ab312

Browse files
committed
Add build UUID
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
1 parent 40dc601 commit 79ab312

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.teamcity/install-cloudflare-go.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
cd /tmp
44
git clone -q https://github.com/cloudflare/go
55
cd go/src
6-
# https://github.com/cloudflare/go/tree/af19da5605ca11f85776ef7af3384a02a315a52b is version go1.22.5-devel-cf
7-
git checkout -q af19da5605ca11f85776ef7af3384a02a315a52b
6+
# https://github.com/cloudflare/go/tree/37bc41c6ff79507200a315b72834fce6ca427a7e is version go1.22.12-devel-cf
7+
git checkout -q 37bc41c6ff79507200a315b72834fce6ca427a7e
88
./make.bash

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ifeq ($(FIPS), true)
4242
VERSION_FLAGS := $(VERSION_FLAGS) -X "main.BuildType=FIPS"
4343
endif
4444

45-
LDFLAGS := -ldflags='$(VERSION_FLAGS) $(LINK_FLAGS)'
45+
LDFLAGS := -ldflags='$(VERSION_FLAGS) $(LINK_FLAGS) -B gobuildid'
4646
ifneq ($(GO_BUILD_TAGS),)
4747
GO_BUILD_TAGS := -tags "$(GO_BUILD_TAGS)"
4848
endif

0 commit comments

Comments
 (0)