質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Raspbian

Raspbianは、DebianベースのRaspberry Pi用ディストリビューション。ハードウェア浮動小数点演算を有効にすることが可能で、Webブラウズなどの速度を向上できます。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

Q&A

解決済

4回答

23943閲覧

Let's EncryptでDNSがひけず、証明書が登録できないので困っています

stargryps

総合スコア8

Raspbian

Raspbianは、DebianベースのRaspberry Pi用ディストリビューション。ハードウェア浮動小数点演算を有効にすることが可能で、Webブラウズなどの速度を向上できます。

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

0グッド

1クリップ

投稿2017/07/29 02:16

###前提・実現したいこと
ここに質問したいことを詳細に書いてください

Lets's Encryptの証明書を使いたいが、DNS Aレコードがひけないエラーがでています。
ただし、ドメインを登録したお名前.comにはDNS情報を登録済み。

###発生している問題・エラーメッセージ

エラーメッセージ Detail: DNS problem: SERVFAIL looking up A for 自分が取得したドメイン名 To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address. Additionally, please check that your computer has a publicly routable IP address and that no firewalls are preventing the server from communicating with the client. If you're using the webroot plugin, you should also verify that you are serving files from the webroot path you provided.

コマンド
/etc/certbot $ ./certbot-auto certonly --standalone -t

結果
Requesting root privileges to run certbot...
/home/pi/.local/share/letsencrypt/bin/letsencrypt certonly --standalone -t
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel): 自分が取得したドメイン名
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for 自分が取得したドメイン名
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. 自分が取得したドメイン名 (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: DNS problem: SERVFAIL looking up A for 自分が取得したドメイン名

IMPORTANT NOTES:

  • The following errors were reported by the server:

    Domain: 自分が取得したドメイン名
    Type: connection
    Detail: DNS problem: SERVFAIL looking up A for 自分が取得したドメイン名

    To fix these errors, please make sure that your domain name was
    entered correctly and the DNS A/AAAA record(s) for that domain
    contain(s) the right IP address. Additionally, please check that
    your computer has a publicly routable IP address and that no
    firewalls are preventing the server from communicating with the
    client. If you're using the webroot plugin, you should also verify
    that you are serving files from the webroot path you provided.

###試したこと
letsencryptディレクトリを削除して再実行

###補足情報(言語/FW/ツール等のバージョンなど)
これが初めてではなくて、今年の4月までは更新して利用していました。
サーバーはRaspbian Jessie、Webサーバーはnginxを使用しています。
お名前.comで独自ドメインを取得し、MyDNSに登録、お名前.comにMyDNSのDNSサーバー名を登録しています。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

coba-coba

2017/08/02 08:25

取得の過程を見ると「tls-sni-01 challenge for 自分が取得したドメイン名」となっているので、443番ポートでチャレンジしているんですね。Let's Encryptを今年の4月まで利用していたということは、もう3か月の有効期限は切れているのでしょうか。期限の切れた証明書では443番ポートへのアクセスはエラーになるのではないかと、ふと思いました。「--standalone-supported-challenges http-01」を指定して80番ポートへのアクセスは試しましたか?
stargryps

2017/08/02 14:15

今ちょっとやってみたところ、以下の結果になりました。pi@www:/etc/certbot $ ./letsencrypt-auto --standalone-supported-challenges http-01 Requesting root privileges to run certbot... /home/pi/.local/share/letsencrypt/bin/letsencrypt --standalone-supported-challenges http-01 The standalone specific supported challenges flag is deprecated. Please use the --preferred-challenges flag instead. Saving debug log to /var/log/letsencrypt/letsencrypt.log Failed to find executable apache2ctl in PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Certbot doesn't know how to automatically configure the web server on this system. However, it can still get a certificate for you. Please run "letsencrypt-auto certonly" to do so. You'll need to manually configure your web server to use the resulting certificate.
coba-coba

2017/08/02 14:24

deprecatedでしたか、失礼しました。--preferred-challenges http だとどうでしょう?
stargryps

2017/08/02 14:33

coba-cobaさん、すいません。こうなりました。 pi@www:/etc/certbot $ ./letsencrypt-auto --standalone --preferred-challenges http Requesting root privileges to run certbot... /home/pi/.local/share/letsencrypt/bin/letsencrypt --standalone --preferred-challenges http Saving debug log to /var/log/letsencrypt/letsencrypt.log With the standalone plugin, you probably want to use the "certonly" command, eg: letsencrypt-auto certonly --standalone (Alternatively, add a --installer flag. See https://eff.org/letsencrypt-plugins and "--help plugins" for more information.)
stargryps

2017/08/02 14:33

なんかオプション間違っていますか?
coba-coba

2017/08/02 14:40

certonlyが抜けてますね。あと、まとめて次のようにするとインタラクティブな手順を省けるので楽ですよ。./certbot-auto certonly --standalone --preferred-challenges http -d ドメイン -m メールアドレス --agree-tos -n
stargryps

2017/08/02 14:43

あ、それ以前も試したことがありました。さきほどやってみたところ、こうなりました。Failed authorization procedure. example.xyz (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: DNS problem: SERVFAIL looking up A for example.xyz IMPORTANT NOTES: - The following errors were reported by the server: Domain: example.xyz Type: connection Detail: DNS problem: SERVFAIL looking up A for example.xyz
coba-coba

2017/08/02 14:54

そうでしたか……。ギブアップです。すみません。お手数おかけしました…。
stargryps

2017/08/04 04:25

coba-cobaさん こちらの確認不備が発覚しました。 ルーターがいつの間にか新しいものにすり替わっており、サーバーがDMZ領域に出ておりませんでした。 大変申し訳ありません。 今夜、再度試してみます。
guest

回答4

0

ベストアンサー

standaloneならnginxを停止してから更新コマンドを実行してみてください。

投稿2017/07/31 23:32

scsi

総合スコア2840

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

stargryps

2017/08/01 00:28

3nekoさん nginxを停止しても結果は同じでした。
scsi

2017/08/01 01:19

なるほど、ではサーバの設定というよりはDNSの設定の可能性がたかそうですね。 下記でコマンドで調べた場合、自サーバに設定しているIPアドレスだけが返ってきますか? こなければDNSに問題があります。 dig 自分のドメイン @8.8.8.8
stargryps

2017/08/01 12:30

3nekoさん 帰ってきました。 ; <<>> DiG 9.10.3-P4-Ubuntu <<>> @8.8.8.8 sample.xyz ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52161 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;sample.xyz. IN A ;; ANSWER SECTION: sample.xyz. 3599 IN A xxx.xxx.xxx.xxx ;; Query time: 259 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Tue Aug 01 21:28:04 JST 2017 ;; MSG SIZE rcvd: 56
scsi

2017/08/01 13:38 編集

では、あとは外部から該当サーバへのtcpの80と443portが拒否されていないかですね。 それ以外だとちょっと原因が思いつかないです。 すいません。
stargryps

2017/08/01 13:38

3nekoさん ルーターのポートは開いています。 cman.jpのポートチェックでも80と443はOKになっています。 どうしてなんでしょうか・・・
scsi

2017/08/01 13:40 編集

ルーターではなく、サーバのfirewallは空いてますか?
stargryps

2017/08/01 13:45

ファイヤーウォールは空いているといえば空いていることになります。 Raspbianはfirewalldの設定はデフォルトで何も入っていないですし、ufwもインストールしていません。
scsi

2017/08/01 14:00

Nginxが動いている状態で、外部からドメイン名での該当サーバへの80portと443portの接続はできる状態ですかね?出来るのであれば、nginxを止めてstandaloneでの更新が失敗する原因が分かりません。
stargryps

2017/08/01 14:07

同じエラーで何回か証明書取得に失敗すると、制限がかかってエラーになるというようなことはないですか?
scsi

2017/08/01 14:09 編集

そのような場合はそのようなエラーが出たような気がします。--dry-runなどで試すのも手です
stargryps

2017/08/01 14:11

ありがとうございます。 明日やってみてどうしてもできないようであれば、諦めて外部サービスを利用します。
stargryps

2017/08/04 00:32

3nekoさん こちらの確認不備が発覚しました。 ルーターがいつの間にか新しいものにすり替わっており、サーバーがDMZ領域に出ておりませんでした。 大変申し訳ありません。 今夜、再度試してみます。
stargryps

2017/08/04 12:44

やはりダメですね。 状況は以下のとおりです。(FQDNはwww.griffon.xyzです。) digの結果(cman.jpで実行) ; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5_7.1 <<>> @8.8.8.8 www.griffon.xyz ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10394 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.griffon.xyz. IN A ;; ANSWER SECTION: www.griffon.xyz. 299 IN A 113.42.8.240 ;; Query time: 350 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Fri Aug 4 21:27:10 2017 ;; MSG SIZE rcvd: 49 ホスト:www.griffon.xyz ポート開放具合:80 ポート:80 にアクセスできました ポート開放具合:443 ホスト:www.griffon.xyz ポート:443 にアクセスできました コマンド:./certbot-auto certonly --standalone -d griffon.xyz エラー内容:Failed authorization procedure. griffon.xyz (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: DNS problem: SERVFAIL looking up A for griffon.xyz IMPORTANT NOTES: - The following errors were reported by the server: Domain: griffon.xyz Type: connection Detail: DNS problem: SERVFAIL looking up A for griffon.xyz digの結果やnslookupの結果は少なくとも正常に思えるのですが・・・。(そもそもポート閉じていたらエラーになるはず)
stargryps

2017/08/04 12:46

あ、ちなみに現在はnginxを停止しています。(nginxは443番をコメントアウト、80番だけにしていました)
scsi

2017/08/04 13:58

--standalone で実行するとどんな処理が行われるかざっくり書きます。 1. certbot コマンドで、80port、443port を使用したプロセスが起動します。 2. 外部から 該当サーバの80port,443port にアクセスがきて、あるファイルを参照して確認をします。 3. 確認が取れると証明書が発行されます。 ざっくりこんな感じと思ってください。--webroot だと443portは必要なかったりしますのでオプションによっての違いは自分で調べてみてください。lets encryptのページに書いてあります。 ということで、standalone の場合は、80port , 443port を使うプロセスを全て停止してから実行する必要があります。
scsi

2017/08/04 14:07

あと、443portを落としていると書いてありますが、私のサーバから 443 は connect できますね。 # telnet 113.42.8.240 443 Trying 113.42.8.240... Connected to 113.42.8.240. Escape character is '^]'. Connection closed by foreign host. routerがListenしているんでしょうか?r完全に落としてから実施してみてください。
stargryps

2017/08/04 14:09

3nekoさんありがとうございます。 確かに、nginxは停止していますが、ルーター上では80,443をこのFQDNを設定しているサーバーに通すようにしています。これをとめてみます。現在はLISTENになっています。
scsi

2017/08/04 14:15

nginxの80portをダウンした状態でルーターの設定は変更せずに下記を実行したらどうなるでしょうか。 ./certbot-auto certonly --standalone --preferred-challenges http-01 -d griffon.xy
stargryps

2017/08/04 14:18

やってみましたが、やはり・・・。(ルーターは80,443をとおすようにしています。nginxを停止しています。) pi@www:/etc/letsencrypt $ ./certbot-auto certonly --standalone --preferred-challenges http-01 -d griffon.xyz Requesting root privileges to run certbot... /home/pi/.local/share/letsencrypt/bin/letsencrypt certonly --standalone --preferred-challenges http-01 -d griffon.xyz Saving debug log to /var/log/letsencrypt/letsencrypt.log Obtaining a new certificate Performing the following challenges: http-01 challenge for griffon.xyz Waiting for verification... Cleaning up challenges Failed authorization procedure. griffon.xyz (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: DNS problem: SERVFAIL looking up A for griffon.xyz IMPORTANT NOTES: - The following errors were reported by the server: Domain: griffon.xyz Type: connection Detail: DNS problem: SERVFAIL looking up A for griffon.xyz
scsi

2017/08/04 14:22

あれ??証明書は www.griffon.zyz でなく griffon.xyz ですか。 DNS引けないですね。ドメインを再度ご確認してください! # dig griffon.xyz ; <<>> DiG 9.9.4-RedHat-9.9.4-50.el7_3.1 <<>> griffon.xyz ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 17059 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;griffon.xyz. IN A ;; Query time: 182 msec ;; SERVER: 210.188.224.10#53(210.188.224.10) ;; WHEN: 金 8月 04 23:21:29 JST 2017 ;; MSG SIZE rcvd: 40
stargryps

2017/08/04 14:26

あ、本当は -d griffon.xyz -d www.griffon.xyz で取得したいのです。 (URLはwww.griffon.xyzですが) ちなみに、www.griffon.xyzで先ほどのコマンドを実行しようとするとCAAレコードがルックアップできないと出ます。 pi@www:/etc/letsencrypt $ ./certbot-auto certonly --standalone --preferred-challenges http-01 -d www.griffon.xyz Requesting root privileges to run certbot... /home/pi/.local/share/letsencrypt/bin/letsencrypt certonly --standalone --preferred-challenges http-01 -d www.griffon.xyz Saving debug log to /var/log/letsencrypt/letsencrypt.log Obtaining a new certificate Performing the following challenges: http-01 challenge for www.griffon.xyz Waiting for verification... Cleaning up challenges Failed authorization procedure. www.griffon.xyz (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: DNS problem: SERVFAIL looking up CAA for griffon.xyz IMPORTANT NOTES: - The following errors were reported by the server: Domain: www.griffon.xyz Type: connection Detail: DNS problem: SERVFAIL looking up CAA for griffon.xyz
scsi

2017/08/04 14:34 編集

griffon.xyz が名前解決できないことで発生しているかもしれませんので griffon.xyz に正引きの登録をお願いします。
stargryps

2017/08/04 14:50

正引きの登録とは、サーバーのhostsに登録という認識でよろしいですか? mydns.jpにはwww.griffon.xyzしか登録してないんですが
guest

0

ご回答くださった方ありがとうございました。
結局、解決できず、サイトダウンから一週間もたっても解決出来なかったためwpxクラウド上にサイトを移しました。

今後はそちらをメインに使いつつ、クローズドな環境で設定をイチから確認してみるつもりです。

投稿2017/08/05 09:34

stargryps

総合スコア8

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

もちろん、mydns.jp のほうですね。
外部から名前が解決できないと意味がないです。

一度下記をじっくり読んで仕組みを理解するようお願いします!!
https://letsencrypt.jp/

投稿2017/08/04 22:48

scsi

総合スコア2840

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

このメッセージ、DNS の登録が正常であった場合も出ます。
私は、http を https にリダイレクトしていたため、このメッセージが出ました。
もしリダイレクトしているようであれば、一度外してみてください。

投稿2017/07/29 08:34

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

stargryps

2017/07/29 09:01

ありがとうございます。リダイレクト設定は特に行っていないのです。 おそらく、serverディレクティブに設定を入れるのだと思いますが # server { listen 80 default_server; listen [::]:80 default_server; # SSL configuration listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; # ssl_certificate /etc/letsencrypt/live/xxxxxxxxxxxxxxx/fullchain.pem; # ssl_certificate_key /etc/letsencrypt/live/xxxxxxxxxxxxxxx/privkey.pem; # ssl_session_timeout 1d; # ssl_session_cache shared:SSL:50m; # ssl_session_tickets on; # ssl_dhparam /etc/letsencrypt/live/xxxxxxxxxxxxxxx/dhparam.pem; # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; このような感じです。
stargryps

2017/07/29 12:42 編集

エラーメッセージから、「そういえばNSLOOKUPをひいてみるとどうなるんだろう?」と、nslookup、digをraspbianにインストールし、nslookupを実行したところ、以下のようにちゃんと帰ってきております。 pi@www:~ $ nslookup www.sample.com Server: 192.168.11.1 Address: 192.168.11.1#53 Non-authoritative answer: Name: www.sample.com Address: 111.111.11.111(実際はちゃんとしたIPアドレスです)
退会済みユーザー

退会済みユーザー

2017/07/30 02:17

standalone での取得でしたね^^; 私は、webroot での取得だったので、リダイレクトがカギだったんですが、あまり関係ない回答ですみません。。。
stargryps

2017/07/30 02:19

いえいえ。 webrootでもstandaloneでも結局SERVFAILとなってしまうのが困っています・・・・。 自分のサーバーからはちゃんと名前解決できるんですが。
退会済みユーザー

退会済みユーザー

2017/07/30 02:34

私の場合、期限失効後だったんですが、エラーメッセージ無視して色々やってみました。 結果的には http://example.com/.well-known/test.html へのアクセスを確認後、webroot で新規取得(/etc/letsencrypt/renewal 配下の config をリネームしてしまう)ことでなんとか解決しました。 再試行の制限があるので、切り分けも色々大変ですよね^^; 何かのヒントになれば。。。
stargryps

2017/07/30 04:21

ありがとうございます。 ちなみに、リダイレクトの設定はどう入れていたのですか?
退会済みユーザー

退会済みユーザー

2017/07/30 08:32

server { listen 80; server_name example.com; return 301 https://example.com/$request_uri; } 当時の設定が残っていないので、若干正確か怪しいですが、上記のようなモノを読み込ませてました。
stargryps

2017/07/30 08:35

なるほど。うちの設定はこれでした。 location / { index index.php index.html; try_files $uri $uri/ /index.php?$uri&$args; }
stargryps

2017/08/04 00:31

te2jiさん、ありがとうございました。 こちらの確認不備が発覚しました。 ルーターがいつの間にか新しいものにすり替わっており、サーバーがDMZ領域に出ておりませんでした。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問