Hello Tung,
I recommend you to use the wazuh-passwords-tool.sh
script and follow this documentation page.
You can change your kibanaserver password easily using that script, you only need to run the following command:
bash wazuh-passwords-tool.sh -u kibanaserver -p new_password
And change it accordingly your kibana.yaml file.
Regarding changing the elasticsearch.username kibanaserver
admin user, this is the default Open Distro user for Elasticsearch, so, maybe it could be a better idea to add a new user with the same permissions in order to make Kibana works.
If you have any doubt doing this process do not doubt to ask.
Hello Tung,
It seems that the backup fails, this could be motivated by multiple reasons.
Please run the script using the verbose mode:
bash wazuh-passwords-tool.sh -u kibanaserver -p new_password -v
Also, we need more information about your environment, please, could you provide:
/var/log/elasticsearch/wazuh-cluster.log
Hello Tung,
In order to change elasticsearch users' passwords, it is necessary to have elasticsearch running, so please restart elasticsearch and try again the command.
In case of failure, please, send back the output of the command, probably it would be related to the elasticsearch configuration, check this documentation page and ensure everything is well configured.
Hello Tung,
It seems there are errors in your elasticsearch certificates.
If you are using a testing or development environment and you have an All-in-one deployment, it will be easier to reinstall it. You can do it using this command:
curl -so ~/unattended-installation.sh https://packages.wazuh.com/resources/4.2/open-distro/unattended-installation/unattended-installation.sh && bash ~/unattended-installation.sh --overwrite
In another case, I recommend removing your olds certificates and following these steps to generate new ones.
Regarding the backup:
If you want to keep your manager’s configuration you only have to keep the following list of files:
/var/ossec/etc/local_internal_options.conf
/var/ossec/etc/decoders/local_decoder.xml
/var/ossec/etc/rules/local_rules.xml
/var/ossec/etc/client.keys
/var/ossec/api/configuration/api.yaml
If you want to keep the alerts, you could save the logs folder and restore it after the reinstall process.
Regarding the creation of new certifications, I suggest running the following script. This will generate new certs and passwords. After that, it will restart your elasticsearch, filebeat and kibana.
# Remove existent certs
rm -rf /etc/elasticsearch/certs/
rm -rf /etc/kibana/certs/
rm -rf /etc/filebeat/certs/
rm /etc/elasticsearch/esnode-key.pem /etc/elasticsearch/esnode.pem /etc/elasticsearch/kirk-key.pem /etc/elasticsearch/kirk.pem /etc/elasticsearch/root-ca.pem -f
# Generate new certs
curl -so ~/wazuh-cert-tool.sh https://packages.wazuh.com/resources/4.2/open-distro/tools/certificate-utility/wazuh-cert-tool.sh
curl -so ~/instances.yml https://packages.wazuh.com/resources/4.2/open-distro/tools/certificate-utility/instances_aio.yml
bash ~/wazuh-cert-tool.sh
mkdir /etc/elasticsearch/certs/
mv ~/certs/elasticsearch* /etc/elasticsearch/certs/
mv ~/certs/admin* /etc/elasticsearch/certs/
cp ~/certs/root-ca* /etc/elasticsearch/certs/
# Restart elasticsearch
systemctl daemon-reload
systemctl enable elasticsearch
systemctl restart elasticsearch
# Apply new certifications
export JAVA_HOME=/usr/share/elasticsearch/jdk/ && /usr/share/elasticsearch/plugins/opendistro_security/tools/securityadmin.sh -cd /usr/share/elasticsearch/plugins/opendistro_security/securityconfig/ -nhnv -cacert /etc/elasticsearch/certs/root-ca.pem -cert /etc/elasticsearch/certs/admin.pem -key /etc/elasticsearch/certs/admin-key.pem
# Copy new certifications in filebeat
mkdir /etc/filebeat/certs
cp ~/certs/root-ca.pem /etc/filebeat/certs/
mv ~/certs/filebeat* /etc/filebeat/certs/
# Restart filebeat
systemctl daemon-reload
systemctl enable filebeat
systemctl start filebeat
# Copy new certifications in kibana
mkdir /etc/kibana/certs
cp ~/certs/root-ca.pem /etc/kibana/certs/
mv ~/certs/kibana* /etc/kibana/certs/
chown kibana:kibana /etc/kibana/certs/*
# Restart kibana
systemctl daemon-reload
systemctl enable kibana
systemctl start kibana
# Generate new passwords for your environment
curl -so wazuh-passwords-tool.sh https://packages.wazuh.com/resources/4.2/open-distro/tools/wazuh-passwords-tool.sh
bash wazuh-passwords-tool.sh -a
# Restart all services to apply new passwords
systemctl restart elasticsearch
systemctl restart kibana
systemctl restart filebeat
If you get any error running this script, send it back and we will help you.
Also, if you have any doubt do not hesitate to ask.