Skip to content

Instantly share code, notes, and snippets.

@sturadnidge
Created July 14, 2017 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sturadnidge/c6351940d84896107608e41f5417f20a to your computer and use it in GitHub Desktop.
Save sturadnidge/c6351940d84896107608e41f5417f20a to your computer and use it in GitHub Desktop.
Config file to generate a certificate signing request for 12factor.com for use with PCF (ie all required SANs)
[req]
default_bits = 2048
default_md = sha256
distinguished_name = subject
encrypt_key = no
prompt = no
req_extensions = req_ext
[subject]
countryName = AU
stateOrProvinceName = NSW
localityName = Sydney
organizationName = 12factor
commonName = 12factor.com
emailAddress = admin@12factor.com
[req_ext]
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = *.12factor.com
DNS.1 = *.apps.12factor.com
DNS.3 = *.system.12factor.com
DNS.4 = *.login.system.12factor.com
DNS.5 = *.uaa.system.12factor.com
@sturadnidge
Copy link
Author

Generate a new private key and a request
openssl req -newkey rsa:2048 -nodes -keyout 12factor.key -config 12factor.req -out 12factor.csr

Use an existing private key and generate a request
openssl req -new -config 12factor.req -key 12factor.key -out 12factor.csr

@sturadnidge
Copy link
Author

When you get the cert back from the issuing CA (see https://gist.github.com/sturadnidge/67bc038f00db65690e8a61951f734c51 for how to set up an issuing CA), combine things to get a .pem:

cat 12factor.key 12factor.cert > 12factor.pem

If you need to extract the public key:

openssl x509 -pubkey -noout -in 12factor.pem > 12factor.pub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment