Monday, February 5, 2018

Create SAN certificate CSR on macOS

Steps to create SAN certificate CSR on your MacOS

Assuming that your domains are the following 4 domains

Step 1:

#Open your terminal app and create a file called sancert.cnf

Step 2:

#In this new file you just created insert the following lines of text.

[ req ]
default_bits        = 2048
distinguished_name = req_distinguished_name
req_extensions              = req_ext

[ req_distinguished_name ]
countryName                  = Country Name (2 letter code)
stateOrProvinceName    = State or Province Name (full name)
localityName              = Locality Name (eg, city)
organizationName    = Organization Name (eg, company)
commonName      = Common Name (e.g. server FQDN or YOUR name)

[ req_ext ]
subjectAltName = @alt_names

DNS.1   =
DNS.2   =
DNS.3   =
DNS.4   =
DNS.5   =

Step 3:
Save your file and go back to your terminal app.

Step 4:

# In your terminal, type the following command (in the same dir as the file you just created)

$ openssl req -out sslcert-example.csr -newkey rsa:2048 -nodes -keyout sslcert-example.key -config sancert.cnf

This will create 2 files. 
1.  sslcert-example.csr
2.  sslcert-example.key