-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIPS Build #42402
base: main
Are you sure you want to change the base?
FIPS Build #42402
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
Currently FIPS binaries built with For reference, I can build elastic-agent binaries with the changes in elastic/elastic-agent#6565 in a VM using the microsoft/go toolchain, and when I try to run them with no provider it will immediatly panic with the error The beats I build with these changes do not panic (and I expect it to in this case). EDIT: running the binary with the env var |
d6d4430
to
2e9400c
Compare
// ParseExtraFlags returns the ExtraFlags param where all flags that are go build tags are joined by a comma. | ||
// | ||
// For example if given -someflag=val1 -tags=buildtag1 -tags=buildtag2 | ||
// It will return -someflag=val1 -tags=buildtag1,buildtag2 | ||
func (b BuildArgs) ParseExtraFlags() []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When building agentbeat without this parsing, it results in two -tags=
values being sent to the go build
command. one tag gets ignored; this resulted in the behaviour in my previous comment where I then had to adjust a runtime env var to get the binary in compliance.
Parsing the extra flags to join all -tags=
flags is required in order to send -tags=agentbeat,requirefips
which produced a binary that works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this interact with the build tags for testing? I'm thinking of "integration" as an example. I'm assuming we will need tests that require both a testing build tag and the fips build tag.
beats/dev-tools/mage/gotest.go
Line 297 in 1473ae9
testArgs = append(testArgs, "-tags", params) |
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
Similar to the agent PR, this needs to be built as part of CI and we need to have a test that confirms the binary is actually FIPS compliant and links in the FIPS OpenSSL in the expected way. |
Proposed commit message
Enable FIPS compliant builds when the env var
FIPS=true
is set.Artifacts are built with the microsfot/go toolchain with the env var
GOEXPERIMENT=systemcrypto
and the build tag"-tags=requirefips"
.In order to run the resulting binary, the system must have a FIPS compliant crypto provider.
Checklist
I have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
None
How to test this PR locally
TODO