オリジンサーバーで curl を使用すると奇妙な TLS エラーが発生する x.509

オリジンサーバーで curl を使用すると奇妙な TLS エラーが発生する x.509

この状況で何が起こっているのかを誰かが説明してくれることを願っています。

現在、私は Google Domains からドメインを取得しており、DNS 管理には cloudflare を使用しています。cloudflare の TLS/SSL 機能は使用しておらず、ユニバーサル SSL はオフになっており、DNS リクエストもプロキシしていません。サーバーではリバース プロキシとして caddy を使用し、letsencrypt から証明書を取得する組み込みの acme クライアントを使用しています。証明書は問題なく取得でき、外部サイトはすべて、サーバー上にある証明書が使用されていることを示しています。ただし、curlサーバー上で HTTPS 経由でコマンドを実行すると、次のような奇妙な動作が発生します。

さらに詳しく説明すると、私は自分の gotify サーバー/インスタンスに curl リクエストを送信しようとしています。以下は、gotify cli コマンドを使用した場合の出力です。gotify init次に、自分のドメインを https:// で入力すると、この出力が表示されます (これはすべてのドメインで発生します (gotify コマンドの後に以下の基本的な curl コマンドを実行した場合))。ただし、エラーの発生元を示す例として gotify cli を使用しているだけです)。

x509: certificate is not valid for any names, but wanted to match gotify.mydomain.com

そこで、何が起こっているのかを調べるために、これらの curl コマンドを実行します。

コマンド:curl -v https://gotify.mydomain.com 出力:

* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS alert, unknown CA (560):
* SSL certificate problem: self signed certificate
* Closing connection 0
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

私の CApath には、ca-certificates パッケージのすべての証明書が文字通り含まれています。また、外部サイトは証明書を使用していますが、サーバーに問題が発生しており、その理由がわかりません。

このコマンドを実行すると、curl -v --insecure https://gotify.mydomain.comさらに奇妙な結果が得られます: 出力:

* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=CN; ST=TW; L=TB; O=ASKEY; OU=ROUTER; CN=askey.com; [email protected]
*  start date: Jan  8 18:43:23 2022 GMT
*  expire date: Jan  7 18:43:23 2025 GMT
*  issuer: C=CN; ST=TW; L=TB; O=ASKEY; OU=ROUTER; CN=askey.com; [email protected]
*  SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET / HTTP/1.1
> Host: gotify.mydomain.com
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Location: /1.2.4/login.html
< Content-Length: 0
< Date: Sun, 24 Apr 2022 13:51:04 GMT
< Server: lighttpd/1.4.38
<
* Connection #0 to host gotify.mydomain.com left intact

この「askey」証明書がどこから来たのか、まったくわかりません。私の知る限り、私のサーバーのどこにも存在しません。混乱しきっています。私は台湾に住んでいるので、TW コードには少し意味があるかもしれません。1 月 8 日にはリモートでサーバーにアクセスできなかったので、何が起こったのかわかりません。

これを見ると、Location: /1.2.4/login.htmlルーターに何か問題があるのではないかと思ってしまいます。なぜなら、これはルーターの管理者ログイン ページへのパスだからです。

関連情報