Использование самоподписанного SSL-сертификата
Хотя самоподписанные SSL-сертификаты не будут признаны публичными доверенными центрами сертификации (CA), они всё ещё весьма полезны в локальной разработке и тестировании. Эта статья расскажет, как с использованием встроенного в ServBay инструмента OpenSSL создать самоподписанный SSL-сертификат на базе ECC (эллиптическая кривая) и настроить его в ServBay. В качестве примера мы возьмём servbay.demo
.
Шаг 1: Создание самоподписанного ECC SSL-сертификата
Во-первых, мы рекомендуем использовать ECC-сертификаты, так как они обеспечивают более высокий уровень безопасности и производительности. Ниже приведены конкретные шаги:
Создание приватного ключа ECC
Откройте терминал и выполните следующую команду для создания приватного ключа ECC:
shopenssl ecparam -genkey -name prime256v1 -out servbay_demo.key
1Создание запроса на подписание сертификата (CSR)
Используйте созданный приватный ключ для создания запроса на подписание сертификата:
shopenssl req -new -key servbay_demo.key -out servbay_demo.csr
1В процессе выполнения этой команды вам потребуется ввести некоторую информацию. Пример ввода:
Country Name (2 letter code) [AU]:CN State or Province Name (full name) [Some-State]:Hong Kong Locality Name (eg, city) []:Kowloon Organization Name (eg, company) [Internet Widgits Pty Ltd]:ServBay Organizational Unit Name (eg, section) []:Development Common Name (e.g. server FQDN or YOUR name) []:servbay.demo Email Address []:[email protected]
1
2
3
4
5
6
7Создание самоподписанного сертификата
Используйте CSR и приватный ключ для создания самоподписанного SSL-сертификата, действительного в течение 365 дней:
shopenssl x509 -req -days 365 -in servbay_demo.csr -signkey servbay_demo.key -out servbay_demo.crt
1
Шаг 2: Использование самоподписанного SSL-сертификата в ServBay
После того как вы создали самоподписанный ECC SSL-сертификат, вам нужно настроить его в ServBay. Поместите созданные файлы сертификатов в директорию /Applications/ServBay/ssl
для упрощённого управления и использования.
Переместите файлы сертификатов в указанную директорию
Используйте следующую команду, чтобы переместить созданные файлы сертификатов в директорию
/Applications/ServBay/ssl
:shmv servbay_demo.key /Applications/ServBay/ssl/ mv servbay_demo.crt /Applications/ServBay/ssl/ mv servbay_demo.csr /Applications/ServBay/ssl/
1
2
3Откройте панель управления ServBay
Запустите приложение ServBay и войдите в панель управления.
Добавьте хост
В панели управления выберите опцию
Хост
.Выберите метод подписи SSL-сертификата
В процессе добавления хоста у вас будет возможность выбрать метод подписи SSL-сертификата. Выберите
Custom
.Укажите файлы сертификатов
В полях
certificate key file
иcertificate file
укажите соответствующе созданный файл приватного ключа и файл сертификата:- Файл приватного ключа:
/Applications/ServBay/ssl/servbay_demo.key
- Файл сертификата:
/Applications/ServBay/ssl/servbay_demo.crt
- Файл приватного ключа:
Настройте имя хоста и домен
В поле домена введите
servbay.demo
.Завершите добавление хоста
Следуйте подсказкам для завершения процесса добавления хоста. Теперь ваш хост будет использовать самоподписанный ECC SSL-сертификат.
Проверка настройки
После выполнения вышеуказанных шагов вы можете проверить доступ к хосту через браузер. Если браузер сообщает, что сертификат не доверен, это нормально, так как самоподписанные сертификаты не признаются публичными доверенными центрами сертификации. Вы можете вручную доверять этому сертификату для продолжения доступа.
Заключение
Следуя вышеописанным шагам, вы можете создать и использовать самоподписанный ECC SSL-сертификат в ServBay. Хотя самоподписанные сертификаты не признаются публичными, они предоставляют удобное решение для локальной разработки и тестирования. Надеемся, эта статья поможет вам успешно настроить самоподписанные SSL-сертификаты и повысить эффективность вашей разработки.