Skip to content

Instantly share code, notes, and snippets.

@junkor-1011
Last active September 13, 2020 03:57
Show Gist options
  • Select an option

  • Save junkor-1011/1c4f03608369b6870e4d4583da894e75 to your computer and use it in GitHub Desktop.

Select an option

Save junkor-1011/1c4f03608369b6870e4d4583da894e75 to your computer and use it in GitHub Desktop.
autogenerate openssl key & crt
#!/usr/bin/env sh
# get this script's path
SCRIPT_DIR=$(cd $(dirname $0); pwd)
cd $SCRIPT_DIR
# generate key & crt
openssl req -batch -new -x509 -newkey rsa:4096 -days 3650 -sha256 -nodes \
-subj /CN=example.com \
-addext "subjectAltName=DNS:example.com,DNS:www.example.com" \
-keyout ./server.key \
-out ./server.crt
# chmod
chmod 400 ./server.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment