Firewall内のCentOSからhttps://mirror.centos.org/にアクセスできなかった件


FortigateによるFirewall内にあるCentOS9サーバから「dnf check-update」を実行してみたところ、失敗した。

[root@centos9 ~]# dnf update
サブスクリプション管理リポジトリーを更新しています。
コンシューマー識別子を読み込めません

このシステムは、エンタイトルメントサーバーに登録されていません。subscription-manager で登録できます。

CentOS Stream 9 - BaseOS                        0.0  B/s |   0  B     00:03
Errors during downloading metadata for repository 'baseos':
  - Curl error (60): SSL peer certificate or SSH remote key was not OK for https://mirrors.centos.org/metalink?repo=centos-baseos-9-stream&arch=x86_64&protocol=https,http [SSL certificate problem: self-signed certificate in certificate chain]
エラー: repo 'baseos' のメタデータのダウンロードに失敗しました : Cannot prepare internal mirrorlist: Curl error (60): SSL peer certificate or SSH remote key was not OK for https://mirrors.centos.org/metalink?repo=centos-baseos-9-stream&arch=x86_64&protocol=https,http [SSL certificate problem: self-signed certificate in certificate chain]
[root@centos9 ~]#

内容的には https://mirrors.centos.org/ へのアクセスでエラーになっていたので、curlコマンドで状況を確認してみることにした。

[root@centos9 ~]# curl -vvv https://mirrors.centos.org/publiclist/
*   Trying 13.125.120.8:443...
* Connected to mirrors.centos.org (13.125.120.8) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/pki/tls/certs/ca-bundle.crt
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Unknown (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.2 (IN), TLS header, Unknown (23):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS header, Unknown (21):
* TLSv1.3 (OUT), TLS alert, unknown CA (560):
* SSL certificate problem: self-signed certificate in certificate chain
* Closing connection 0
curl: (60) SSL certificate problem: self-signed certificate in certificate chain
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.
[root@centos9 ~]#

同じ環境にあるCentOS7サーバやOracle Linux8サーバでも同じ結果になった。

他の環境にあるCentOS7サーバで実行してみると下記のような感じになった。

-bash-4.2$ curl -vvv https://mirrors.centos.org/publiclist/
* About to connect() to mirrors.centos.org port 443 (#0)
*   Trying 2620:52:3:1:dead:beef:cafe:fed6...
* Connected to mirrors.centos.org (2620:52:3:1:dead:beef:cafe:fed6) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*       subject: CN=mirrors.centos.org
*       start date: 10月 19 06:06:54 2021 GMT
*       expire date:  1月 17 06:06:53 2022 GMT
*       common name: mirrors.centos.org
*       issuer: CN=R3,O=Let's Encrypt,C=US
> GET /publiclist/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: mirrors.centos.org
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Fri, 12 Nov 2021 08:44:59 GMT
< Server: Apache
< X-Frame-Options: SAMEORIGIN
< X-Xss-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Referrer-Policy: same-origin
< Location: https://admin.fedoraproject.org/mirrormanager/
< Content-Length: 299
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://admin.fedoraproject.org/mirrormanager/">here</a>.</p>
<hr>
<address>Apache Server at mirrors.centos.org Port 443</address>
</body></html>
* Connection #0 to host mirrors.centos.org left intact
-bash-4.2$

Let’s Encryptの証明書使ってるな、ということで、同じ環境にあるブラウザからアクセスしてみると、Fortigateによるhttps周りの動作の問題であることが判明

解決方法は「FortiGate環境で”This Connection is Invalid. SSL certificate expired.”を食らった」にあるやつと同じでした。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください