LoginSignup
0
1

More than 1 year has passed since last update.

openssl自己証明書実行手順

Posted at
  • 認証局の公開鍵と秘密鍵を作成
    openssl genrsa -out ca_private_pem.key 2048
    openssl rsa -in ca_private_pem.key -pubout -out ca_public_pem.key

  • 認証局のサーバ証明書
    openssl req -new -x509 -days 365 -key ca_private_pem.key -out ca_server_pem.crt

  • webサーバ用の公開鍵と秘密鍵作成
    openssl genrsa -out web_private_pem.key 2048
    openssl rsa -in web_private_pem.key -pubout -out web_public_pem.key

  • CSR
    openssl req -new -key web_private_pem.key -out web_server_pem.csr

  • v3.ext
    authorityKeyIdentifier=keyid, issuer
    basicConstraints=CA:FALSE
    keyUsage = digitalSignature, nonRepudiation, keyEncipherment
    subjectAltName = @alt_names

[alt_names]
DNS.1 = ec2-XXXXXXXX.ap-northeast-1.compute.amazonaws.com

③webサーバ用の証明書発行

openssl x509 -req -sha256 -extfile v3.ext -days 365 -CA ca_server_pem.crt -CAkey ca_private_pem.key -CAcreateserial -in web_server_pem.csr -out web_server_pem.crt

④apache関連の設定ファイル

  • ssl.confを利用するために必要なモジュールのインストール
インストール後ssl.confが使えるようになる
yum install mod_ssl
sudo vi /etc/httpd/conf.d/ssl.conf

・・・・・・ファイルの中を変更・・・・・

SSLCertificateFile /etc/pki/tls/certs/localhost.crt

SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

↓変更

SSLCertificateFile /home/ec2-user/web_server_pem.crt

SSLCertificateKeyFile /home/ec2-user/web_private_pem.key
・・・・・・・・・・・・・・・・・・・・・

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1