Make a copy of openssl.cnf:
cd /var/tmp
mkdir mySSL
cp /usr/share/ssl/openssl.cnf /var/tmp/mySSL/myssl.cnf
Insert SAN names into myssl.cnf.
Edit the custom openssl.cnf file (/var/tmp/mySSL/myssl.cnf) and add the following information to the end of the file:
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 =
DNS.2 =
DNS.3 =
DNS.4 =
...
DNS.x =
For example:
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = www.example.com
DNS.2 = test.example.com
DNS.3 = mail.example.com
DNS.4 = www.example.net
Create the certificate request:
openssl req -new -nodes -newkey rsa:2048 -config /var/tmp/mySSL/myssl.cnf -reqexts req_ext -keyout /var/tmp/mySSL/www.example.com.key -out /var/tmp/mySSL/www.example.com.csr