Skip to content

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 x86 only
  • the image does not provide a valid elasticsearch.yml configuration. for testing purposes you can follow the elasticsearch fips guide available at https://github.com/elastic/FIPSGuide/tree/main/elasticsearch

The 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

Out of scope:

  • 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.

@breskeby breskeby force-pushed the add-fips-docker-image branch from 9598e33 to 85966a5 Compare March 17, 2025 07:56
@breskeby breskeby marked this pull request as ready for review March 17, 2025 08:00
@breskeby breskeby force-pushed the add-fips-docker-image branch from 85966a5 to ea43aeb Compare March 17, 2025 08:19
@breskeby breskeby force-pushed the add-fips-docker-image branch from ea43aeb to b92d01f Compare March 25, 2025 19:13
- Adds docker image based on chainguard base fips image
- x86 only for now as base image is x86b only

TODO: Add packaging test coverage
@breskeby breskeby force-pushed the add-fips-docker-image branch from da2a817 to 2ee47f2 Compare March 25, 2025 19:25
@breskeby breskeby added the auto-backport Automatically create backport pull requests when merged label Mar 25, 2025
@breskeby breskeby requested a review from jozala March 26, 2025 10:25
Copy link
Contributor

@jozala jozala left a comment

Choose a reason for hiding this comment

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

LGTM

@breskeby breskeby merged commit 653c179 into elastic:main Mar 26, 2025
19 checks passed
breskeby added a commit to breskeby/elasticsearch that referenced this pull request Mar 26, 2025
- Adds docker image based on chainguard base fips image
- x86 only for now as the base image is x86 only
- the image does not provide any elasticsearch.yml configuration. for testing purposes you can follow the elasticsearch fips guide available at https://github.com/elastic/FIPSGuide/tree/main/elasticsearch

The 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

Out of scope:
- 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)
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.0
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 117152

breskeby added a commit to breskeby/elasticsearch that referenced this pull request Mar 26, 2025
- Adds docker image based on chainguard base fips image
- x86 only for now as the base image is x86 only
- the image does not provide any elasticsearch.yml configuration. for testing purposes you can follow the elasticsearch fips guide available at https://github.com/elastic/FIPSGuide/tree/main/elasticsearch

The 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

Out of scope:
- 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)

(cherry picked from commit 653c179)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/InternalElasticsearchDistributionTypes.java
#	distribution/docker/build.gradle
#	distribution/docker/src/docker/Dockerfile
@breskeby
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Questions ?

Please refer to the Backport tool documentation

breskeby added a commit to breskeby/elasticsearch that referenced this pull request Mar 27, 2025
- Adds docker image based on chainguard base fips image
- x86 only for now as the base image is x86 only
- the image does not provide any elasticsearch.yml configuration. for testing purposes you can follow the elasticsearch fips guide available at https://github.com/elastic/FIPSGuide/tree/main/elasticsearch

The 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

Out of scope:
- 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)

(cherry picked from commit 653c179)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/InternalElasticsearchDistributionTypes.java
#	distribution/docker/build.gradle
#	distribution/docker/src/docker/Dockerfile
breskeby added a commit that referenced this pull request Mar 27, 2025
* [Build] Add FIPS docker image for GovCloud (#117152)

- Adds docker image based on chainguard base fips image
- x86 only for now as the base image is x86 only
- the image does not provide any elasticsearch.yml configuration. for testing purposes you can follow the elasticsearch fips guide available at https://github.com/elastic/FIPSGuide/tree/main/elasticsearch

The 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

Out of scope:
- 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)

(cherry picked from commit 653c179)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/InternalElasticsearchDistributionTypes.java
#	distribution/docker/build.gradle
#	distribution/docker/src/docker/Dockerfile

* Fix merge conflict while back porting

* Fix another merge conflict

* Fix fips tests

reported as broken due to issue in gradle setup
omricohenn pushed a commit to omricohenn/elasticsearch that referenced this pull request Mar 28, 2025
- Adds docker image based on chainguard base fips image
- x86 only for now as the base image is x86 only
- the image does not provide any elasticsearch.yml configuration. for testing purposes you can follow the elasticsearch fips guide available at https://github.com/elastic/FIPSGuide/tree/main/elasticsearch

The 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

Out of scope:
- 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 added a commit that referenced this pull request Apr 11, 2025
* [Build] Add FIPS docker image for GovCloud (#117152)

- Adds docker image based on chainguard base fips image
- x86 only for now as the base image is x86 only
- the image does not provide any elasticsearch.yml configuration. for testing purposes you can follow the elasticsearch fips guide available at https://github.com/elastic/FIPSGuide/tree/main/elasticsearch

The 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

Out of scope:
- 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)

* Fix fips tests

reported as broken due to issue in gradle setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged backport pending :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.

5 participants