You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2026/04/23 13:50:47 UTC
(tomee) 09/23: tck(security): seed JDK truststore and regenerate OpenID certs
This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch security-4.0
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 9b79e6f1eb25bb0a33802040b937e051d4c3cbbb
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Mon Apr 20 20:32:29 2026 +0200
tck(security): seed JDK truststore and regenerate OpenID certs
The OpenID modules ship self-signed certs that expired in March
2023, which is why the TLS bypass in OpenIdHttpClientSupport was
required. Now that the bypass is gone we need JSSE to validate
these connections on its own.
In the download-tck antrun phase:
- seed ${glassfish.root}/glassfish8/.../cacerts.jks from the JDK's
default cacerts (146 trusted CAs) so Maven metadata fetches and
any other public HTTPS calls during the invoker run still
validate; the TCK's keytool-maven-plugin step appends the
localhost cert on top in pre-integration-test.
- regenerate localhost-rsa.jks + tomcat.cert per app-openid* dir
with a fresh 10-year validity, replacing the expired TCK files.
- replace the two hard-coded <alias> rewrites with a loop that
handles any app-openidN directory.
In the injected tomee-remote profile:
- point javax.net.ssl.trustStore at the seeded keystore so the
failsafe JVM (HtmlUnit test driver) trusts the localhost cert.
- add tomee.catalina_opts so arquillian-tomee-remote forwards the
same -Djavax.net.ssl.trustStore/Password to the forked TomEE
JVM (the OpenID relying party).
Full Jakarta Security 4.0 TCK is green against this configuration
without any trust-all fallback.
---
tck/security-standalone/pom.xml | 51 ++++++++++++++++++++++++++++++++++-------
1 file changed, 43 insertions(+), 8 deletions(-)
diff --git a/tck/security-standalone/pom.xml b/tck/security-standalone/pom.xml
index 436a29bc39..77b9c3e623 100644
--- a/tck/security-standalone/pom.xml
+++ b/tck/security-standalone/pom.xml
@@ -120,8 +120,19 @@
<tomee.appWorkingDir>target/tomee/arquillian</tomee.appWorkingDir>
<tomee.cleanOnStartUp>true</tomee.cleanOnStartUp>
<tomee.classifier>plus</tomee.classifier>
+ <!--
+ SSL configuration for app-openid2/app-openid3.
+ Those tests deploy an OpenID provider in a separate Tomcat with a
+ self-signed cert whose public cert is imported into the shared
+ keystore below by the TCK's keytool-maven-plugin (the 'glassfish8'
+ directory name is a TCK leftover from its GlassFish origins; no
+ GlassFish is installed). We point both JVMs at that keystore:
+ the failsafe JVM (test driver that uses HtmlUnit) and the forked
+ TomEE JVM (the OpenID relying party).
+ -->
+ <javax.net.ssl.trustStore>${glassfish.root}/glassfish8/glassfish/domains/domain1/config/cacerts.jks</javax.net.ssl.trustStore>
<javax.net.ssl.trustStorePassword>changeit</javax.net.ssl.trustStorePassword>
- <javax.net.ssl.trustStoreType>PKCS12</javax.net.ssl.trustStoreType>
+ <tomee.catalina_opts>-Djavax.net.ssl.trustStore=${glassfish.root}/glassfish8/glassfish/domains/domain1/config/cacerts.jks -Djavax.net.ssl.trustStorePassword=changeit</tomee.catalina_opts>
<tomee.properties>openejb.environment.default=true</tomee.properties>
</systemPropertyVariables>
</configuration>
@@ -146,13 +157,37 @@ ${line.separator} </profiles>" />
token="<artifactId>arquillian-protocol-servlet</artifactId>"
value="<artifactId>arquillian-protocol-servlet-jakarta</artifactId>${line.separator} <version>${version.arquillian-protocol-servlet-jakarta}</version>" />
- <!-- Avoid keytool alias collisions across sequential OpenID module runs -->
- <replace file="${tck.dir}/app-openid2/pom.xml"
- token="<alias>tomcat</alias>"
- value="<alias>tomcat-openid2</alias>" />
- <replace file="${tck.dir}/app-openid3/pom.xml"
- token="<alias>tomcat</alias>"
- value="<alias>tomcat-openid3</alias>" />
+ <!--
+ Seed the shared truststore that app-openid2/3's
+ keytool-maven-plugin will append to. Starts from the JDK's
+ default cacerts so Maven metadata fetches against public
+ HTTPS repos still validate alongside the localhost cert.
+ -->
+ <mkdir dir="${project.build.directory}/glassfish8/glassfish/domains/domain1/config" />
+ <delete file="${project.build.directory}/glassfish8/glassfish/domains/domain1/config/cacerts.jks" quiet="true" />
+ <copy file="${java.home}/lib/security/cacerts"
+ tofile="${project.build.directory}/glassfish8/glassfish/domains/domain1/config/cacerts.jks" />
+
+ <!--
+ Regenerate the OpenID module HTTPS certs.
+ The TCK ships self-signed certs that expired in March 2023; we mint
+ fresh 10-year certs so standard JSSE validation passes without any
+ trust-all fallback.
+ -->
+ <exec executable="bash" failonerror="true">
+ <arg value="-c" />
+ <arg value="set -euo pipefail; for d in "${tck.dir}"/app-openid*/; do if [ -f "$d/localhost-rsa.jks" ]; then rm -f "$d/localhost-rsa.jks" "$d/tomcat.cert"; keytool -genkeypair -alias tomcat -keyalg RSA -keysize 2048 -validity 3650 -dname 'CN=localhost, OU=jakarta, O=eclipse, L=amsterdam, ST=holland, C=nl' -storetype PKCS12 -storepass changeit -keypass changeit -keystore "$d/localhost-rsa.jks"; k [...]
+ </exec>
+
+ <!--
+ Avoid keytool alias collisions when sequential OpenID modules import
+ into the same cacerts.jks. Derive a unique alias per app-openidN dir
+ (app-openid has no keytool step, so it is skipped).
+ -->
+ <exec executable="bash" failonerror="true">
+ <arg value="-c" />
+ <arg value="set -euo pipefail; for p in "${tck.dir}"/app-openid*/pom.xml; do name=$(basename "$(dirname "$p")"); suffix=${name#app-openid}; if [ -n "$suffix" ]; then sed -i.bak -e "s|<alias>tomcat</alias>|<alias>tomcat-openid${suffix}</alias>|" "$p"; rm -f "$p.bak"; fi; done" />
+ </exec>
</target>
</configuration>
</execution>