"Creating self-signed SSL certificates using the OpenSSL tool on Ubuntu"

Материал из SmartPlayer
Версия от 16:06, 23 ноября 2023; N.Bloshkin (обсуждение | вклад) (Новая страница: «'''Example of Entering Information:'''<br> <code>Country Name (2 letter code) [AU]:RU<br> State or Province Name (full name) [Some-State]:Moscow<br> Locality Name (eg, city) []:Moscow City<br> Organization Name (eg, company) [Internet Widgits Pty Ltd]:SmartPlayer<br> Organizational Unit Name (eg, section) []:IT Department<br> Common Name (e.g. server FQDN or YOUR name) []: smartplayer.org<br> Email Address []:example@smartplayer.org </code><br> '''Important!...»)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

Creating Self-Signed SSL Certificates Using OpenSSL on Ubuntu

Installing OpenSSL

The first step is to install OpenSSL. To install OpenSSL, execute the following command:
sudo apt update
sudo apt install openssl

Creating a Directory for Certificates

The second step is creating a directory for the certificates. For convenience, it is recommended to create a separate directory where the certificates will be stored:
mkdir ~/certificates
cd ~/certificate

Generating a Private Key

The third step is generating a private key. A private key needs to be created using the following command.
openssl genpkey -algorithm RSA -out example.com.key
In this command, replace example.com.key with the name of your key.
When executing the command, you will be prompted to enter a password for the private key. This password will be used every time you access the private key, so make sure it is securely stored.

Creating a Self-Signed Certificate

It is necessary to create a self-signed certificate using the generated private key: openssl req -x509 -new -key example.com.key -out example.com.crt
After executing this command, OpenSSL will ask you to enter information about the certificate. The necessary information may include: country, province, city, etc. This information will be included in the self-signed certificate. Example of Entering Information:
Country Name (2 letter code) [AU]:RU
State or Province Name (full name) [Some-State]:Moscow
Locality Name (eg, city) []:Moscow City
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SmartPlayer
Organizational Unit Name (eg, section) []:IT Department
Common Name (e.g. server FQDN or YOUR name) []: smartplayer.org
Email Address []:example@smartplayer.org

Important! The "Common Name" should contain the domain name of your website. It's necessary to fill in all fields accordingly.
In the "~/certificates" directory, the self-signed certificate example.com.crt and the private key example.com.key will be located. This certificate can be used for testing or internal purposes.

Self-signed certificates will not be trusted by browsers by default. As such, they will trigger warning pop-ups.