Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
コンテンツにスキップ
メインメニュー
メインメニュー
サイドバーに移動
非表示
案内
メインページ
目次
コミュニティに貢献
最近の出来事
おまかせ表示
特別ページ
交流
ヘルプ
貢献
最近の更新
最近の議論
新しいページ
統計
リクエスト
ArchWiki
検索
検索
表示
アカウント作成
ログイン
個人用ツール
アカウント作成
ログイン
Certbotのソースを表示
ページ
議論
日本語
閲覧
ソースを閲覧
履歴を表示
ツール
ツール
サイドバーに移動
非表示
操作
閲覧
ソースを閲覧
履歴を表示
全般
リンク元
関連ページの更新状況
ページ情報
表示
サイドバーに移動
非表示
←
Certbot
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:ネットワーク]] [[Category:暗号化]] [[Category:コマンド]] [[Category:Electronic Frontier Foundation]] [[en:Let’s Encrypt]] [[ru:Let’s Encrypt]] [https://github.com/certbot/certbot Certbot] は Python で書かれた [https://www.eff.org/ Electronic Frontier Foundation] の [[ACME]] クライアントです。ウェブサーバの自動設定や HTTP チャレンジのためのビルトインウェブサーバといった便利な機能を持ちます。 Certbot は [https://letsencrypt.org/ Let's Encrypt] に推奨されています。 == インストール == {{Pkg|certbot}} パッケージを[[インストール]]してください。 発行された証明書はプラグインを使ってウェブサーバーに自動的に設定・インストールできます: * [[Nginx]] 用のプラグインは {{Pkg|certbot-nginx}} パッケージに入っています。 * [[Apache HTTP Server]] 用のプラグインは {{Pkg|certbot-apache}} パッケージで使えます。 == 設定 == 証明を作成・インストールする方法は [https://certbot.eff.org/docs/ Certbot のドキュメント] を参照してください。 === プラグイン === {{Warning|プラグインを使用すると設定ファイルが上書きされます。先に設定ファイルのバックアップを作成することを推奨します。}} ==== Nginx ==== {{pkg|certbot-nginx}} プラグインは [[nginx]] の [[nginx#サーバーブロック|server ブロック]]を自動的に設定します: # certbot --nginx 証明書を更新するには: # certbot renew nginx の設定ファイルに手を加えずに証明書を変更するには: # certbot --nginx certonly 詳しい情報は [https://certbot.eff.org/#arch-nginx Nginx on Arch Linux] を見てください。インストールされた証明書の状態を有効に保つ方法は[[#自動更新]]を見てください。 ===== サーバーブロックの管理 ===== サーバーブロックを手動で管理する場合、以下のように[[nginx#サーバーブロック|サーバーブロック]]で使うことができます: {{hc|/etc/nginx/sites-available/example|2= server { listen 443 ssl http2; listen [::]:443 ssl http2; # Listen on IPv6 ssl_certificate /etc/letsencrypt/live/''domain''/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/''domain''/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; .. } }} 詳しくは [[nginx#TLS/SSL]] を見てください。 別の設定ファイルを作成してサーバーブロックから include して使用することも可能です: {{hc|/etc/nginx/conf/001-cerbot.conf|2= ssl_certificate /etc/letsencrypt/live/''domain''/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/''domain''/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; }} {{hc|/etc/nginx/sites-available/example|<nowiki> server { listen 443 ssl http2; listen [::]:443 ssl http2; # Listen on IPv6 include conf/001-certbot.conf; .. } </nowiki>}} ==== Apache ==== {{pkg|certbot-apache}} プラグインは、[[Apache HTTP Server]] の自動設定を提供します。このプラグインは、各ドメインの設定を検出しようとします。このプラグインは、セキュリティのために推奨される追加設定、証明書を使用するための設定、certbot 証明書へのパスを追加します。サンプルについては、[[#Managing Apache virtual hosts]] を参照してください。 [[Apache_HTTP_Server#Virtual_hosts|virtual hosts]] の初回セットアップ: # certbot --apache 証明書の更新: # certbot renew Apache 設定ファイルを変更せずに証明書の変更: # certbot --apache certonly 詳細は [https://certbot.eff.org/#arch-apache Certbot-Apache on Arch Linux] と [[#自動更新]] を参照してください。 ===== Apache バーチャルホストの管理 ===== これらのファイルを手動で管理する場合は、以下の例をすべての [[Apache HTTP Server#バーチャルホスト|バーチャルホスト]] で使用することができます: {{hc|/etc/httpd/conf/extra/001-certbot.conf|2= <IfModule mod_ssl.c> <VirtualHost *:443> Include /etc/letsencrypt/options-ssl-apache.conf SSLCertificateFile /etc/letsencrypt/live/'domain'/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/'domain'/privkey.pem </VirtualHost> </IfModule> }} {{hc|/etc/httpd/conf/httpd.conf|<nowiki> <IfModule mod_ssl.c> Listen 443 </IfModule> Include conf/extra/001-certbot.conf .. </nowiki>}} See [[Apache HTTP Server#TLS]] for more information. === Webroot === {{Note| * Webroot 方式では Certbot で認証するために'''ポート 80 で HTTP 接続'''できるようにする必要があります。 * サーバーの名前は DNS と一致している必要があります。 * {{ic|http://domain.tld/.well-known}} の読み取りを許可するためにホストのパーミッションを修正する必要がある場合があります。 }} webroot 方式を使う場合、Certbot クライアントは {{ic|/path/to/domain.tld/html/.well-known/acme-challenge/}} の中でチャレンジ・レスポンス認証を行います。 手動でインストールする場合と比べて、自動で証明書を更新したり楽に管理することができます。ただし、[[#プラグイン]]を使う時のように自動設定・自動インストールはできません。 ==== ACME チャレンジリクエストのマッピング ==== {{ic|.well-known/acme-challenge}} に対する HTTP リクエストを全てひとつのディレクトリ (例: {{ic|/var/lib/letsencrypt}}) にマッピングすることで管理が簡単になります。 Certbot やウェブサーバー (''http'' ユーザーで動作する [[nginx]] や [[Apache]] など) が書き込みできるパスを使用してください: # mkdir -p /var/lib/letsencrypt/.well-known # chgrp http /var/lib/letsencrypt # chmod g+s /var/lib/letsencrypt ===== nginx ===== location ブロックを記述したファイルを作成してサーバーブロックから読み込むようにしてください: {{hc|/etc/nginx/conf.d/letsencrypt.conf|<nowiki> location ^~ /.well-known/acme-challenge/ { allow all; root /var/lib/letsencrypt/; default_type "text/plain"; try_files $uri =404; } </nowiki>}} サーバー設定の例: {{hc|/etc/nginx/servers-available/domain.conf|<nowiki> server { server_name domain.tld .. include conf.d/letsencrypt.conf; } </nowiki>}} ===== Apache ===== {{ic|/etc/httpd/conf/extra/httpd-acme.conf}} ファイルを作成してください: {{hc|/etc/httpd/conf/extra/httpd-acme.conf|<nowiki> Alias /.well-known/acme-challenge/ "/var/lib/letsencrypt/.well-known/acme-challenge/" <Directory "/var/lib/letsencrypt/"> AllowOverride None Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec Require method GET POST OPTIONS </Directory> </nowiki>}} {{ic|/etc/httpd/conf/httpd.conf}} で上記ファイルを読み込んでください: {{hc|/etc/httpd/conf/httpd.conf|<nowiki> Include conf/extra/httpd-acme.conf </nowiki>}} ==== 証明書の取得 ==== 公開パスとして {{ic|/var/lib/letsencrypt/}} を使用して {{ic|domain.tld}} の証明書を取得するには: # certbot certonly --email '''email@example.com''' --webroot -w '''/var/lib/letsencrypt/''' -d '''domain.tld''' (サブ)ドメインを追加するときは、登録済みの全てのドメインを一緒に指定します: # certbot certonly --email '''email@example.com''' --webroot -w '''/var/lib/letsencrypt/''' -d '''domain.tld,sub.domain.tld''' 登録している証明書を(全て)更新するには: # certbot renew 証明書の更新方法については[[#自動更新]]も参照。 === 手動 === ウェブサーバーのプラグインが存在しない場合、以下のコマンドを使ってください: # certbot certonly --manual DNS の TXT レコードを利用して認証したい場合、以下のコマンドを使ってください: # certbot certonly --manual --preferred-challenges dns 上記のコマンドで自動的にドメインが認証されて秘密鍵と証明書のペアが作成されます。秘密鍵と証明書は {{ic|/etc/letsencrypt/archive/''your.domain''/}} に保存され、{{ic|/etc/letsencrypt/live/''your.domain''/}} からリンクが張られます。 証明書が取得できたら手動でウェブサーバーを設定して、シンボリックリンクが存在するディレクトリの秘密鍵・証明書・証明書チェーンを参照してください。 {{Note|上のコマンドを複数回実行したり証明書を更新したりするとファイル名の末尾に数字が付加されたファイルが {{ic|/etc/letsencrypt/archive/''your.domain''/}} に作られます。Certbot は {{ic|/etc/letsencrypt/live/''your.domain''/}} のシンボリックリンクを自動的に最新のファイルに更新するため、証明書を更新するたびに手動でウェブサーバーの設定を更新する必要はありません。}} == 高度な設定 == === 自動更新 === ==== systemd ==== {{ic|certbot.service}} ユニットを作成: {{hc|1=/etc/systemd/system/certbot.service| 2=[Unit] Description=Let's Encrypt renewal [Service] Type=oneshot ExecStart=/usr/bin/certbot renew --quiet --agree-tos}} プラグインを使わずにウェブサーバーの設定を自動で管理する場合、ウェブサーバーを手動でリロードして証明書が更新されるたびにリロードが必要です。{{ic|ExecStart}} コマンドに {{ic|--deploy-hook "systemctl reload nginx.service"}} を追加することでリロードさせることができます [https://certbot.eff.org/docs/using.html#renewing-certificates]。適宜 {{ic|nginx.service}} のかわりに {{ic|httpd.service}} を使ってください。 {{Note|[[systemd/タイマー|タイマー]]を追加する前に、サービスが正しく動作すること、何も入力が要求されないことを確認してください。}} それから、タイマーを追加することで証明書を更新できます (更新の必要がない証明書は自動的にスキップされます)。 {{hc|1=/etc/systemd/system/certbot.timer| 2=[Unit] Description=Daily renewal of Let's Encrypt's certificates [Timer] OnCalendar=0/12:00:00 RandomizedDelaySec=1h Persistent=true [Install] WantedBy=timers.target}} {{ic|certbot.timer}} を[[起動]]・[[有効化]]してください。 === Automatic renewal for wildcard certificates === The process is fairly simple. To issue a wildcard certificate, you have to do it via a DNS challenge request, [https://community.letsencrypt.org/t/acme-v2-and-wildcard-certificate-support-is-live/55579 using the ACMEv2 protocol]. While issuing a certificate manually is easy, it's not straight forward for automation. The DNS challenge represents a TXT record, given by certbot, which has to be set manually in the domain zone file. You will need to update the zone file upon every renew. To avoid doing that manually, you may use [https://tools.ietf.org/html/rfc2136 rfc2136] for which certbot has a plugin packaged in {{Pkg|certbot-dns-rfc2136}}. You will also need to configure your DNS server to allow dynamic updates for TXT records. ==== Configure BIND for rfc2136 ==== Generate a TSIG secret key: $ tsig-keygen -a HMAC-SHA512 '''example-key''' and add it in the configuration file: {{hc|1=/etc/named.conf| 2=... zone "'''domain.ltd'''" IN { ... // this is for certbot update-policy { grant '''example-key''' name _acme-challenge.'''domain.ltd'''. txt; }; ... }; key "'''example-key'''" { algorithm hmac-sha512; secret "'''a_secret_key'''"; }; ...}} [[Restart]] {{ic|named.service}}. ==== Configure certbot for rfc2136 ==== Create a configuration file for the rfc2136 plugin. {{hc|1=/etc/letsencrypt/rfc2136.ini| 2=dns_rfc2136_server = '''IP.ADD.RE.SS''' dns_rfc2136_name = '''example-key''' dns_rfc2136_secret = '''INSERT_KEY_WITHOUT_QUOTES''' dns_rfc2136_algorithm = HMAC-SHA512}} Since the file contains a copy of the secret key, secure it with [[chmod]] by removing the group and others permissions. Test what we did: # certbot certonly --dns-rfc2136 --force-renewal --dns-rfc2136-credentials /etc/letsencrypt/rfc2136.ini --server https://acme-v02.api.letsencrypt.org/directory --email '''example@domain.ltd''' --agree-tos --no-eff-email -d ''''domain.ltd'''' -d ''''*.domain.ltd'''' If you pass the validation successfully and receive certificates, then you are good to go with automating certbot. Otherwise, something went wrong and you need to debug your setup. It basically boils down to running {{ic|certbot renew}} from now on, see [[#Automatic renewal]]. == 参照 == * [[Transport Layer Security#ACME クライアント]] * [[Wikipedia:ja:Let's Encrypt|Wikipedia の記事]] * [https://certbot.eff.org/ EFF の Certbot ドキュメント] * [https://letsencrypt.org/docs/client-options/ ACME クライアントの一覧]
このページで使用されているテンプレート:
テンプレート:Hc
(
ソースを閲覧
)
テンプレート:Ic
(
ソースを閲覧
)
テンプレート:META Box
(
ソースを閲覧
)
テンプレート:META Box Blue
(
ソースを閲覧
)
テンプレート:META Box Red
(
ソースを閲覧
)
テンプレート:Note
(
ソースを閲覧
)
テンプレート:Pkg
(
ソースを閲覧
)
テンプレート:TranslationStatus
(
ソースを閲覧
)
テンプレート:Warning
(
ソースを閲覧
)
Certbot
に戻る。
検索
検索
Certbotのソースを表示
話題を追加