Skip to content
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

Build FIPS capable executables in a docker container #42

Merged
merged 6 commits into from
Jan 22, 2025

Conversation

sumgarg
Copy link

@sumgarg sumgarg commented Jan 21, 2025

Summary

The same commands (build.sh <arch> build) as before now build a telegraf executable for the following architectures inside a docker container; a relatively recent docker installation must be present on the build machine.

  • arm64 and x86_64 - FIPS, dynamically linked to use OpenSSL for crypto
  • arm and MIPS - no-FIPS, statically linked to use native golang crypto

As noted on the golang-fips homepage, the binary will run in FIPS mode if:

  1. The kernel is in FIPS mode (i.e. /proc/sys/crypto/fips_enabled)
  2. The environment variable GOLANG_FIPS=1 is set

Details

  1. Instead of using the golfing installation on a machine, the standard golang container images published on docker hub are used to build inside a container.
  2. Instead of cross-compiling using the golang complier (e.g. by setting the GOARCH), a platform appropriate golang docker container is instantiated (using the docker option --platform) for the build.
  3. The relevant portions of the source tree are copied to a docker builder (see Dockerfile for details).
  4. For FIPS, golang-fips is used:
    1. A new golang toolchain with golang-fips included is first built.
    2. This new toolchain is then used to build a FIPS capable executable.

Testing

  1. End-to-end testing has not been done.
  2. string, ldd and strace were used on a build server, to verify the x86_64 binary was using OpenSSL.
  3. Limited testing of the 4 different architectures was done on switches running EXOS 33.3 by manually replacing the telegraf binary and running telegraf --version.

Checklist

  • No AI generated code was used in this PR

Related issues

EXOS-37069

Copy link

@dccarson dccarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Nice work.

Copy link

@arnelplim arnelplim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@sumgarg sumgarg merged commit 902cd31 into extr-1.21 Jan 22, 2025
1 check passed
@sumgarg sumgarg deleted the priv_sugarg_fips branch January 22, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants