A script to take some of the toil out of generating a self-signed .key and .pem / a .key and a .csr for external signing.
- Richer detail (country, organisation, etc) not exposed
Setup
- Download
generate-ssl-key-and-csr-and-pem.sh
and probablychmod +x
it
Generate a self-signed .key and .pem
# will output ssl.key and ssl.pem
SELF_SIGNED=1 FQDN=some-server.some-domain.org.au ./generate-ssl-key-and-csr-and-pem.sh
Generate a .key and .csr for external signing
# will output ssl.key and ssl.csr
SELF_SIGNED=0 FQDN=some-server.some-domain.org.au ./generate-ssl-key-and-csr-and-pem.sh
Environment variables
Confirm with ./generate-ssl-key-and-csr-and-pem.sh --help
; but in summary:
SELF_SIGNED
- toggle between a self-signed .key and .pem or a .key and a .csr for external signingFQDN
- the FQDN to generate .key / .pem / .csr files forDAYS
- the number of days to generate .key / .pem / .csr files for (default 397)SSL_KEY
- path for .key (defaultssl.key
)SSL_PEM
- path for .key (defaultssl.pem
)SSL_CSR
- path for .key (defaultssl.csr
)RSA_BITS
- path for .key (default 4096)
SELF_SIGNED=1 FQDN=some-server.some-domain.org.au bash <(curl -s -L 'https://gist.githubusercontent.com/initialed85/afc97fc40e4a2715d831fd69a9629659/raw/4c755bf09296a0dfae5eb60c13c9afeb9b79dbdc/generate-ssl-key-and-csr-and-pem.sh')