Last changed
Be the first to hear about exciting product updates, critical vulnerability alerts, compare alternative images, and more.
Sign UpContainer image for building Go applications with FIPS
Chainguard Containers are regularly-updated, secure-by-default container images.
For those with access, this container image is available on cgr.dev
:
Be sure to replace the ORGANIZATION
placeholder with the name used for your organization's private repository within the Chainguard Registry.
This image provides go toolchain that produces FIPS compliant binaries. It is go toolchain compiled with microsoft/go patches applied. The image itself has the go
binary itself compiled in FIPS compliant mode, and contains a CMVP certified OpenSSL FIPS provider.
The image has recommended environment variables set to compile binaries in enforcing mode.
CGO_ENABLED=1
GOFIPS=1
GOEXPERIMENT=systemcrypto
GOFLAGS=-tags=requirefips
Further documentation is available from upstream:
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.
If 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.
Default execution of the container has all of the recommended flags preset. The toolchain defaults to GOEXPERIMENT=systemcrypto
, even when GOEXPERIMENT
variable is unset.
CGO_ENABLED=1
-tags=requirefips
OR use GOFIPS=1
at runtimecgr.dev/chainguard-private/glibc-openssl-fips
image)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-msft-fips
image:
User root
is used here, to perform tampering with the FIPS module selfcheck after compiling and running the application.
Install a golang demo application helloserver
:
Observe toolchain flags used to build the binary:
This indicates the binary was built with 1.23.1
version of go, with X:systemcrypto
experiment enabled as an indicator that OpenSSL will be in use at runtime.
Observe further build settings used on the binary:
Observe the following settings are in place:
build CGO_ENABLED=1
enables access to OpenSSL via CGObuild GOEXPERIMENT=systemcrypto
enables systemcrypto experimentbuild -tags=requirefips
ensures FIPS mode is enforced at the binary startupVerify that OpenSSL symbols are used by the binary:
Note that golang-fips/openssl/v2 are the underlying bindings for all the 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 Containers are minimal container images that are secure by default.
In many cases, the Chainguard Containers tagged as :latest
contain only an open-source application and its runtime dependencies. These minimal container images typically do not contain a shell or package manager. Chainguard Containers are built with Wolfi, our Linux undistro designed to produce container images that meet the requirements of a more secure software supply chain.
The main features of Chainguard Containers include:
For cases where you need container images with shells and package managers to build or debug, most Chainguard Containers come paired with a -dev
variant.
Although the -dev
container image variants have similar security features as their more minimal versions, they feature additional software that is typically not necessary in production environments. We recommend using multi-stage builds to leverage the -dev
variants, copying application artifacts into a final minimal container that offers a reduced attack surface that won’t allow package installations or logins.
To better understand how to work with Chainguard Containers, please visit Chainguard Academy and Chainguard Courses.
In addition to Containers, Chainguard offers VMs and Libraries. Contact Chainguard to access additional products.
This software listing is packaged by Chainguard. The trademarks set forth in this offering are owned by their respective companies, and use of them does not imply any affiliation, sponsorship, or endorsement by such companies.
Chainguard container 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
GPL-2.0-only
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