Size: 979
Comment:
|
Size: 4225
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from ssl-selfcert | |
Line 14: | Line 15: |
= SSL自己発行証明書(暫定)の作成方法 = | = SSL証明書の作成方法 = === SSL自己発行証明書(暫定)の作成 === |
Line 26: | Line 29: |
=== Let's Encrypt SSL証明書の作成と更新 === 参考 [[https://letsencrypt.jp/|Let'sEncrypt公式ドキュメント_日本語版]]、 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 }}} 必要な証明書のpath (下記のsymbolic linkの元を指定:更新するとlink先のファイル名が変わる) {{{ # ls -l /etc/letsencrypt/live/ribfnewhost.riken.jp/ total 4 -rw-r--r-- 1 root root 682 Nov 7 14:28 README lrwxrwxrwx 1 root root 39 Nov 7 14:28 cert.pem -> ../../archive/ribfnewhost.riken.jp/cert1.pem lrwxrwxrwx 1 root root 40 Nov 7 14:28 chain.pem -> ../../archive/ribfnewhost.riken.jp/chain1.pem lrwxrwxrwx 1 root root 44 Nov 7 14:28 fullchain.pem -> ../../archive/ribfnewhost.riken.jp/fullchain1.pem lrwxrwxrwx 1 root root 42 Nov 7 14:28 privkey.pem -> ../../archive/rribfnewhost.riken.jp/privkey1.pem # }}} 3.証明書の有効期限は3ヶ月なので、cronで自動更新の設定(月に2回〜週に1度程度実行) crontabで月に2回〜週に1度程度の頻度で {{{ certbot renew --webroot-path /var/www/html/ --post-hook "systemctl reload httpd" }}} を実行。注:certbot renew実行時は http/https は外部に対して openしている必要がある. 上記は apache httpd で Document Root を標準の /var/www/html/ として使用している場合。 |
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証明書の作成と更新
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
必要な証明書のpath (下記のsymbolic linkの元を指定:更新するとlink先のファイル名が変わる)
# ls -l /etc/letsencrypt/live/ribfnewhost.riken.jp/ total 4 -rw-r--r-- 1 root root 682 Nov 7 14:28 README lrwxrwxrwx 1 root root 39 Nov 7 14:28 cert.pem -> ../../archive/ribfnewhost.riken.jp/cert1.pem lrwxrwxrwx 1 root root 40 Nov 7 14:28 chain.pem -> ../../archive/ribfnewhost.riken.jp/chain1.pem lrwxrwxrwx 1 root root 44 Nov 7 14:28 fullchain.pem -> ../../archive/ribfnewhost.riken.jp/fullchain1.pem lrwxrwxrwx 1 root root 42 Nov 7 14:28 privkey.pem -> ../../archive/rribfnewhost.riken.jp/privkey1.pem #
3.証明書の有効期限は3ヶ月なので、cronで自動更新の設定(月に2回〜週に1度程度実行)
crontabで月に2回〜週に1度程度の頻度で
certbot renew --webroot-path /var/www/html/ --post-hook "systemctl reload httpd"
を実行。注:certbot renew実行時は http/https は外部に対して openしている必要がある. 上記は apache httpd で Document Root を標準の /var/www/html/ として使用している場合。