mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
ci: use strings instead of nm for FIPS OpenSSL verification
Replace `go tool nm` with `strings` for verifying OpenSSL integration in FIPS builds. `go tool nm` reads the static symbol table (.symtab), which is stripped by the `-s` linker flag added in this branch for release size optimization. `strings` works on stripped binaries because Go embeds function names in runtime.pclntab (used for stack traces and panic output), which is preserved regardless of `-s -w` flags. The verification is checking for the same Go-side cgo wrapper functions (go_openssl_OpenSSL_version, mkcgo_OpenSSL_version) — just reading them from a different location. Background: GOEXPERIMENT=systemcrypto uses dlopen() to load libcrypto at runtime, so OpenSSL does not appear in ELF dynamic sections. The only way to verify the OpenSSL backend is wired in is to check for the Go wrapper functions compiled into the binary. Co-authored-by: Claude <claude@anthropic.com>
This commit is contained in:
parent
ddb331c82b
commit
2f55bb2380
1 changed files with 4 additions and 4 deletions
|
|
@ -14,10 +14,10 @@ ifeq ($(FIPS_ENABLED),true)
|
|||
@echo Verifying Build Linux amd64 for FIPS
|
||||
$(GO) version -m $(GOBIN)/$(MM_BIN_NAME) | grep -q "GOEXPERIMENT=systemcrypto" || (echo "ERROR: FIPS mattermost binary missing GOEXPERIMENT=systemcrypto" && exit 1)
|
||||
$(GO) version -m $(GOBIN)/$(MM_BIN_NAME) | grep "\-tags" | grep -q "requirefips" || (echo "ERROR: FIPS mattermost binary missing -tags=requirefips" && exit 1)
|
||||
$(GO) tool nm $(GOBIN)/$(MM_BIN_NAME) | grep -qE "func_go_openssl_OpenSSL_version|_mkcgo_OpenSSL_version" || (echo "ERROR: FIPS mattermost binary missing OpenSSL integration" && exit 1)
|
||||
strings $(GOBIN)/$(MM_BIN_NAME) | grep -qE "go_openssl_OpenSSL_version|mkcgo_OpenSSL_version" || (echo "ERROR: FIPS mattermost binary missing OpenSSL integration" && exit 1)
|
||||
$(GO) version -m $(GOBIN)/$(MMCTL_BIN_NAME) | grep -q "GOEXPERIMENT=systemcrypto" || (echo "ERROR: FIPS mmctl binary missing GOEXPERIMENT=systemcrypto" && exit 1)
|
||||
$(GO) version -m $(GOBIN)/$(MMCTL_BIN_NAME) | grep "\-tags" | grep -q "requirefips" || (echo "ERROR: FIPS mmctl binary missing -tags=requirefips" && exit 1)
|
||||
$(GO) tool nm $(GOBIN)/$(MMCTL_BIN_NAME) | grep -qE "func_go_openssl_OpenSSL_version|_mkcgo_OpenSSL_version" || (echo "ERROR: FIPS mmctl binary missing OpenSSL integration" && exit 1)
|
||||
strings $(GOBIN)/$(MMCTL_BIN_NAME) | grep -qE "go_openssl_OpenSSL_version|mkcgo_OpenSSL_version" || (echo "ERROR: FIPS mmctl binary missing OpenSSL integration" && exit 1)
|
||||
endif
|
||||
|
||||
build-linux-arm64: setup-go-work
|
||||
|
|
@ -90,10 +90,10 @@ ifeq ($(FIPS_ENABLED),true)
|
|||
@echo Verifying Build Linux amd64 for FIPS
|
||||
$(GO) version -m $(GOBIN)/mattermost | grep -q "GOEXPERIMENT=systemcrypto" || (echo "ERROR: FIPS mattermost binary missing GOEXPERIMENT=systemcrypto" && exit 1)
|
||||
$(GO) version -m $(GOBIN)/mattermost | grep "\-tags" | grep -q "requirefips" || (echo "ERROR: FIPS mattermost binary missing -tags=requirefips" && exit 1)
|
||||
$(GO) tool nm $(GOBIN)/mattermost | grep -qE "func_go_openssl_OpenSSL_version|_mkcgo_OpenSSL_version" || (echo "ERROR: FIPS mattermost binary missing OpenSSL integration" && exit 1)
|
||||
strings $(GOBIN)/mattermost | grep -qE "go_openssl_OpenSSL_version|mkcgo_OpenSSL_version" || (echo "ERROR: FIPS mattermost binary missing OpenSSL integration" && exit 1)
|
||||
$(GO) version -m $(GOBIN)/mmctl | grep -q "GOEXPERIMENT=systemcrypto" || (echo "ERROR: FIPS mmctl binary missing GOEXPERIMENT=systemcrypto" && exit 1)
|
||||
$(GO) version -m $(GOBIN)/mmctl | grep "\-tags" | grep -q "requirefips" || (echo "ERROR: FIPS mmctl binary missing -tags=requirefips" && exit 1)
|
||||
$(GO) tool nm $(GOBIN)/mmctl | grep -qE "func_go_openssl_OpenSSL_version|_mkcgo_OpenSSL_version" || (echo "ERROR: FIPS mmctl binary missing OpenSSL integration" && exit 1)
|
||||
strings $(GOBIN)/mmctl | grep -qE "go_openssl_OpenSSL_version|mkcgo_OpenSSL_version" || (echo "ERROR: FIPS mmctl binary missing OpenSSL integration" && exit 1)
|
||||
endif
|
||||
ifeq ($(FIPS_ENABLED),true)
|
||||
@echo Skipping Build Linux arm64 for FIPS
|
||||
|
|
|
|||
Loading…
Reference in a new issue