Skip to content

Instantly share code, notes, and snippets.

@crhntr
Last active June 2, 2020 21:42
Show Gist options
  • Save crhntr/bec9af84367b36555dbe14f63cd32779 to your computer and use it in GitHub Desktop.
Save crhntr/bec9af84367b36555dbe14f63cd32779 to your computer and use it in GitHub Desktop.
Generates self-signed certificate authority (CA) and SSL keys for MySQL server (the following were tested with Percona) with localhost in subject alternative name (SAN) for text fixures
openssl req -x509 -new -batch -nodes -sha256 -days 90 -subj "/CN=ca" -keyout ca-key.pem -out ca.pem
openssl req -new -sha256 -nodes -subj "/CN=localhost" -keyout server-key.pem -out server-cert.csr
openssl x509 -req -days 90 -sha256 -CAcreateserial -extfile <(printf "subjectAltName=DNS:127.0.0.1,DNS:0.0.0.0") -in server-cert.csr -CA ca.pem -CAkey ca-key.pem -out server-cert.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment