Skip to content

Instantly share code, notes, and snippets.

@rbonestell
Created June 29, 2024 14:56
Show Gist options
  • Save rbonestell/097f58a38d6a81c128e99af05ab89f72 to your computer and use it in GitHub Desktop.
Save rbonestell/097f58a38d6a81c128e99af05ab89f72 to your computer and use it in GitHub Desktop.
Create a self-signed SSL certificate for local development and testing
#!/bin/bash
# SSL certificates should have a validity period of less than 398 days
# * https://chromium.googlesource.com/chromium/src/+/master/net/docs/certificate_lifetimes.md
# * https://support.apple.com/en-us/102028
# Create Private Key
openssl genrsa -out key.pem 2048
# Create Certificate Signing Request
openssl req -new -sha256 -key key.pem -out csr.csr
# Generate Self-Signed Certificate
openssl req -x509 -sha256 -days 397 -key key.pem -in csr.csr -out cert.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment