Updating passwords
Update your Grafana, prometheus or mongodb password for IBM Watson® Machine Learning Accelerator.
Updating mongodb passwords
The Watson Machine Learning
Accelerator service has two database
password settings configured, one for the mongodb database admin (admin), and one
for the dlidb database user (dliadmin).
To update your mongodb passwords:
- Log in to your Red Hat® OpenShift® cluster as a project
administrator:
oc login OpenShift_URL:port - To update password, switch to Watson Machine Learning
Accelerator
namespace
oc project wmla-namespace - Create a backup of the current
password:
oc get secret wmla-mongodb-secret -o yaml - Encode a new password:
where new-admin-password is the new password for the database admin and new-wmla-user-password is the new password for the dlidb database.echo -n 'new-admin-password'|base64 echo -n 'new-wmla-user-password'|base64 - Set a new password in
wmla-mongodb-secret:
where encoded-admin-password is the encoded password for the admin database and encoded-wmla-user-password is the encoded password of the Watson Machine Learning Accelerator database dlidb.oc patch secret wmla-mongodb-secret --patch '{"data":{"mongodb-admin-passwd":"encoded-admin-password"}}' --type=merge oc patch secret wmla-mongodb-secret --patch '{"data":{"mongodb-user-passwd":"encoded-wmla-user-password"}}' --type=merge - Update the passwords on the mongodb pod.
- Log on one of mongodb
pod.
oc exec -it wmla-mongodb-0 bash -n wmla-ns - Export the Watson Machine Learning
Accelerator namespace.
where wmla-ns is the Watson Machine Learning Accelerator namespace.export wmla-ns=wmla-ns - Run the following commands in the mongodb pod to update the mongodb
passwords:
where wmla-ns is the Watson Machine Learning Accelerator namespace, new-admin-password is password of admin database and new-wmla-user-password is the password for the Watson Machine Learning Accelerator dlidb database.mongo --tls --tlsCAFile /var/shareDir/mongodb/tls/ca.crt --tlsCertificateKeyFile /tmp/mongodb.pem wmla-mongodb-0.wmla-mongodb.$wmla-ns-ns.svc.cluster.local,wmla-mongodb-1.wmla-mongodb.$wmla-ns.svc.cluster.local,wmla-mongodb-2.wmla-mongodb.$wmla-ns.svc.cluster.local:27017/admin -u admin -p $MONGODB_ADMIN_PASSWORD --quiet --eval "db.getSiblingDB('dlidb').changeUserPassword(\"dliadmin\", \"new-wmla-user-password\")" mongo --tls --tlsCAFile /var/shareDir/mongodb/tls/ca.crt --tlsCertificateKeyFile /tmp/mongodb.pem wmla-mongodb-0.wmla-mongodb.$wmla-ns.svc.cluster.local,wmla-mongodb-1.wmla-mongodb.$wmla-ns.svc.cluster.local,wmla-mongodb-2.wmla-mongodb.$wmla-ns.svc.cluster.local:27017/admin -u admin -p $MONGODB_ADMIN_PASSWORD --quiet --eval "db.changeUserPassword(\"admin\", \"new-admin-password\")"
- Log on one of mongodb
pod.
- Restart the wmla-dlpd and wmla-logstash pods:
where wmla-ns is the Watson Machine Learning Accelerator namespace.oc scale --replicas 0 deploy wmla-dlpd oc scale --replicas 0 deploy wmla-logstash -n wmla-ns oc scale --replicas 1 deploy wmla-dlpd wmla-logstash oc scale --replicas 1 deploy wmla-logstash -n wmla-ns - Verify that the passwords were changed by submitting a successful training job.
Updating prometheus password
To
update your prometheus password:
- Use the htpasswd utility to produce the hash for password. For example:
To get the base64 encoded password:htpasswd -n admin New password: Re-type new password: admin:$apr1$u8s2rQzR$kLSIGXXA4G3xdbg2Q6v4r.echo 'admin:$apr1$u8s2rQzR$kLSIGXXA4G3xdbg2Q6v4r.' | base64 - YWRtaW46JGFwcjEkdThzMnJRelIka0xTSUdYWEE0RzN4ZGJnMlE2djRyLgo= - Update the secret using the base64 encoded password. For
example:
oc patch secret/wmla-prometheus-htpasswd -p '{"data":{"htpasswd":"YWRtaW46JGFwcjEkdThzMnJRelIka0xTSUdYWEE0RzN4ZGJnMlE2djRyLgo="}}' secret/wmla-prometheus-htpasswd patched - Restart the prometheus pod to pickup updated
secret:
where wmla-prometheus-pod is the name of the prometheus pod.oc delete pod wmla-prometheus-pod - Verify that the secret is in configuration
file:
oc exec -it wmla-prometheus-pod -c sidecar -- cat /etc/nginx/auth/htpasswd admin:$apr1$u8s2rQzR$kLSIGXXA4G3xdbg2Q6v4r. - Verify the new password.
Where new-password is the new password.oc exec -it wmla-prometheus-pod -c prometheus -- curl -u admin:new-password https://wmla-prometheus:9090 -kIf successful, the result returnsFound:<a href="/prometheus/graph">Found</a>. - After updating the password, update your prometheus connection in Grafana.
To update the connection: :
- Log in to Grafana.
- Navigate to Configuration/Data Sources, click on Prometheus.
- Under Basic Auth Details, click Reset and enter
the password. If successful, the result returns:
Data source is working.
Updating Grafana password
To update the Grafana password:
- Obtain the Grafana
password:
CRED=`oc get secret wmla-grafana-secret -n wmla-ns -o jsonpath=\"{.data.admin-password}\"` - Decode the password:
echo $CRED | tr -d '"' | base64 --decode yryibNyJYqDvYFlgYHVI - Using the admin account and the password obtained, you can change the Grafana password from the Grafana console, see: Manage user preferences.