-
Notifications
You must be signed in to change notification settings - Fork 38
feat: keycloak fips mode #1469
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
feat: keycloak fips mode #1469
Changes from all commits
0b95c35
970af26
5650bb9
b8e7fe3
ed1bf33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,7 +82,14 @@ spec: | |
| {{- end }} | ||
| # This will only import the realm if it does not exist | ||
| - "--import-realm" | ||
| # FIPS Mode | ||
| {{- if .Values.fips }} | ||
| # Full configuration might be found at https://www.keycloak.org/server/fips | ||
| - "--features=preview,fips" | ||
| - "--fips-mode=strict" | ||
| {{- else }} | ||
| - "--features=preview" | ||
| {{- end }} | ||
| - "--proxy-headers=xforwarded" | ||
| - "--http-enabled=true" | ||
| - "--hostname-strict=false" | ||
|
|
@@ -137,6 +144,11 @@ spec: | |
| value: DEBUG | ||
| - name: QUARKUS_LOG_CATEGORY__ORG_KEYCLOAK_SERVICES_X509__LEVEL | ||
| value: TRACE | ||
| # Crypto information, primarily for FIPS debugging | ||
| - name: QUARKUS_LOG_CATEGORY__ORG_KEYCLOAK_COMMON_CRYPTO__LEVEL | ||
| value: TRACE | ||
| - name: QUARKUS_LOG_CATEGORY__ORG_KEYCLOAK_CRYPTO__LEVEL | ||
| value: TRACE | ||
| # https://github.com/keycloak/keycloak/issues/39046 | ||
| # Starting from 26.2.0, Keycloak doesn't use password for the internal H2 database. | ||
| # This breaks upgrade scenarios, so we need to use the same password as in 26.1.x | ||
|
|
@@ -185,12 +197,6 @@ spec: | |
| secretKeyRef: | ||
| name: {{ include "keycloak.fullname" . }}-postgresql | ||
| key: password | ||
| # FIPS Mode | ||
| {{- if .Values.fips }} | ||
| # https://access.redhat.com/documentation/en-us/openjdk/11/html-single/configuring_openjdk_11_on_rhel_with_fips/index | ||
| - name: JAVA_TOOL_OPTIONS | ||
| value: "-Dcom.redhat.fips=true" | ||
| {{- end }} | ||
|
Comment on lines
-188
to
-193
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pending CI testing I think this is fine, just would want to make sure that dropping this/changing the effect of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It took me a while but I think I have the answer! The Red Hat Build of OpenJDK contains OpenJDK bits with an additional FIPS patch. You can download the source from the Red Hat Customer Portal (from here). The code haven't changed much since JDK11, it looks very similar to this: + if (systemSecPropsEnabled) {
+ boolean shouldEnable;
+ String sysProp = System.getProperty("com.redhat.fips");
+ if (sysProp == null) {
+ shouldEnable = true;
+ if (sdebug != null) {
+ sdebug.println("com.redhat.fips unset, using default value of true");
+ }
+ } else {
+ shouldEnable = Boolean.valueOf(sysProp);
+ if (sdebug != null) {
+ sdebug.println("com.redhat.fips set, using its value " + shouldEnable);
+ }
+ }
+ if (shouldEnable) {
+ boolean fipsEnabled = SystemConfigurator.configureFIPS(props);
+ if (sdebug != null) {
+ if (fipsEnabled) {
+ sdebug.println("FIPS mode support configured and enabled.");
+ } else {
+ sdebug.println("FIPS mode support disabled.");
+ }Note, that in the absence of The other important thing from our angle is the + * OpenJDK FIPS mode will be enabled only if the system is in
+ * FIPS mode.
+ *
+ * Calls to this method only occur if the system property
+ * com.redhat.fips is not set to false.
+ *
+ * There are 2 possible ways in which OpenJDK detects that the system
+ * is in FIPS mode: 1) if the NSS SECMOD_GetSystemFIPSEnabled API is
+ * available at OpenJDK's built-time, it is called; 2) otherwise, the
+ * /proc/sys/crypto/fips_enabled file is read.The NSS is shipped as part of SSSD, which is part of the RHEL authentication stack and is present in the Keycloak image. According to BZ852023, NSS brokers to To sum it up - I believe it's safe to remove this property and let the Red Hat Build of OpenJDK do the default thing - try to enable FIPS. This will succeed if the underlying Host has FIPS turned on regardless to the distro (although UBI are expected to be more tested than anything else). |
||
| {{- end }} | ||
| {{- if .Values.insecureAdminPasswordGeneration.enabled }} | ||
| - name: KEYCLOAK_ADMIN | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.