Skip to content

Instantly share code, notes, and snippets.

@vastus
Created January 16, 2025 06:50
Show Gist options
  • Save vastus/026823c062aa6939a402f44dd5f5f1e3 to your computer and use it in GitHub Desktop.
Save vastus/026823c062aa6939a402f44dd5f5f1e3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage:
# $ sh mkcert example.com
set -euo pipefail
main() {
DOMAIN="$1"
local key="${KEY:-$DOMAIN.pem}"
local crt="${CRT:-$DOMAIN.crt}"
# create self-signed cert
openssl req -x509 -noenc -newkey rsa:2048 -keyout "$key" -out "$crt" \
-subj "/C=US/ST=WA/CN=$DOMAIN"
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment