Created
April 23, 2024 19:46
-
-
Save BlitzkriegSoftware/ae0ad12e5c77c5f8bebbd9d265449a89 to your computer and use it in GitHub Desktop.
BASH Script to use SSL to make a K8s USER Certificate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "$0 username" | |
exit 1 | |
fi | |
KEY='./user.key' | |
CERT='./user.csr' | |
B64='./user.base64' | |
# The extra / is for bash on Windows, remove it on Linux | |
SUBJ="//CN=$1" | |
openssl genrsa -out $KEY 2048 | |
openssl req -new -key $KEY -out $CERT -subj $SUBJ | |
cat $CERT | base64 | tr -d "\n" > $B64 | |
echo "Subject: ${SUBJ:1} <-- Don't forget what this was (case sensitive)" | |
echo "SSL Private: ${CERT} <-- Do not lose this key" | |
echo "CERT: ${CERT} <-- this is based on your key, but will be different each time generated" | |
echo "base64: ${B64} <-- Give to K8s Admin" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment