Last changed
Get notified of upcoming product changes, critical vulnerability notifications and patches and more.
Sign InContainer image for building Go applications with FIPS
The image is available on cgr.dev
:
This image provides go toolchain that produces FIPS compliant binaries. It is go toolchain compiled with golang-fips/go patches applied. They are further enhanced to always default to FIPS mode, without ability to opt out. For non-FIPS toolchain see go
container image.
Binaries built with this edition of go on Linux:
Whilst Chainguard's edition of OpenSSL FIPS is recommended, the resulting binaries are vendor-agnostic and can be used at runtime with OpenSSL FIPS providers on other OpenSSL FIPS hosts.
FIPS compliance is achieved by not using any native golang cryptographic functionality and redirecting all calls to OpenSSL at runtime. Specifically the following modules are patched to redirect to the OpenSSL FIPS provider:
crypto
crypto/tls
golang.org/x/crypto
that use stock crypto
primitives onlyIf no other cryptographic algorithms are implemented or used, certification status will depend on the runtime OpenSSL FIPS certification. For Chainguard that is #4282 and the submitted rebrand of that.
Notable exceptions are:
crypto/md5
available for non-cryptographically secure use cases onlyIf your application uses crypto/md5
or any other third-party golang cryptographic modules, do engage with a CST testing laboratory for audit and certification needs.
-tags
, GOEXPERIMENT
, CGO_ENABLED
This section contains two examples of how you can use the Go FIPS Chainguard Image to build an example Go application. For more information on working with this Image, check out our Getting Started with the Go Chainguard Image guide.
Start interractive shell in the go-fips
image:
Install a golang demo application helloserver
:
Observe toolchain flags used to build the binary:
This indicates the binary was built with 1.22.2
version of go, with X:boringcrypto
experiment enabled as an indicator that FIPS is in use. Please note that whilst the toolchain experiment is called boringcrypto
the actual implementation uses OpenSSL as evident from symbols table (see below).
Observe further build settings used on the binary:
Observe the following:
build CGO_ENABLED=1
setting is in placebuild GOEXPERIMENT=boringcrypto
setting is in placeVerify that OpenSSL symbols are used by the binary:
Note that golang-fips/openssl contains bindings for all available APIs, even if individual binary may not use all of them.
Verify binary execution with suitable OpenSSL FIPS provider (use Ctrl+C
to terminate):
Now tamper with the fips provider to observe failure to start the application in FIPS mode
As you can see above helloserver
panics when on startup OpenSSL FIPS fails self tests.
Now restore fipsmodule.cnf
to get back into operational state:
The following example Dockerfile builds a helloserver program in Go and copies it on top of the cgr.dev/chainguard-private/glibc-openssl-fips:latest
base image:
Run the following command to build the demo image and tag it as go-helloserver-fips
:
Now you can run the image with:
Chainguard Images contain software packages that are direct or transitive dependencies. The following licenses were found in the "latest" version of this image:
Apache-2.0
BSD-2-Clause
BSD-3-Clause
CC-BY-4.0
GCC-exception-3.1
GPL-2.0-only
GPL-2.0-or-later
For a complete list of licenses, please refer to this Image's SBOM.
Software license agreementThis is a FIPS validated image for FedRAMP compliance.
This image is STIG hardened and scanned against the DISA General Purpose Operating System SRG with reports available.
Learn more about STIGsGet started with STIGs