Я пытаюсь защитить как голый, так и www домен ( https://example.com и https://www.example.com ) с положительным SSL
Для этого сервера cmd будет
openssl req -new -newkey rsa: 2048 -nodes -keyout example.com.key -out example.com.csr
или что-то еще?
Сервер: Ubuntu 18.04 и Ngnix + Apache Спасибо
Вы рядом: используйте метод подстановки и увеличьте размер ключа
openssl req -new -newkey rsa:4096 -nodes -out star_friends.com.csr -keyout star_friends.com.key -subj "/C=GH/ST=Greater-Accra/L=Accra/O=Friends LTD./CN=*.friends.com"
Создайте файл со следующим (измененным в соответствии с вашими именами) и сохраните его (например) как example.cnf
в выбранном вами каталоге:
[ req ]
prompt = no
string_mask = default
# The size of the keys in bits:
default_bits = 2048
distinguished_name = req_dn
req_extensions = req_ext
[ req_dn ]
# Note that the following are in 'reverse order' to what you'd expect to see in
# Windows and the numbering is irrelevant as long as each line's number differs.
# Domain Components style:
# Server name:
# 2.DC = com
# 1.DC = example
# commonName = Acme Web Server
# Locality style:
# countryName = GB
# stateOrProvinceName = London
# localityName = Letsby Avenue
# organizationName = Acme
# 1.organizationalUnitName = IT Dept
# 2.organizationalUnitName = Web Services
# commonName = Acme Web Server
# Or traditional org style:
countryName = GB
organizationName = Acme
1.organizationalUnitName = IT Dept
2.organizationalUnitName = Web Services
commonName = Acme Web Server
# Or:
# commonName = www.example.com
[ req_ext ]
subjectAltName = @alt_names
[alt_names]
# To automatically copy the CN (in the case of a DNS name in the CN) use:
# DNS.1 = ${req_dn::commonName}
DNS.1 = www.example.com
DNS.2 = example.com
Выполните следующее, чтобы создать CSR:
openssl req -nodes -new -keyout example.key -out example.csr -config example.cnf
Обратите внимание, что это оставляет закрытый ключ в виде обычного текста в вашей системе. В зависимости от того, с какой службой вы используете этот ключ, вы можете захотеть защитить его паролем, удалив глагол -nodes
из команды.