Skip to content

Instantly share code, notes, and snippets.

@bestrocker221
Created April 28, 2018 18:09
Show Gist options
  • Save bestrocker221/cd7ff34ae1a35fdf7dc6c27f9c14f644 to your computer and use it in GitHub Desktop.
Save bestrocker221/cd7ff34ae1a35fdf7dc6c27f9c14f644 to your computer and use it in GitHub Desktop.
generate self-signed rsa certificate (4096)
#!/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