Skip to content

Commit ae86590

Browse files
committed
cloudflared: add build UUID
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 ```
1 parent c8e1aad commit ae86590

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Formula/c/cloudflared.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ class Cloudflared < Formula
1818
depends_on "go" => :build
1919

2020
def install
21+
# https://github.com/cloudflare/cloudflared/issues/1460
22+
# build with newer Go version to pick up the backported "-B gobuildid" flag
23+
inreplace ".teamcity/install-cloudflare-go.sh", "af19da5605ca11f85776ef7af3384a02a315a52b", "37bc41c6ff79507200a315b72834fce6ca427a7e"
2124
system "make", "install",
2225
"VERSION=#{version}",
2326
"DATE=#{time.iso8601}",
2427
"PACKAGE_MANAGER=#{tap.user}",
25-
"PREFIX=#{prefix}"
28+
"PREFIX=#{prefix}",
29+
"LDFLAGS=-ldflags='-B gobuildid -X \"main.Version=#{version}\" -X \"main.BuildTime=#{time.iso8601}\"'"
2630
end
2731

2832
service do

0 commit comments

Comments
 (0)