Skip to content

Story #15673 & #15675: feat(pki) - Migrate to PKCS12 and optimize certificate generation.#3535

Open
GiooDev wants to merge 11 commits intodevelopfrom
story_15673
Open

Story #15673 & #15675: feat(pki) - Migrate to PKCS12 and optimize certificate generation.#3535
GiooDev wants to merge 11 commits intodevelopfrom
story_15673

Conversation

@GiooDev
Copy link
Contributor

@GiooDev GiooDev commented Feb 2, 2026

Description

Updating PKI

  • Remove unnecessary timestamping configurations.
  • Do not generate keystores for UI components.
  • Migrate keystores and truststores from proprietary JKS (Java KeyStore) format to industry-standard PKCS12 format.
  • Generate pem certs only for services needed to be loaded in database security/certificates (cas-server & ui-*).

Ansible

  • Update certificates loaded in the database conditionally, based on hosts defined in groups. Unwanted components are not loaded in security/certificates database.
  • Deploying keystores and truststores as p12 instead of jks.

Type de changement

  • PKI
  • Ansiblerie
  • Correction
  • Refactorisation de code

Contributeur

  • Programme Vitam

@GiooDev GiooDev added this to the IT 165 milestone Feb 2, 2026
@GiooDev GiooDev self-assigned this Feb 2, 2026
@GiooDev GiooDev added Security Modules update OPS REVIEW Mandatory if deployment/ directory is modified. labels Feb 2, 2026
@vitam-prg
Copy link
Collaborator

vitam-prg commented Feb 2, 2026

Logo
Checkmarx One – Scan Summary & Detailscdc1a7c6-6480-4ff0-83bf-00d76b44744e

New Issues (2)

Checkmarx found the following issues in this Pull Request

# Severity Issue Source File / Package Checkmarx Insight
1 MEDIUM CVE-2026-2391 Npm-qs-6.14.1
detailsRecommended version: 6.14.2
Description: ### Summary The `arrayLimit` option in qs does not enforce limits for comma-separated values when `comma: true` is enabled, allowing attackers to c...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
2 MEDIUM CVE-2026-2391 Npm-qs-6.10.3
detailsRecommended version: 6.10.6
Description: ### Summary The `arrayLimit` option in qs does not enforce limits for comma-separated values when `comma: true` is enabled, allowing attackers to c...
Attack Vector: NETWORK
Attack Complexity: LOW
Vulnerable Package
Fixed Issues (14)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
CRITICAL CVE-2025-64087 Maven-fr.opensagres.xdocreport:fr.opensagres.xdocreport.template.freemarker-2.1.0
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 80
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 106
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 65
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 80
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 105
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 105
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 106
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 80
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 80
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 81
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 105
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 106
LOW Log_Forging /api/api-referential/referential/src/main/java/fr/gouv/vitamui/referential/server/rest/LogbookManagementOperationController.java: 65

Use @Checkmarx to interact with Checkmarx PR Assistant.
Examples:
@Checkmarx how are you able to help me?
@Checkmarx rescan this PR

@GiooDev GiooDev force-pushed the story_15673 branch 2 times, most recently from fd0cb24 to f66e6ca Compare February 2, 2026 19:03
@GiooDev GiooDev changed the title Story #15673: Major PKI cleaning Story #15673 & #15675: Major PKI cleaning Feb 2, 2026
@GiooDev GiooDev force-pushed the story_15673 branch 4 times, most recently from 9d993bd to 5c002f1 Compare February 2, 2026 22:12
@GiooDev GiooDev changed the title Story #15673 & #15675: Major PKI cleaning Story #15673 & #15675: feat(pki) - Migrate to PKCS12 and optimize certificate generation. Feb 3, 2026
@GiooDev GiooDev force-pushed the story_15673 branch 11 times, most recently from 987dfae to 7420b46 Compare February 13, 2026 17:35
Copy link
Contributor Author

Choose a reason for hiding this comment

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

À quoi ça sert d'avoir 2 fichiers application.yml ? Il y a des usages différents dans certains cas ?

En tout cas il ne semble utilisé nulle part.


1) Retrieval of the IdP metadata, IdP metadata are ignored, so test metdata can be used instead
2) Creation of a keystore for the IdP: `keytool -genkeypair -alias idp-test -keypass password -keystore idp-test-keystore.jks -storepass password -keyalg RSA -keysize 2048 -validity 3650`
2) Creation of a keystore for the IdP: `keytool -genkeypair -alias idp-test -keypass password -keystore idp-test-keystore.p12 -storepass password -keyalg RSA -keysize 2048 -validity 3650`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Il faut probablement rajouter un peu partout le paramètre -storetype PKCS12

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Y'en a besoin dans les 2 chemins ? main & test ?

Un peu chiant à maintenir on peut pas centraliser sur un seul ?

notify: restart service

# Copy the client-external truststore to authorize external applications to communicate with vitamui components.
- name: Copy client-external truststore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to fix this later ? Currently we can't call with client-external certificates the APIs.

trust-store-password: {{ truststores_vitamui }}
key-store: {{ vitamui_folder_conf }}/keystore_server_{{ vitamui_struct.vitamui_component }}.p12
key-store-password: {{ keystore_vitamui_services_servers_collect }}
# key-password: {{ keystore_vitamui_services_servers_collect }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Useless as the key stored in the keystore doesn't have a password.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it usefull if we remove -nodes parameters for generate_certs ?

key-password: {{ password_keystore_server }}
key-store: {{ vitamui_folder_conf }}/keystore_server_{{ vitamui_struct.vitamui_component }}.p12
key-store-password: {{ keystore_vitamui_services_servers_cas_server }}
key-password: {{ keystore_vitamui_services_servers_cas_server }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

But needed for cas-server, otherwise it won't start...

# key-password: {{ keystore_vitamui_services_servers_iam }}
trust-store: {{ vitamui_folder_conf }}/truststore_vitamui-services.p12
trust-store-password: {{ truststore_vitamui_services }}
client-auth: want
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Everybody calls it with a certificate, do we need to update it to client-auth: need ?

-passout pass:"${KEY_PASS}" \
-keyout "${SERVER_CERTIFICATE_PATH}/${COMPOSANT}.key" \
-out "${SERVER_CERTIFICATE_PATH}/${COMPOSANT}.req" \
-nodes \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For later, remove -nodes.

Now that the variables are fully correct between generate_certs and generate_stores, it could be reactivated.

Need more test for clients for UI-* components configured with nginx to put the associated passphrase. Not the same vault used to store certs passphrases and keystores passphrases.

@GiooDev GiooDev force-pushed the story_15673 branch 3 times, most recently from cfefcba to 6f5ae54 Compare February 15, 2026 14:49
…rchitecture.

* Regenerate new passphrase for certs & keystores everytime we execute scripts.
* Do not generate server certs for UI-* components, currently not supported.
@GiooDev GiooDev force-pushed the story_15673 branch 4 times, most recently from a923663 to 78cc0ae Compare February 15, 2026 18:54
# Remove old keystores & servers directories
find ${REPERTOIRE_KEYSTORES} -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \;
# Remove old keystores clients & server directories
find ${KEYSTORES_DIRECTORY:?} -mindepth 1 -maxdepth 1 -type d -exec rm -vrf {} \;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pourquoi on supprime ici sans vérifier si on a mis le ERASE à true ?

@GiooDev GiooDev force-pushed the story_15673 branch 4 times, most recently from 13c9c69 to c0d4e18 Compare February 15, 2026 22:43
@GiooDev GiooDev requested a review from mkhediri February 15, 2026 22:53
* Using get_authorities function as reference for generating expected authorities.
* Simplification of scripts avoiding useless functions.
* Keep translating to english.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OPS REVIEW Mandatory if deployment/ directory is modified. Security Modules update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants