Skip to content

Instantly share code, notes, and snippets.

@Richard-Barrett
Created October 4, 2021 17:44
Show Gist options
  • Save Richard-Barrett/f297710d9541dbca52c211d956aefa8d to your computer and use it in GitHub Desktop.
Save Richard-Barrett/f297710d9541dbca52c211d956aefa8d to your computer and use it in GitHub Desktop.
Reconfigure MSR TLS Certs
#!/bin/bash
# ===============================================
# Created by: Richard Barrett
# Date Created: 10/04/2021
# Purpose: Interactive MSR Reconfigure
# Company: Mirantis
# ===============================================
# System Variables
# ================
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
while true; do
echo "What is the MSR_TAG (yes/no)?"
read MSR_TAG
echo "What is your MSR_URL?"
read MSR_URL
read -p "Would you like to reconfigure MSR (no/yes)?" yn
case $ny in
[Yy]* ) echo "================================================"; \
echo " Reconfiguring MSR"; \
echo "================================================"; \
echo "Pulling Missing Images..."
docker run -it --rm docker/dtr:$MSR_TAG \
reconfigure --dtr-ca "$(cat ca.pem)" \
--dtr-cert "$(cat cert.pem)" \
--dtr-key "$(cat key.pem)" \
--dtr-external-url https://$MSR_URL \
--ucp-url https://$MSR_URL \
--debug --ucp-insecure-tls;
echo "================================================"; \
echo "MSR has been reconfigured...";
echo "================================================"; \
break;; \
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment