Назад | Перейти на главную страницу

CSR для Nginx + Apache Server как с голым, так и с www доменом

Я пытаюсь защитить оба голый и www домен ( https://example.com и https://www.example.com ) с положительными sl

  1. Для этого сервера cmd будет

    openssl req -new -newkey rsa: 2048 -nodes -keyout example.com.key -out example.com.csr

или было бы что то другое?

  1. Чтобы защитить как голый, так и www домен, когда сервер запрашивает общее имя: что мы должны указать? example.com или * example.com

Сервер - Ubuntu 18.04 и Ngnix + Apache Спасибо

Создайте файл со следующим (измененным в соответствии с вашими именами) и сохраните его (например) 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 глагол от команды.

Вы близки: используйте подход с использованием подстановочных знаков и увеличьте размер ключа

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"