20160830 fukuoka.php vol18
TRANSCRIPT
![Page 1: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/1.jpg)
Fukuoka.phpLet’s Encrypt 導入してみた
![Page 2: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/2.jpg)
Copyright Catchup, Inc. All Rights Reserved.2
自己紹介
権藤です。
よろしくお願いします。
キャッチアップで働いてます。
TW: gondoh_jp
FB: 権藤 隆行
![Page 3: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/3.jpg)
前提
![Page 4: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/4.jpg)
Copyright Catchup, Inc. All Rights Reserved.4
Let’s Encrypt ってなんなん?Let’s Encrypt の概要
Let's Encrypt は、無料で利用できる自動化されていてオープンな認証局( CA )です。公共の利益を図る目的で Internet Security Research Group (ISRG) が運営しています。
![Page 5: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/5.jpg)
Copyright Catchup, Inc. All Rights Reserved.5
Internet Security Research Group ってなに?
Let's Encrypt を運営している Internet Security Research Group ( 略称: ISRG) は、アメリカ合衆国カリフォルニア州にある公益法人で、アメリカ合衆国内国歳入法 Section 501(c)(3) による非課税法人として、アメリカ合衆国内国歳入庁 (IRS) による承認を受けています。
インターネットを介した安全な通信を行う際の、経済面・技術面・教育面での障壁を減らすことが、 ISRG の使命です。
ISRG は、誰もがより安全なインターネットがに興味を持つことで、公共の利益のためのデジタル基盤を提供する取り組みを一緒に行うことを可能にするという模範を示すことができると信じています。
非営利団体やフォーチュン 100 企業などの様々な組織からが ISRG をサポートしています。スポンサーの一覧については Current Sponsors ( 英文 ) をご覧ください。
![Page 6: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/6.jpg)
なにやって
くれるんや?
![Page 7: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/7.jpg)
Copyright Catchup, Inc. All Rights Reserved.7
Let's Encrypt の基本方針
1. 無料
ドメイン名を所持している人であれば、 Let‘s Encrypt を使うことで、誰でも信頼された証明書を無料で取得できます。
![Page 8: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/8.jpg)
Copyright Catchup, Inc. All Rights Reserved.8
Let's Encrypt の基本方針
2. 運用自動化
ウェブサーバ上で動作しているソフトウェアが、面倒な手間無しに Let's Encrypt から証明書を取得することができます。
これらの仕組みは、安全に構成されており、証明書の更新も自動化できます。
![Page 9: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/9.jpg)
Copyright Catchup, Inc. All Rights Reserved.9
Let's Encrypt の基本方針
3. 安全
Let‘s Encrypt は、認証局( CA )サイドとウェブサイト管理者の安全なサーバ構築の補助の両面から、最先端の TLS を実装したプラットフォームを提供します。
![Page 10: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/10.jpg)
Copyright Catchup, Inc. All Rights Reserved.10
Let's Encrypt の基本方針
4. 透明性
証明書の発行と失効( revoke )は、公式に記録されます。
これらの記録は一般公開され、誰でも監査することができます。
![Page 11: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/11.jpg)
Copyright Catchup, Inc. All Rights Reserved.11
Let's Encrypt の基本方針
5. オープン
証明書の自動発行・更新プロトコルは、不特定多数が採択可能なオープン標準( Open Standard )として公表されています。
![Page 12: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/12.jpg)
Copyright Catchup, Inc. All Rights Reserved.12
Let's Encrypt の基本方針
6. 助け合い・協力
Let's Encrypt は、下層のインターネット・プロトコルのようなコミュニティの利益のための共同の取り組みであって、 1 つの組織によって統制されているものではありません。
![Page 13: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/13.jpg)
わかりやすくゆうてや
![Page 14: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/14.jpg)
Copyright Catchup, Inc. All Rights Reserved.14
何が出来るか
公開された技術による公益的かつ無料で安全な SSL 証明書の提供。
![Page 15: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/15.jpg)
翻訳サイトあるで
![Page 16: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/16.jpg)
Copyright Catchup, Inc. All Rights Reserved.16
公式サイトの翻訳サイト
https://letsencrypt.jp/
このページは、 Let's Encrypt Frequently Asked Questions (FAQ) の全文を和訳(意訳)した上で、補足説明などを加えたものです。詳しくは 翻訳記事の出典と留意事項 をご覧ください。
![Page 17: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/17.jpg)
導入
![Page 18: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/18.jpg)
Copyright Catchup, Inc. All Rights Reserved.18
今回の構成
ユーザ サイトwww
CentOS7
nginx
Apache
PHP
MariaDB
![Page 19: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/19.jpg)
Copyright Catchup, Inc. All Rights Reserved.19
今回の構成
ユーザ サイトwww
CentOS7
nginx
Apache
PHP
MariaDB
暗号化
![Page 20: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/20.jpg)
Copyright Catchup, Inc. All Rights Reserved.20
SSL 証明書発行の準備
ssh ログイン
yum install -y git openssl mod_sslcd /usr/localgit clone https://github.com/letsencrypt/letsencryptcd letsencrypt./letsencrypt-auto --help –debug
以上で準備完了
![Page 21: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/21.jpg)
Copyright Catchup, Inc. All Rights Reserved.21
発行する
ssh ログイン
./letsencrypt-auto certonly --standalone -d blog.gufii.net
![Page 22: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/22.jpg)
Copyright Catchup, Inc. All Rights Reserved.22
OKOK
![Page 23: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/23.jpg)
Copyright Catchup, Inc. All Rights Reserved.23
ん?
![Page 24: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/24.jpg)
Copyright Catchup, Inc. All Rights Reserved.24
翻訳(ごんどう直感)
Let’s さん「 nginx たらいうプロセス
id 24428 で動いとるプログラムが
TCP ポート 80番つことるやんけ。
とめてやりなおせーや」
![Page 25: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/25.jpg)
Copyright Catchup, Inc. All Rights Reserved.25
感想(ごんどう直感)
そういえば 2ch の Let’s Encryptスレで証明書の請求 80番ポート
から動かせねーのかつって議論し
てたな・・・
![Page 26: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/26.jpg)
Copyright Catchup, Inc. All Rights Reserved.26
nginx を停止してやってみる出来たっぽい\ (^o^)/
IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/blog.gufii.net/fullchain.pem. Your cert will expire on 2016-11-08. To obtain a new or tweaked version of this certificate in the future, simply run letsencrypt-auto again. To non-interactively renew *all* of your certificates, run "letsencrypt-auto 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
![Page 27: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/27.jpg)
Copyright Catchup, Inc. All Rights Reserved.27
設定を変更する発行した証明書を nginxのconfに記述して再起動
server { listen 443 default ssl; server_name blog.gufii.net blog2.gufii.net; root /var/www/blog.gufii.net/html; index index.php index.php;
ssl on; ssl_certificate /etc/letsencrypt/live/blog.gufii.net/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/blog.gufii.net/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location / { #proxy_pass http://localhost:8080/; proxy_pass http://backend; #proxy_redirect default; }}
![Page 28: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/28.jpg)
Copyright Catchup, Inc. All Rights Reserved.28
出来た!
![Page 29: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/29.jpg)
Copyright Catchup, Inc. All Rights Reserved.29
自動更新
有効期間は 90日間です。
自動的に更新されるようにしよう。
/usr/local/letsencrypt/letsencrypt-auto certonly --webroot --webroot-path /var/www/blog.gufii.net/html --register-unsafely-without-email --renew-by-default -d blog.gufii.net --agree-tos && systemctl restart nginx
renew コマンドが追加されたようです。
![Page 30: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/30.jpg)
Copyright Catchup, Inc. All Rights Reserved.30
ちなみに
standaloneモードと webrootモードがあります。最近翻訳サイトの方にも解説が追加されました。
https://letsencrypt.jp/docs/using.html#standalonehttps://letsencrypt.jp/docs/using.html#webroot
ドメイン利用者の確認のために利用します。
![Page 31: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/31.jpg)
これがやりたかったんや
![Page 32: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/32.jpg)
Copyright Catchup, Inc. All Rights Reserved.32
サブドメイン 1000件で発行してみた
<?php$command = "./letsencrypt-auto certonly --standalone ”;for($i = 0; $i < 1000; $i++) {
$command .= "-d blog{$i}.gufii.net ”;}exec($command);
![Page 33: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/33.jpg)
Copyright Catchup, Inc. All Rights Reserved.33
・・・・An unexpected error occurred:There were too many requests of a given type :: Error creating new authz :: Too many currently pending authorizations.Please see the logfiles in /var/log/letsencrypt for more details.怒られ t
![Page 34: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/34.jpg)
Copyright Catchup, Inc. All Rights Reserved.34
発行制限公式に書いてました。
https://letsencrypt.org/docs/rate-limits/・ 1 証明書で 100 ドメインまで
・ 1週間に 20 証明書まで
1週間で最大 2,000 ドメインを対象とした証明書が発行できる。
※ ただし 1IP アドレスから 3時間で 500 ドメインまでだよ
翻訳間違ってたら誰かおしえてね
![Page 35: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/35.jpg)
雑感
![Page 36: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/36.jpg)
Copyright Catchup, Inc. All Rights Reserved.36
かなりいい3サイト( 20 ドメイン)程度導入しました。
SNI (Server Name Indication) も対応端末が増えた。・ Internet Explorer7 ( Windows Vista )以降 ※Windows XP は非対応です。・ Mozilla Firefox 2.0 以降・ Google Chrome ・ Safari 3.0 以降・ iOS 4 以降の MobileSafari・ Android Honeycomb 3 以降・ Windows Phone 7 以降
![Page 37: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/37.jpg)
おわり
![Page 38: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/38.jpg)
広告
![Page 39: 20160830 Fukuoka.php vol18](https://reader036.vdocuments.net/reader036/viewer/2022062821/58a4dc661a28ab34318b5f25/html5/thumbnails/39.jpg)
Copyright Catchup, Inc. All Rights Reserved.39
求人 キャッチアップは PHPエンジニアをハゲしく募集しています。