Revision 9 as of 2018-11-13 04:46:27

Clear message
Locked History Actions

ssl-cert

SSL証明書の作成方法

SSL自己発行証明書(暫定)の作成

1. opensslを使用してSHA1で署名する場合(期限10年)

openssl genrsa -out test.key 2048
openssl req -new -key test.key -x509 -days 3652 -out test.crt -sha1

内容の確認方法

openssl x509 -text -noout -in test.crt

Let's Encrypt SSL証明書の作成

参考 Let's Encrypt 総合Let's Encryptの使い方Let's Encrypt ユーザーガイド

SL7/CentOS7の場合

1.certbotを epelからインストール

# yum install epel-release
# yum install certbot python-certbot-apache

2. httpdを停止して、初期の証明書ファイルを作成 (注:あらかじめ、SSL自己発行証明書でセキュリティ監査を受け、http/https は外部にopenしていること) -d の後に、証明したいホストのFQDNを記述する。

# systemctl stop httpd
# certbot certonly --standalone -d ribfnewhost.riken.jp

その後、自分のEmailアドレスを入力、規約を読み承諾(A)gree する。後半の選択(share your email address with the Electronic Frontier Foundation)は、必要があれば承諾する(無理に承諾する必要はない)その後、以下のようにSSL証明書が作成されるので、これらを /etc/httpd/conf.d/ssl.conf中で指定。

Starting new HTTPS connection (1): supporters.eff.org
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for ribfnewhost.riken.jp
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/ribfnewhost.riken.jp/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/ribfnewhost.riken.jp/privkey.pem
   Your cert will expire on 2019-02-05. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

3.証明書の有効期限は3ヶ月なので、cronで自動更新の設定(月に2回〜週に1度程度実行)

crontabで月に2回〜週に1度程度の頻度で

certbot renew

を実行(certbot実行時は http/https は外部に対して openしている必要がある)