Created
April 28, 2018 18:09
-
-
Save bestrocker221/cd7ff34ae1a35fdf7dc6c27f9c14f644 to your computer and use it in GitHub Desktop.
generate self-signed rsa certificate (4096)
This file contains hidden or 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 [ $# -ne 1 ]; then | |
echo "usage: <hostname>" | |
exit 1 | |
fi | |
CN=$1 | |
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out ${CN}.key | |
openssl req -new -sha256 -key ${CN}.key -out ${CN}.csr \ | |
-subj "/C=OK/ST=ciao/L=ciao/O=ciao/OU=OK/CN=${CN}" | |
openssl x509 -req -days 1095 -in ${CN}.csr -signkey ${CN}.key -out ${CN}.crt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment