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] Add FIPS docker image for GovCloud #117152

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

breskeby
Copy link
Contributor

@breskeby breskeby commented Nov 20, 2024

  • Adds docker image based on chainguard base fips image
  • x86 only for now as the base image is x86b only

The fips image is shipped with:

  • org.bouncycastle:bc-fips:1.0.2.5 and org.bouncycastle:bctls-fips:1.0.19 in Elasticsearch libs folder
  • config/jvm.options.d/fips.options for fips specific JVM options
  • fips_java.security file
  • fips_java.policy

Todo:
Add packaging test coverage (part of later PR as we want to provide that image for testing early and packaging tests require more general restructuring for support fips scenarios)

@breskeby breskeby requested a review from a team as a code owner November 20, 2024 13:02
@breskeby breskeby added >non-issue :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v8.17.0 labels Nov 20, 2024
@breskeby breskeby self-assigned this Nov 20, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@breskeby breskeby marked this pull request as draft November 20, 2024 13:02
@breskeby breskeby changed the title Add FIPS docker image for GovCloud [Build] Add FIPS docker image for GovCloud Nov 20, 2024
@breskeby breskeby force-pushed the add-fips-docker-image branch from 8003e4c to c11d177 Compare December 3, 2024 19:18
@breskeby breskeby added the :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts label Dec 3, 2024
@breskeby breskeby force-pushed the add-fips-docker-image branch 3 times, most recently from a23256c to 3f203b4 Compare December 5, 2024 09:54
CLOUD_ESS(null, "-cloud-ess", "apk");
CLOUD_ESS(null, "-cloud-ess", "apk"),
// Based on WOLFI above, we programmatically extend from the wolfi image.
FIPS(null, "-fips", "apk");
Copy link
Contributor

@jakelandis jakelandis Dec 9, 2024

Choose a reason for hiding this comment

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

we need to base the image from: chainguard-base-fips

while the majority of the FIPS compliant for ES is from the JDK/app level, the container itself must also be FIPS compliant.
(EDIT: or is that already the case here ? ...if so, for my own education, how are the tags defined across base and base-fips?)

Copy link
Contributor Author

@breskeby breskeby Dec 9, 2024

Choose a reason for hiding this comment

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

we transitively base this on chainguard-base as cloud-ess is based on our es-wolfi image and this is based on chainguard-base. @jakelandis you say this must be chainguard-base-fips instead?

This is coded into distribution/docker/build.gradle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to do more tweaking as but you can test this from the branch by running:

./gradlew buildAarch64FipsDockerImage

# start image directly
docker run elasticsearch-fips:aarch64

# inspect image 
docker run -it --entrypoint /bin/bash elasticsearch-fips:aarch64 

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jakelandis With the latest WIP I configure a hardcoded password for the keystore (as it must be >12 characters) Strictly speaking that's fips compliant as I get it, but how is that safe enough if we bake that password into the image itself? each image would have the same keystone password basically public.

It seems we should instead have the ability in ES to ensure we generate dynamically a keystore with fips compliant password without explicitly declaring it?

Copy link
Contributor

Choose a reason for hiding this comment

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

you say this must be chainguard-base-fips instead?

Yes, the base image, for this purpose, must also be FIPS compliant.

but how is that safe enough if we bake that password into the image itself? each image would have the same keystone password basically public.

This probably warrants it's own discussion, there is likely some cloud level config needed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jakelandis I changed the base image to be chainguard-base-fips. One side effect here is that aarch64 is not supported anymore. You can test this with

./gradlew buildFipsDockerImage

# start image directly
docker run elasticsearch-fips:x86_64

# inspect image 
docker run -it --entrypoint /bin/bash elasticsearch-fips:x86_64 

xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.key: node1.key
xpack.security.http.ssl.certificate: node1.crt
xpack.security.http.ssl.certificate_authorities: node1.crt
Copy link

Choose a reason for hiding this comment

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

these keys will work for netty; but not for BCJSSE in approved only mode.

Was this tested or solved?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this has been removed

# xpack.security.transport.ssl.enabled: true
# xpack.security.transport.ssl.certificate: node1.crt
# xpack.security.transport.ssl.certificate_authorities: node1.crt
# xpack.security.transport.ssl.key: node1.key
Copy link

Choose a reason for hiding this comment

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

ah, that's how incompatibility is fixed by turning off xpack.security ssl.

- Adds docker image based on chainguard base fips image
- x86 only for now as base image is x86b only

TODO: Add packaging test coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts >non-issue Team:Delivery Meta label for Delivery team v8.19.0 v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants