Last active
January 23, 2022 18:36
-
-
Save liorkesos/0c76745b2d4e4ef610cddc892ce0b2d9 to your computer and use it in GitHub Desktop.
SSL script
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 | |
DOMAIN="k3s.lab" | |
if [ $# -eq 0 ]; then | |
echo "No arguments provided for your domain - $DOMAIN" | |
exit 1 | |
fi | |
PREFIX=$1 | |
FQDN="$PREFIX.$DOMAIN" | |
SUBJ="/C=IL/ST=Shfela/L=Ashdod/O=IT/CN=$FQDN" | |
KEYPEM=$PREFIX-key.pem | |
CERTPEM=$PREFIX-cert.pem | |
CACERTSPEM=$PREFIX-cacerts.pem | |
openssl genrsa 2048 > $KEYPEM | |
openssl req -new -x509 -nodes -sha1 -subj "$SUBJ" -days 3650 -key $KEYPEM > $CERTPEM | |
openssl req -x509 -new -nodes -key $KEYPEM -sha256 -subj "$SUBJ" -days 3650 -out $CACERTSPEM | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment