-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow building fips-compliant binaries for linux,mac & windows for bo…
…th sync & proxy
- Loading branch information
1 parent
779ab29
commit fe6882b
Showing
7 changed files
with
141 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,3 +70,7 @@ build/* | |
split-proxy | ||
split-sync | ||
/clilist | ||
|
||
windows/downloads | ||
windows/unpacked | ||
windows/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
CURRENT_PATH := $(shell pwd) | ||
PARENT_PATH := $(shell dirname $(CURRENT_PATH)) | ||
DOWNLOAD_FOLDER := $(CURRENT_PATH)/downloads | ||
UNPACK_FOLDER := $(CURRENT_PATH)/unpacked | ||
BIN_FOLDER := $(CURRENT_PATH)/unpacked/go/bin | ||
BUILD_FOLDER := $(CURRENT_PATH)/build | ||
|
||
|
||
GO := $(BIN_FOLDER)/go | ||
ASSET ?= go1.21.linux-amd64.tar.gz | ||
SOURCES := $(shell find $(PARENT_PATH) -path $(dirname $(pwd))/windows -prune -o -name "*.go" -print) \ | ||
$(PARENT_PATH)/go.mod \ | ||
$(PARENT_PATH)/go.sum | ||
|
||
.PHONY: clean setup_ms_go | ||
|
||
default: help | ||
|
||
## remove all downloaded/unpacked/generated files | ||
clean: | ||
rm -Rf downloads unpacked build | ||
|
||
## download and setup a ms-patched version of go which is fips-compliant for windows | ||
setup_ms_go: $(UNPACK_FOLDER)/go | ||
|
||
## build fips-compliant split-proxy && split-sync | ||
binaries: $(BUILD_FOLDER)/split-proxy-fips.exe $(BUILD_FOLDER)/split-sync-fips.exe | ||
|
||
|
||
# -------- | ||
|
||
|
||
$(DOWNLOAD_FOLDER)/go1.21.linux-amd64.tar.gz: | ||
mkdir -p $(DOWNLOAD_FOLDER) | ||
wget https://aka.ms/golang/release/latest/$(ASSET) --directory-prefix $(DOWNLOAD_FOLDER) | ||
wget https://aka.ms/golang/release/latest/$(ASSET).sha256 --directory-prefix $(DOWNLOAD_FOLDER) | ||
# TODO(mredolatti): validate SUM | ||
|
||
$(UNPACK_FOLDER)/go: $(DOWNLOAD_FOLDER)/$(ASSET) | ||
mkdir -p $(UNPACK_FOLDER) | ||
tar xvzf $(DOWNLOAD_FOLDER)/$(ASSET) --directory $(UNPACK_FOLDER) | ||
|
||
$(BUILD_FOLDER)/split-proxy-fips.exe: $(GO) $(SOURCES) | ||
mkdir -p $(BUILD_FOLDER) | ||
GOOS=windows GOEXPERIMENT=cngcrypto $(GO) build -tags=enforce_fips -o $@ $(PARENT_PATH)/cmd/proxy/main.go | ||
|
||
$(BUILD_FOLDER)/split-sync-fips.exe: $(GO) $(SOURCES) | ||
mkdir -p $(BUILD_FOLDER) | ||
GOOS=windows GOEXPERIMENT=cngcrypto $(GO) build -tags=enforce_fips -o $@ $(PARENT_PATH)/cmd/synchronizer/main.go | ||
|
||
# Help target borrowed from: https://docs.cloudposse.com/reference/best-practices/make-best-practices/ | ||
## This help screen | ||
help: | ||
@printf "Available targets:\n\n" | ||
@awk '/^[a-zA-Z\-\_0-9%:\\]+/ { \ | ||
helpMessage = match(lastLine, /^## (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = $$1; \ | ||
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | ||
gsub("\\\\", "", helpCommand); \ | ||
gsub(":+$$", "", helpCommand); \ | ||
printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \ | ||
} \ | ||
} \ | ||
{ lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u | ||
@printf "\n" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
docker build -t sync_fips_win_builder -f ./macos_builder.Dockerfile . | ||
docker run --rm -v $(dirname $(pwd)):/buildenv sync_fips_win_builder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
cd buildenv/windows | ||
make setup_ms_go binaries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM debian:bookworm | ||
|
||
RUN apt update -y | ||
RUN apt install -y build-essential ca-certificates | ||
RUN update-ca-certificates | ||
|
||
COPY ./entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |