-
Notifications
You must be signed in to change notification settings - Fork 28
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
Enable fipstls when running in FIPS mode #1127
Conversation
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.
Took a look at the doc changes to start with.
@@ -281,6 +282,10 @@ index 00000000000000..d929b3e516bdb0 | |||
+ } | |||
+ } | |||
+ } | |||
+ if openssl.FIPS() { |
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.
Maybe call this once before the switch
to avoid potentially calling it twice?
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.
The code in the switch
potentially call openssl.SetFIPS
, so it can't be directly reused. We could add some logic to workaround that, but this code is already quite tricky and I would prefer not to add more complexity just to save a couple of cgo calls that are only ever called once.
@@ -281,6 +282,10 @@ index 00000000000000..d929b3e516bdb0 | |||
+ } | |||
+ } | |||
+ } | |||
+ if openssl.FIPS() { | |||
+ fipstls.Force() | |||
+ sig.FIPSOnly() |
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.
This could be misleading... since openssl.FIPS()
isn't a const, my understanding is this will always be linked in whether FIPS mode is on or off, then a static scanner (coded with boringcrypto in mind) would claim that the whole binary uses FIPS-only TLS.
The sig file's comment is pretty specific:
// FIPSOnly indicates that package crypto/tls/fipsonly is present.
func FIPSOnly()
However I do think that in spirit, linking in sig.FIPSOnly()
makes sense.
As far as the clarity of the patch goes, I think it's worth a comment to clarify the intent and move it out of the if
so there can't be any misimpression that it'll actually be conditionally included.
That all said, https://pkg.go.dev/rsc.io/goversion already doesn't seem to work on our binaries (at least on Windows?): ... X:cngcrypto (standard crypto)
. So, actual interactions with scanners is probably something to figure out later. The go tool nm foo.exe
output looks correct to me, including both BoringCrypto and FIPSOnly.
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.
Hmm, interesting. Given that we can't really make sig.FIPSOnly
work correctly, I would rather not add it. If someone is using an scanner looking for sig.FIPSOnly
as a matter of compliance, I prefer to have a false negative (aka binary reported as not compliant when it is compliant) that can be fixed with an exception rather than a false positive (aka binary reported as compliant when it is not compliant).
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.
This is great. 🙂 I don't think any of my comments are worth blocking for or have deep ramifications.
dd7586b
to
a755653
Compare
Automatically enforces that
crypto/tls
andcrypto/x509
only use FIPS-approved settings when running in FIPS mode. This differs from upstream's BoringCrypto backend, which requires you to importcrypto/tls/fipsonly
to apply the FIPS-mandated restrictions.Do this automatically to reduce the source code changes necessary to produce a FIPS-compliant Go application.
Code taken from #964.