Change cert-tool to use only one wazuh-certificates folder #2998
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before when we want to create different certificates we create one
wazuh-certificates
folder per wazuh component. Now only use one and improve the scalability.Context
Before, when the
certs-tool.sh
script was executed, awazuh-certificates
directory was created in the base directory for each execution. This meant that if you first created certificates for one component, and then wanted to create certificates for another component, it would not allow you to do so as there was already awazuh-certificates
directory.This complicated the creation of certificates for distributions where there were two components installed on the same machine (for example, an indexer and a server).
Description
With this PR, it is now possible to create certificates for any component by hosting them in the same
wazuh-certificates
.If the
wazuh-certificates
directory exists, the new certificates are added to it, overwriting the existing ones. For example, if I create aroot-ca.pem
certificate and try to add anotherroot-ca.pem
certificate, it will be overwritten, keeping the new changes.This allows for scalability, being able to generate the necessary certificates without having to save several
wazuh-certificates
directories.Tests
First I create the
CA
certificates:Create CA certificates
If I try to create a new certificate for the dashboard, it is added to the existing directory:
Create Dashboard certificates