Skip to content

Instantly share code, notes, and snippets.

@achesco
achesco / generate-pg-ssl.md
Last active August 16, 2024 22:09
Generate self-signed SSL certificates for PostgreSQL server and client

CNs are important!!! -days 3650

Create a Certificate Signing Request (CN=localhost)

umask u=rw,go= && openssl req -days 3650 -new -text -nodes -subj '/C=US/ST=Massachusetts/L=Bedford/O=Personal/OU=Personal/[email protected]/CN=localhost' -keyout server.key -out server.csr

Generate self-signed certificate

umask u=rw,go= && openssl req -days 3650 -x509 -text -in server.csr -key server.key -out server.crt