Reduce SSL cost and maintenance by using single certificate for multiple websites using SAN certificate
SAN stands for “Subject Alternative Names” and this helps you to have a single certificate for multiple CN (Common Name). You might be thinking this is wildcard SSL but let me tell you – it’s slightly different. In SAN certificate, you can have multiple complete CN.
For ex: –
I can have above all and much more in a just single certificate. This means I just have to buy one cert and use in multiple URLs. Sounds interesting?
Creation of CSR for SAN is slightly different than traditional OpenSSL command and will explain in a while how to generate CSR for Subject Alternative Names SSL certificate.
Let’s take a look at a real-time example of skype.com, which has many SAN in a single certificate.
As you can see above example – if you are managing multiple https URL, you may consider consolidating into single SSL Cert with SAN and save thousands of dollars. What do you think about this?
Procedure to create CSR with SAN
- Login into server where you have OpenSSL installed
- Go to /tmp or create any directory
- Create a file named san.cnf using vi (if on Unix) with the following information
[ 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 = bestflare.com DNS.2 = usefulread.com DNS.3 = chandank.com
Note: alt_names section is the one you have to change for additional DNS.
- Save the file and execute following OpenSSL command, which will generate CSR and KEY file
openssl req -out sslcert.csr -newkey rsa:2048 -nodes -keyout private.key -config san.cnf
This will create sslcert.csr and private.key in the present working directory. You have to send sslcert.csr to certificate signer authority so they can provide you a certificate with SAN.
How to verify CSR for SAN?
It will be a good idea to check if your CSR contains the SAN, which you specified above in san.cnf file.
openssl req -noout -text -in sslcert.csr | grep DNS
[root@Chandan test]# openssl req -noout -text -in sslcert.csr | grep DNS DNS:bestflare.com, DNS:usefulread.com, DNS:chandank.com [root@Chandan test]#
You can also use online tools to verify SAN and other many parameters. I hope this helps you to understand SAN Certificate.