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

www.example.com
www.example1.com
www.example2.com
www.example3.com
www.example4.com


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

[alt_names]
DNS.1   = www.example.com
DNS.2   = www.example1.com
DNS.3   = www.example2.com
DNS.4   = www.example3.com
DNS.5   = www.example4.com


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