Skip to content

Instantly share code, notes, and snippets.

@eXenon
Forked from thbkrkr/gen-ssl.sh
Created November 24, 2020 15:58
Show Gist options
  • Save eXenon/eefe9e22b5be2ae94937ad6487e31b66 to your computer and use it in GitHub Desktop.
Save eXenon/eefe9e22b5be2ae94937ad6487e31b66 to your computer and use it in GitHub Desktop.
Generate Self-Signed SSL Certificate without prompt
# Generate a passphrase
openssl rand -base64 48 > passphrase.txt
# Generate a Private Key
openssl genrsa -aes128 -passout file:passphrase.txt -out server.key 2048
# Generate a CSR (Certificate Signing Request)
openssl req -new -passin file:passphrase.txt -key server.key -out server.csr \
-subj "/C=FR/O=krkr/OU=Domain Control Validated/CN=*.krkr.io"
# Remove Passphrase from Key
cp server.key server.key.org
openssl rsa -in server.key.org -passin file:passphrase.txt -out server.key
# Generating a Self-Signed Certificate for 100 years
openssl x509 -req -days 36500 -in server.csr -signkey server.key -out server.crt
mv server.crt ssl.crt
mv server.key ssl.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment