Skip to content

Commit 2dc5f6e

Browse files
committed
TUN-5549: Revert "TUN-5277: Ensure cloudflared binary is FIPS compliant on linux amd64"
This reverts commit 157f5d1. FIPS compliant binaries (for linux/amd64) are causing HTTPS origins to not be reachable by cloudflared in certain cases (e.g. with Let's Encrypt certificates). Origins that are not HTTPS for cloudflared are not affected.
1 parent 8d41f99 commit 2dc5f6e

File tree

5 files changed

+34
-53
lines changed

5 files changed

+34
-53
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
**Experimental**: This is a new format for release notes. The format and availability is subject to change.
22

3+
## 2021.12.1
4+
### Bug Fixe
5+
- Fixes Github issue #530 where cloudflared 2021.12.0 could not reach origins that were HTTPS and using certain encryption methods forbidden by FIPS compliance (such as Let's Encrypt certificates). To address this fix we have temporarily reverted FIPS compliance from amd64 linux binaries that was recently introduced (or fixed actually as it was never working before).
6+
37
## 2021.12.0
48
### New Features
59
- Cloudflared binary released for amd64 linux is now FIPS compliant.

Makefile

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ MSI_VERSION := $(shell git tag -l --sort=v:refname | grep "w" | tail -1 | cut
33
#MSI_VERSION expects the format of the tag to be: (wX.X.X). Starts with the w character to not break cfsetup.
44
#e.g. w3.0.1 or w4.2.10. It trims off the w character when creating the MSI.
55

6+
ifeq ($(FIPS), true)
7+
GO_BUILD_TAGS := $(GO_BUILD_TAGS) fips
8+
endif
9+
10+
ifneq ($(GO_BUILD_TAGS),)
11+
GO_BUILD_TAGS := -tags $(GO_BUILD_TAGS)
12+
endif
13+
614
ifeq ($(NIGHTLY), true)
715
DEB_PACKAGE_NAME := cloudflared-nightly
816
NIGHTLY_FLAGS := --conflicts cloudflared --replaces cloudflared
@@ -11,19 +19,7 @@ else
1119
endif
1220

1321
DATE := $(shell date -u '+%Y-%m-%d-%H%M UTC')
14-
VERSION_FLAGS := -X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"
15-
16-
LINK_FLAGS :=
17-
ifeq ($(FIPS), true)
18-
LINK_FLAGS := -linkmode=external -extldflags=-static $(LINK_FLAGS)
19-
# Prevent linking with libc regardless of CGO enabled or not.
20-
GO_BUILD_TAGS := $(GO_BUILD_TAGS) osusergo netgo fips
21-
endif
22-
23-
LDFLAGS := -ldflags='$(VERSION_FLAGS) $(LINK_FLAGS)'
24-
ifneq ($(GO_BUILD_TAGS),)
25-
GO_BUILD_TAGS := -tags "$(GO_BUILD_TAGS)"
26-
endif
22+
VERSION_FLAGS := -ldflags='-X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"'
2723

2824
IMPORT_PATH := github.com/cloudflare/cloudflared
2925
PACKAGE_DIR := $(CURDIR)/packaging
@@ -84,15 +80,17 @@ clean:
8480
go clean
8581

8682
.PHONY: cloudflared
87-
cloudflared:
83+
cloudflared:
8884
ifeq ($(FIPS), true)
8985
$(info Building cloudflared with go-fips)
90-
cp -f fips/fips.go.linux-amd64 cmd/cloudflared/fips.go
86+
-test -f fips/fips.go && mv fips/fips.go fips/fips.go.linux-amd64
87+
mv fips/fips.go.linux-amd64 fips/fips.go
9188
endif
92-
GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) go build -v -mod=vendor $(GO_BUILD_TAGS) $(LDFLAGS) $(IMPORT_PATH)/cmd/cloudflared
89+
90+
GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) go build -v -mod=vendor $(GO_BUILD_TAGS) $(VERSION_FLAGS) $(IMPORT_PATH)/cmd/cloudflared
91+
9392
ifeq ($(FIPS), true)
94-
rm -f cmd/cloudflared/fips.go
95-
./check-fips.sh cloudflared
93+
mv fips/fips.go fips/fips.go.linux-amd64
9694
endif
9795

9896
.PHONY: container
@@ -102,10 +100,10 @@ container:
102100
.PHONY: test
103101
test: vet
104102
ifndef CI
105-
go test -v -mod=vendor -race $(LDFLAGS) ./...
103+
go test -v -mod=vendor -race $(VERSION_FLAGS) ./...
106104
else
107105
@mkdir -p .cover
108-
go test -v -mod=vendor -race $(LDFLAGS) -coverprofile=".cover/c.out" ./...
106+
go test -v -mod=vendor -race $(VERSION_FLAGS) -coverprofile=".cover/c.out" ./...
109107
go tool cover -html ".cover/c.out" -o .cover/all.html
110108
endif
111109

@@ -249,8 +247,8 @@ tunnelrpc-deps:
249247
capnp compile -ogo tunnelrpc/tunnelrpc.capnp
250248

251249
.PHONY: quic-deps
252-
quic-deps:
253-
which capnp
250+
quic-deps:
251+
which capnp
254252
which capnpc-go
255253
capnp compile -ogo quic/schema/quic_metadata_protocol.capnp
256254

@@ -260,9 +258,9 @@ vet:
260258
# go get github.com/sudarshan-reddy/go-sumtype (don't do this in build directory or this will cause vendor issues)
261259
# Note: If you have github.com/BurntSushi/go-sumtype then you might have to use the repo above instead
262260
# for now because it uses an older version of golang.org/x/tools.
263-
which go-sumtype
261+
which go-sumtype
264262
go-sumtype $$(go list -mod=vendor ./...)
265263

266264
.PHONY: goimports
267265
goimports:
268-
for d in $$(go list -mod=readonly -f '{{.Dir}}' -a ./... | fgrep -v tunnelrpc) ; do goimports -format-only -local github.com/cloudflare/cloudflared -w $$d ; done
266+
for d in $$(go list -mod=readonly -f '{{.Dir}}' -a ./... | fgrep -v tunnelrpc) ; do goimports -format-only -local github.com/cloudflare/cloudflared -w $$d ; done

build-packages.sh

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
VERSION=$(git describe --tags --always --dirty="-dev" --match "[0-9][0-9][0-9][0-9].*.*")
22
echo $VERSION
3-
4-
# Avoid depending on C code since we don't need it.
53
export CGO_ENABLED=0
6-
74
# This controls the directory the built artifacts go into
85
export ARTIFACT_DIR=built_artifacts/
96
mkdir -p $ARTIFACT_DIR
107
windowsArchs=("amd64" "386")
118
export TARGET_OS=windows
12-
for arch in ${windowsArchs[@]}; do
9+
for arch in ${windowsArchs[@]}; do
1310
export TARGET_ARCH=$arch
1411
make cloudflared-msi
1512
mv ./cloudflared.exe $ARTIFACT_DIR/cloudflared-windows-$arch.exe
1613
mv cloudflared-$VERSION-$arch.msi $ARTIFACT_DIR/cloudflared-windows-$arch.msi
1714
done
1815

1916

20-
# amd64 is last because we override settings for it
21-
linuxArchs=("386" "arm" "arm64" "amd64")
17+
export FIPS=true
18+
linuxArchs=("amd64" "386" "arm" "arm64")
2219
export TARGET_OS=linux
23-
for arch in ${linuxArchs[@]}; do
24-
if [ "${arch}" = "amd64" ]; then
25-
export FIPS=true
26-
# For BoringCrypto to link, we need CGO enabled. Otherwise compilation fails.
27-
export CGO_ENABLED=1
28-
fi
20+
for arch in ${linuxArchs[@]}; do
2921
export TARGET_ARCH=$arch
3022
make cloudflared-deb
3123
mv cloudflared\_$VERSION\_$arch.deb $ARTIFACT_DIR/cloudflared-linux-$arch.deb
3224

33-
# rpm packages invert the - and _ and use x86_64 instead of amd64.
25+
# rpm packages invert the - and _ and use x86_64 instead of amd64.
3426
RPMVERSION=$(echo $VERSION|sed -r 's/-/_/g')
3527
RPMARCH=$arch
3628
if [ $arch == "amd64" ];then
@@ -45,3 +37,4 @@ for arch in ${linuxArchs[@]}; do
4537
# finally move the linux binary as well.
4638
mv ./cloudflared $ARTIFACT_DIR/cloudflared-linux-$arch
4739
done
40+

cfsetup.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pinned_go: &pinned_go go=1.17-1
2-
pinned_go_fips: &pinned_go_fips go-boring=1.16.6-7
2+
pinned_go_fips: &pinned_go_fips go-boring=1.16.6-6
33

44
build_dir: &build_dir /cfsetup_build
55
default-flavor: buster
@@ -41,6 +41,7 @@ stretch: &stretch
4141
- wget https://github.com/sudarshan-reddy/msitools/releases/download/v0.101b/wixl -P /usr/local/bin
4242
- chmod a+x /usr/local/bin/wixl
4343
post-cache:
44+
- export FIPS=true
4445
- ./build-packages.sh
4546
github-release-pkgs:
4647
build_dir: *build_dir

check-fips.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)