Skip to content

Instantly share code, notes, and snippets.

@nblagoev
Last active January 27, 2021 07:36
Show Gist options
  • Save nblagoev/efb11b708887e5ed965a34787ec98086 to your computer and use it in GitHub Desktop.
Save nblagoev/efb11b708887e5ed965a34787ec98086 to your computer and use it in GitHub Desktop.
Create self-signed certificate
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
-keyout example.key -out example.crt -subj "/CN=example.com" \
-addext "subjectAltName=DNS:example.com,DNS:www.example.net,IP:10.0.0.1"
openssl req -x509 -newkey rsa:4096 -sha256 -days 1825 -nodes \
-keyout example.key -out example.crt -extensions san -config \
<(echo "[req]";
echo distinguished_name=req;
echo "[san]";
echo subjectAltName=DNS:example.com,DNS:www.example.net,IP:10.0.0.1
) \
-subj "/CN=example.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment