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

wazuh-docker multinode - change password #952

Closed
yourdevDex opened this issue Aug 23, 2023 · 2 comments
Closed

wazuh-docker multinode - change password #952

yourdevDex opened this issue Aug 23, 2023 · 2 comments
Assignees
Labels

Comments

@yourdevDex
Copy link

yourdevDex commented Aug 23, 2023

Hello,
I'm using wazuh-docker multi node and trying to follow this steps to change the password of admin, however I failed and still accessing the admin using the credentials admin/SecretPassword

here's what I did, first I tried to change the password in console and shows this
Failed to reset password. {"status":"FORBIDDEN","message":"Resource 'admin' is read-only."} and I failed.

then I tried this documentation https://documentation.wazuh.com/current/deployment-options/docker/wazuh-container.html#change-the-password-of-a-wazuh-indexer-user

and here's my error

`**************************************************************************
** This tool will be deprecated in the next major release of OpenSearch **
** opensearch-project/security#1755 **


Security Admin v7
Will connect to localhost:9200
ERR: Seems there is no OpenSearch running on localhost:9200 - Will exit`

I'm confuse because I have 3 index. and on the documentation its for single-node.

Need help on this...

also when I change here's the dashboard shows

{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred."}

@vcerenu vcerenu self-assigned this Aug 29, 2023
@vcerenu
Copy link
Member

vcerenu commented Aug 30, 2023

Hello @yourdevDex

The execution of the securityadmin.sh script requires assigning the path of the admin.pem and admin-key.pem certificates as a parameter. If you check inside the docker-compose.yml file of the multi-node directory you will see that these certificates are mounted for the wazuh1.indexer service, just like in the wazuh.indexer service inside the docker-compose.yml of the single-node directory, but for wazuh2.indexer and wazuh3.indexer services no:

   wazuh1.indexer:
     image:wazuh/wazuh-indexer:4.7.0
     hostname: wazuh1.indexer
     restart: always
     ports:
       - "9200:9200"
     environment:
       - "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
       - "bootstrap.memory_lock=true"
     ulimits:
       memlock:
         soft: -1
         hard: -1
       nofile:
         soft: 65536
         hard: 65536
     volumes:
       - wazuh-indexer-data-1:/var/lib/wazuh-indexer
       - ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-indexer/certs/root-ca.pem
       - ./config/wazuh_indexer_ssl_certs/wazuh1.indexer-key.pem:/usr/share/wazuh-indexer/certs/wazuh1.indexer.key
       - ./config/wazuh_indexer_ssl_certs/wazuh1.indexer.pem:/usr/share/wazuh-indexer/certs/wazuh1.indexer.pem
       - ./config/wazuh_indexer_ssl_certs/admin.pem:/usr/share/wazuh-indexer/certs/admin.pem
       - ./config/wazuh_indexer_ssl_certs/admin-key.pem:/usr/share/wazuh-indexer/certs/admin-key.pem
       - ./config/wazuh_indexer/wazuh1.indexer.yml:/usr/share/wazuh-indexer/opensearch.yml
       - ./config/wazuh_indexer/internal_users.yml:/usr/share/wazuh-indexer/opensearch-security/internal_users.yml
   wazuh2.indexer:
     image:wazuh/wazuh-indexer:4.7.0
     hostname: wazuh2.indexer
     restart: always
     environment:
       - "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
       - "bootstrap.memory_lock=true"
     ulimits:
       memlock:
         soft: -1
         hard: -1
       nofile:
         soft: 65536
         hard: 65536
     volumes:
       - wazuh-indexer-data-2:/var/lib/wazuh-indexer
       - ./config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-indexer/certs/root-ca.pem
       - ./config/wazuh_indexer_ssl_certs/wazuh2.indexer-key.pem:/usr/share/wazuh-indexer/certs/wazuh2.indexer.key
       - ./config/wazuh_indexer_ssl_certs/wazuh2.indexer.pem:/usr/share/wazuh-indexer/certs/wazuh2.indexer.pem
       - ./config/wazuh_indexer/wazuh2.indexer.yml:/usr/share/wazuh-indexer/opensearch.yml
       - ./config/wazuh_indexer/internal_users.yml:/usr/share/wazuh-indexer/opensearch-security/internal_users.yml

Because of this, the execution of the securityadmin.sh script should be done on the wazuh1.indexer service container.

Also in multi-node you have to clarify which is the host where the script is executed, the command can be done as follows:

$ export INSTALLATION_DIR=/usr/share/wazuh-indexer
$ CACERT=$INSTALLATION_DIR/certs/root-ca.pem
$ KEY=$INSTALLATION_DIR/certs/admin-key.pem
$ CERT=$INSTALLATION_DIR/certs/admin.pem
$ export JAVA_HOME=/usr/share/wazuh-indexer/jdk
$ HOST=$(grep node.name $INSTALLATION_DIR/opensearch.yml | awk '{printf $2}')
$ bash /usr/share/wazuh-indexer/plugins/opensearch-security/tools/securityadmin.sh -cd /usr/share/wazuh-indexer/opensearch-security/ -nhnv -cacert  $CACERT -cert $CERT -key $KEY -p 9200 -icl -h $HOST

@teddytpc1 teddytpc1 added the level/task Subtask issue label Sep 1, 2023
@teddytpc1
Copy link
Member

Closed due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants