Skip to content

Instantly share code, notes, and snippets.

@xPaw
Last active January 1, 2022 20:23
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xPaw/840f378f3fed64806b46211c2287b52c to your computer and use it in GitHub Desktop.
Save xPaw/840f378f3fed64806b46211c2287b52c to your computer and use it in GitHub Desktop.
Localhost certificate
#!/bin/bash
openssl ecparam -name prime256v1 -genkey -out localhost.key
openssl req -new -x509 -days 7300 -out localhost.crt -key localhost.key \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost, DNS:*.localhost, IP:127.0.0.1, IP:::1\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
openssl dhparam -out dhparam.pem 4096
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment