Skip to content

[#487] Add ssl-gen module to generate SSL certificates at build time - #501

Merged
jmesnil merged 1 commit into
wildfly-extras:mainfrom
jmesnil:487_ssl-gen
Oct 6, 2026
Merged

jmesnil merged 1 commit into
wildfly-extras:mainfrom
jmesnil:487_ssl-gen

Conversation

@jmesnil

@jmesnil jmesnil commented Sep 30, 2026

Copy link
Copy Markdown
Member

Replace the static ssl/ directory (which contained expired certificates
last generated in January 2023 with weak 1024-bit client keys) with a
new ssl-gen Maven module that generates fresh PKCS12 keystores and
truststores on every build using keytool-maven-plugin.

All consumers (testsuite, examples service and client modules) now copy
the required files directly from ssl-gen/target/generated-ssl/ at build
time instead of referencing hard-coded static files.

Key changes:

  • Add ssl-gen/ module: generates server.keystore.p12, server.truststore.p12,
    client.keystore.p12, client.truststore.p12, client.truststore.pem plus
    CLI scripts using keytool-maven-plugin (2048-bit RSA, 365-day validity)
  • Remove all static SSL binary files (expired certs, weak keys)
  • Move configure-elytron-*.cli scripts to ssl-gen/src/main/resources/
    and update them to use PKCS12 format
  • Testsuite: copy server keystores to WildFly config dir at
    process-test-resources; fix test code to use relative-to=jboss.server.config.dir
    instead of fragile relative path hacks; update two-way TLS code to
    load PKCS12 via KeyManagerFactory instead of PEM private key streams
  • Examples service: replace maven-antrun copy with maven-resources-plugin;
    update CLI script paths to reference ssl-gen output
  • Examples client: copy SSL files from ssl-gen output to target/classes;
    update two-way TLS code for PKCS12 KeyManagerFactory

@jmesnil
jmesnil requested a review from hpehl as a code owner September 30, 2026 14:02
@jmesnil
jmesnil requested a review from darranl September 30, 2026 14:02
@jmesnil

jmesnil commented Sep 30, 2026

Copy link
Copy Markdown
Member Author

@darranl Do you mind reviewing the ssl-gen module? I used your doc at https://github.com/user-attachments/files/32770020/TEST-CERTIFICATE-KEYSTORE-GENERATION.md to drive the changes and modernize a bit the generation (using PKCS12 instead of JKS).

I still had to import and use BouncyCastle to export the private keys that were needed by grpcurl (which afaict is a Go tool that does not support PKCS12).

@hpehl To verify the examples, I also simplified their use and did parts of #490 (at least the service parts to leverage WildFly provisioning).

@darranl

darranl commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Writing the PEM files is something we could plan for the future so makes sense to use BC for now, we have reading support so adding writing support makes sense.

Comment thread pom.xml
@jmesnil

jmesnil commented Oct 6, 2026

Copy link
Copy Markdown
Member Author

@hpehl I think this is ready for review. Before it is merged, I'll squash all the commits if that's ok with you?

@jmesnil jmesnil linked an issue Oct 6, 2026 that may be closed by this pull request
@hpehl

hpehl commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

LGTM! Thanks @jmesnil

…at build time

Replace the static ssl/ directory (which contained expired certificates
last generated in January 2023 with weak 1024-bit client keys) with a
new ssl-gen Maven module that generates fresh PKCS12 keystores and
truststores on every build using keytool-maven-plugin.

All consumers (testsuite, examples service and client modules) now copy
the required files directly from ssl-gen/target/generated-ssl/ at build
time instead of referencing hard-coded static files.

Key changes:
- Add ssl-gen/ module: generates server.keystore.p12, server.truststore.p12,
  client.keystore.p12, client.truststore.p12, client.truststore.pem plus
  CLI scripts using keytool-maven-plugin (2048-bit RSA, 365-day validity)
- Remove all static SSL binary files (expired certs, weak keys)
- Move configure-elytron-*.cli scripts to ssl-gen/src/main/resources/
  and update them to use PKCS12 format
- Testsuite: copy server keystores to WildFly config dir at
  process-test-resources; fix test code to use relative-to=jboss.server.config.dir
  instead of fragile relative path hacks; update two-way TLS code to
  load PKCS12 via KeyManagerFactory instead of PEM private key streams
- Examples service: replace maven-antrun copy with maven-resources-plugin;
  update CLI script paths to reference ssl-gen output
- Examples client: copy SSL files from ssl-gen output to target/classes;
  update two-way TLS code for PKCS12 KeyManagerFactory
- Use Bouncy Castle JcaPEMWriter to export the client certificate and
  private key from the PKCS12 keystore as client.crt.pem and client.key.pem.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@jmesnil
jmesnil merged commit 20e7e8d into wildfly-extras:main Oct 6, 2026
3 checks passed
@jmesnil jmesnil linked an issue Oct 8, 2026 that may be closed by this pull request
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.

Update the examples to streamline their uses Revisit certificate management in the project

3 participants