LoginSignup
12
12

More than 5 years have passed since last update.

Let's encrypt のWeb認証に失敗する場合の許可の通し方

Last updated at Posted at 2016-10-08

Let's encryptのWeb認証が通らないケース

Let's encryt で既に動作しているWebサーバを認証する場合、
フレームワークやWordPress、Drupalなどのアプリが、
パラメータをキャッチする設定になっていることで、Web認証に失敗する場合がある。

image

Failed authorization procedure. <<認証したいWebサーバのドメイン>> (http-01): urn:acme:error:unauthorized :: The client lacks suffijp/.well-known/acme-challenge/tpRITlAFEtuJgZvhQwF_eRDRKu8XoLkkrwlLpp6AFTw: "<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>"

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: <<認証したいWebサーバのドメイン>>
   Type:   unauthorized
   Detail: Invalid response from
   http://<<認証したいWebサーバのドメイン>>/.well-known/acme-challenge/tpRITlAFEtuJgZvhQwF_eRDRKu8XoLkkrwlLpp6AFTw:
   "<html>
   <head><title>403 Forbidden</title></head>
   <body bgcolor="white">
   <center><h1>403 Forbidden</h1></center>
   <hr><center>"

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A record(s) for that domain
   contain(s) the right IP address.

解決方法

その場合は、以下の通り
別ディレクトリに認証を逃がすことで、
認証許可を出してもらうことが出来る。

チャレンジ方式の認証であり
不正に認証しているわけでもないので、認証自体も問題なし。

複数バーチャルホストの場合は、
nginx:/etc/nginx/global/letsencypt.conf
とかにまとめてIncludeしておけば良いと思う。

Nginxの場合

/etc/nginx/conf.d/virtual.conf
server {
    listen 80 default_server;
    server_name <<認証したいWebサーバのドメイン>>;

    #以下の2行を追加して、別ディレクトリで認証する。
    location ^~ /.well-known/acme-challenge/ {
      root /usr/share/nginx/html;
    }
    ...
}
letsencryptインストールディレクトリ
./letsencrypt-auto certonly --webroot --webroot-path /usr/share/nginx/html -d <<認証したいWebサーバのドメイン>>

image

letsencryptインストールディレクトリ
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/<<認証したいWebサーバのドメイン>>/fullchain.pem. Your
   cert will expire on 2017-01-06. 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

参考

Let's encrypt運用のベストプラクティス
http://qiita.com/tkyk@github/items/9b6ba55bb2a6a5d90963
Free SSL/TLS Certificates with Let's Encrypt and NGINX
https://www.nginx.com/blog/free-certificates-lets-encrypt-and-nginx/

12
12
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
12
12