Fedora 36にSSL証明書を作成する方法
環境
OSバージョンを確認します
# cat /etc/redhat-release Fedora release 36 (Thirty Six)
SSL証明書の作成手順
1.SSL証明書を作成します
# cd /etc/pki/tls/certs
# openssl genrsa -aes128 2048 > server.key
Enter PEM pass phrase: # パスフレーズ設定 Verifying - Enter PEM pass phrase: # 再入力
2.秘密鍵からパスフレーズを削除します
# openssl rsa -in server.key -out server.key Enter pass phrase for server.key: writing RSA key
3.server.csr証明書を生成します
# openssl req -utf8 -new -key server.key -out server.csr
You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:JP # 国 State or Province Name (full name) []:Tokyo # 県 Locality Name (eg, city) [Default City]:Shinagawa # 都市 Organization Name (eg, company) [Default Company Ltd]:Arkgame # 組織名 Organizational Unit Name (eg, section) []:arkgame.com # 組織の部門名 Common Name (eg, your name or your server's hostname) []:arkgame.com # サーバー名 Email Address []:contact@arkgame.com # 管理者アドレス Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:arkgame An optional company name []:argame
4.有効期限が 10 年の自己署名証明書を作成します
# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650
Certificate request self-signature ok subject=C = JP, ST = Tokyo, L = ARKGAME, O = Arkgame, OU = arkgame.com, CN = contact@arkgame.com, emailAddress = contact@arkgame.com
権限を付与します
# chmod 600 server.key
5.証明書を確認します
# ll server.* -rw-r--r--. 1 root root 1354 5月 22 10:46 server.crt -rw-r--r--. 1 root root 1131 5月 22 10:44 server.csr -rw-------. 1 root root 1704 5月 22 10:26 server.key