Skip to content

Instantly share code, notes, and snippets.

@liorkesos
Last active January 23, 2022 18:36
Show Gist options
  • Save liorkesos/0c76745b2d4e4ef610cddc892ce0b2d9 to your computer and use it in GitHub Desktop.
Save liorkesos/0c76745b2d4e4ef610cddc892ce0b2d9 to your computer and use it in GitHub Desktop.
SSL script
#!/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