Skip to content

Instantly share code, notes, and snippets.

@dcmwong
Last active May 21, 2021 08:48
Show Gist options
  • Save dcmwong/871d567433ab95b07bb3803e223745a4 to your computer and use it in GitHub Desktop.
Save dcmwong/871d567433ab95b07bb3803e223745a4 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Private key for the root cert
openssl genrsa -out private.key 4096
# root certificate
openssl req -x509 -new -nodes -key private.key -subj "/C=<YOUR COUNTRY CODE>/ST=<YOUR STATE>/O=<YOUR ORG>/CN=<YOUR DOMAIN>" -sha256 -days 365 -out public.crt
# Private key for the server cert
openssl genrsa -out server.key 2048
# Signing request for the server
# openssl req -new -key stubhub.key -out stubhub.csr
openssl req -new -key server.key -subj "/C=<YOUR COUNTRY CODE>/ST=<YOUR STATE>/O=<YOUR ORG>/CN=<YOUR DOMAIN>" -out server.csr
# Server cert using the root certificate
openssl x509 -req -in server.csr -CA public.crt -CAkey private.key -CAcreateserial -out server.crt -days 365 -sha256
@dcmwong
Copy link
Author

dcmwong commented May 21, 2021

Generates all certificates to be used on a TLS server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment