Skip to content

Instantly share code, notes, and snippets.

@blackmann
Created September 17, 2022 10:31
Show Gist options
  • Save blackmann/e0a529784bb49037c058cd1df4007430 to your computer and use it in GitHub Desktop.
Save blackmann/e0a529784bb49037c058cd1df4007430 to your computer and use it in GitHub Desktop.
Generate SSL key and cert for localhost
#!/usr/bin/env
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment