Reset a secret after backup and restore of Data Virtualization
After you run a backup and restore, you might encounter errors in which security processing fails because of password invalidation.
Symptoms
This issue occurs if there is a mismatch of the password from the/secrets/db2instancepwd/password command, which is generated and mounted by the
db2uoperator, versus the password that the Db2 security plug-in has in the
users.json file.Resolving the problem
- Change to the project where Data
Virtualization pods are
installed.
oc project ${PROJECT_CPD_INST_OPERANDS} - Log in to the Data
Virtualization head pod.
oc rsh c-db2u-dv-db2u-0 bash - Switch to the Data
Virtualization database instance owner
db2inst1.su - db2inst1 - Extract the Db2 instance
password.
PLAINTEXT_PASSWORD=$(cat /secrets/db2instancepwd/password) - Encrypt the new
password.
new_hashed_password=$(/sec_plugin/pwgen -gen $PLAINTEXT_PASSWORD) - Extract the previous
password.
old_hashed_password=$(cat /mnt/blumeta0/db2_config/users.json | python -m json.tool | grep -i '"username": "db2inst1"' -A7 | grep -i 'password' | xargs | cut -d' ' -f 2 | cut -d',' -f 1) - Copy the /mnt/blumeta0/db2_config/users.json
file.
cp /mnt/blumeta0/db2_config/users.json /mnt/PV/versioned/db2_config_users.json - Update the /mnt/blumeta0/db2_config/users.json file by searching for the
value of
old_hashed_passwordparameter from step 6 and replacing it with value ofnew_hashed_passwordparameter from step 5. - Verify that Db2 can connect to the
Db2
Big SQL user
db2inst1with the following command.db2 connect to bigsql user db2inst1 using $(cat /secrets/db2instancepwd/password) - Repeat steps 1 - 8 for the following secrets.
cacheadmin-
Run the following command to extract the previous password.
cat /mnt/blumeta0/db2_config/users.json | python -m json.tool | grep -i '"username": "cacheadmin"' -A7 | grep -i 'password' | xargs | cut -d' ' -f 2 | cut -d',' -f 1Find the new password from the secret.
cat /secrets/cacheadminpwd/password dmcuser-
Run the following command to extract the previous password.
cat /mnt/blumeta0/db2_config/users.json | python -m json.tool | grep -i '"username": "dmcuser"' -A7 | grep -i 'password' | xargs | cut -d' ' -f 2 | cut -d',' -f 1Find the new password from the secret.cat /secrets/dmcuserpwd/password