Cleaned up Key file locations

Moved all keys to keys folder
This commit is contained in:
tmunsch 2020-11-27 20:33:10 -05:00 committed by GitHub
parent 71d17ccd00
commit ee4c054d27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,55 +3,55 @@
echo Starting up....
echo "Startup Type: (normal/rotate)"
echo Detected $STARTUP_TYPE
if [ -f "key.txt" ]; then
if [ -f "keys/key.txt" ]; then
echo "Key file detected..."
export MINIO_ACCESS_KEY=`cat key.txt`
export MINIO_ACCESS_KEY=`cat keys/key.txt`
else
echo minioadmin > key.txt
echo minioadmin > keys/key.txt
echo "No key file detected...Preparing First Time Boot"
fi
if [ -f "secret.txt" ]; then
if [ -f "keys/secret.txt" ]; then
echo "Secret file detected..."
export MINIO_SECRET_KEY=`cat secret.txt`
export MINIO_SECRET_KEY=`cat keys/secret.txt`
else
echo minioadmin > secret.txt
echo minioadmin > keys/secret.txt
echo "No secret file detected...Preparing First Time Boot"
fi
if [ -f "oldsecret.txt" ]; then
if [ -f "keys/oldsecret.txt" ]; then
echo "Old secret file detected..."
export MINIO_SECRET_KEY_OLD=`cat oldsecret.txt`
export MINIO_SECRET_KEY_OLD=`cat keys/oldsecret.txt`
else
echo ".."
fi
if [ -f "oldkey.txt" ]; then
if [ -f "keys/oldkey.txt" ]; then
echo "Old key file detected..."
export MINIO_ACCESS_KEY_OLD=`cat oldkey.txt`
export MINIO_ACCESS_KEY_OLD=`cat keys/oldkey.txt`
else
echo "......"
fi
if [ -f "justrotated.txt" ]; then
if [ -f "keys/justrotated.txt" ]; then
echo "Previous key rotation detected...."
echo "Clearing the Lanes...."
unset MINIO_ACCESS_KEY_OLD
unset MINIO_SECRET_KEY_OLD
STARTUP_TYPE=normal
rm justrotated.txt
rm oldsecret.txt
rm oldkey.txt
rm keys/justrotated.txt
rm keys/oldsecret.txt
rm keys/oldkey.txt
else
echo "......"
fi
##########################################
if [ -z "$STARTUP_TYPE" ] || [ "$STARTUP_TYPE" == "rotate" ]; then
touch justrotated.txt
touch keys/justrotated.txt
export MINIO_ACCESS_KEY_OLD=$MINIO_ACCESS_KEY
echo $MINIO_ACCESS_KEY_OLD > oldkey.txt
echo $MINIO_ACCESS_KEY_OLD > keys/oldkey.txt
export MINIO_SECRET_KEY_OLD=$MINIO_SECRET_KEY
echo $MINIO_SECRET_KEY_OLD > oldsecret.txt
echo $MINIO_SECRET_KEY_OLD > keys/oldsecret.txt
export MINIO_ACCESS_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
echo $MINIO_ACCESS_KEY > key.txt
echo $MINIO_ACCESS_KEY > keys/key.txt
export MINIO_SECRET_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
echo $MINIO_SECRET_KEY > secret.txt
echo $MINIO_SECRET_KEY > keys/secret.txt
echo Your New Access Key is: $MINIO_ACCESS_KEY
echo Your New Secret Key is: $MINIO_SECRET_KEY
echo Your Old Access Key is: $MINIO_ACCESS_KEY_OLD