Skip to content
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

[CI] Add demo certificates to the packages #183

Open
Tracked by #485
AlexRuiz7 opened this issue Mar 7, 2024 · 5 comments
Open
Tracked by #485

[CI] Add demo certificates to the packages #183

AlexRuiz7 opened this issue Mar 7, 2024 · 5 comments
Assignees
Labels
level/task Task issue request/operational Operational requests type/enhancement Enhancement issue

Comments

@AlexRuiz7
Copy link
Member

AlexRuiz7 commented Mar 7, 2024

Description

In order to improve the user experience deploying wazuh-indexer, we will add demo certificates to the packages, so the application can be started out of the box without further configuration.

This will also make our development and testing easier.

Implementation restrictions

  • The certificates will be deployed to the expected path (see opensearch.yml).
  • The expiration date of the certificates will be as far in time as possible (about 10 years from now).
@AlexRuiz7 AlexRuiz7 added level/task Task issue request/operational Operational requests type/enhancement Enhancement issue labels Mar 7, 2024
@wazuhci wazuhci moved this to Backlog in Release 5.0.0 Nov 11, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 5.0.0 Nov 11, 2024
@QU3B1M
Copy link
Member

QU3B1M commented Nov 11, 2024

The (OpenSearch solution) is more complex than the scope we are aiming for with this issue. In their solution, demo certificates are configured by the security plugin's tool Installer. While we don't intend to code a similar implementation, we might be able to leverage that plugin and use it in the wazuh-indexer.

@QU3B1M
Copy link
Member

QU3B1M commented Nov 12, 2024

A potential solution has been developed and is currently undergoing testing (PR #548). It involves adding an install-demo-certificates.sh script that generates and configures the certificates in the default directory (/etc/wazuh-indexer/certs). This script will be triggered during the post-install stage of the package installation, but only if the default certificates directory does not exist and the script is available.

@wazuhci wazuhci moved this from In progress to Pending review in Release 5.0.0 Nov 13, 2024
@wazuhci wazuhci moved this from Pending review to In progress in Release 5.0.0 Nov 13, 2024
@wazuhci wazuhci moved this from In progress to Pending review in Release 5.0.0 Nov 13, 2024
@wazuhci wazuhci moved this from Pending review to In final review in Release 5.0.0 Nov 15, 2024
@wazuhci wazuhci moved this from In final review to On hold in Release 5.0.0 Nov 15, 2024
@f-galland f-galland self-assigned this Nov 15, 2024
@wazuhci wazuhci moved this from On hold to In progress in Release 5.0.0 Nov 19, 2024
@f-galland
Copy link
Member

Opensearch's docker compose environments seem not to use ssl for inter node communication by default:

$ grep OPENSEARCH_HOSTS compose.yml 
      - 'OPENSEARCH_HOSTS=["http://opensearch-node1:9200","http://opensearch-node2:9200"]'

@f-galland
Copy link
Member

It looks like they encourage manual certificates setup through the use of volumes in cases where a secure dockerized environment is required:

@f-galland
Copy link
Member

In order to allow the usage of the same certificate for multiple nodes in a cluster, a multi domain wildcard certificate needs to be generated.
These cannot affect a TLD as various agent implementations will reject them.
My solution was to generate certificates for *.wazuh.indexer with the intention of using the leftmost level to hold the name of the node (ie. node-1.wazuh.indexer, node-2.wazuh.indexer, etc.).

  # Node cert
  openssl genrsa -out "$TMP_DIR/indexer-key-temp.pem" 2048
  openssl pkcs8 -inform PEM -outform PEM -in "$TMP_DIR/indexer-key-temp.pem" -topk8 -nocrypt -v1 PBE-SHA1-3DES -out "$TMP_DIR/indexer-key.pem"
  openssl req -new -key "$TMP_DIR/indexer-key.pem" -subj "/C=US/L=California/O=Wazuh/OU=Wazuh/CN=node-0.wazuh.indexer" -out "$TMP_DIR/indexer.csr"

cat <<'INDEXER_EXT' > $TMP_DIR/indexer.ext
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
DNS.2 = *.wazuh.indexer
RID.1 = 1.2.3.4.5
IP.1 = 127.0.0.1
IP.2 =  0:0:0:0:0:0:0:1
INDEXER_EXT

  openssl x509 -req -in "$TMP_DIR/indexer.csr" -CA "$TMP_DIR/root-ca.pem" -CAkey "$TMP_DIR/root-ca-key-temp.pem" -CAcreateserial -sha256 -out "$TMP_DIR/indexer.pem" -days 3650 -extfile "$TMP_DIR/indexer.ext"

@wazuhci wazuhci moved this from In progress to Pending review in Release 5.0.0 Nov 20, 2024
@wazuhci wazuhci moved this from Pending review to On hold in Release 5.0.0 Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue request/operational Operational requests type/enhancement Enhancement issue
Projects
Status: On hold
Development

Successfully merging a pull request may close this issue.

3 participants