アップデートの確認時にcURL error 7のエラーが表示される

アップデートの確認時にcURL error 7のエラーが表示される

- Hiro Nakamura の投稿
返信数: 5

プラグインのアップデートを確認するため、admin/plugins.phpのURLにアクセスし、

「Check for available updates」をクリックすると、次のようなエラーメッセージが表示されます。

「利用可能なアップデートデータを取得できません - 不明なcURLエラーです。」

Debug info: cURL error 7: Failed to connect to 2606:4700:10::6816:4151: Network is unreachable
Error code: err_response_curl」


IPv6で通信しようとしていてエラーになっているように見えます。


https://moodle.org/mod/forum/discuss.php?d=354446

の情報を参考に、

/home/www/moodle/moodle/lib/filelib.phpを編集しましたが、変わりません。


※Moodle3.6.1環境の1505行目付近に次の行を追記


 $options['CURLOPT_IPRESOLVE'] = CURL_IPRESOLVE_V4;


どうにかIPv4での通信を強制したいのですが、正しい設定をお教えいただけませんでしょうか。


※現在の利用環境は、次の通りです。

・Moodle の入手場所:moodle.org

・バージョン:3.6.1

・組み込んでいる言語:英語、日本語

・PHP のバージョン:7.2.12

・Apacheのバージョン:2.4.12

・OS の種類とバージョン:RedHat Enterprise Linux 6.6

Hiro Nakamura への返信

Re: アップデートの確認時にcURL error 7のエラーが表示される

- Mitsuhiro Yoshida の投稿
画像 Developers 画像 Particularly helpful Moodlers 画像 Translators

以下のLinuxコマンドで問題なくmoodle.orgに接続できますでしょうか?

curl -I -vvv https://moodle.org/

参考資料:
[Moodle in English: e: Can't update plugins after upgrade to version 3.2.3]
https://moodle.org/mod/forum/discuss.php?d=352095#p1420815

Mitsuhiro Yoshida への返信

Re: アップデートの確認時にcURL error 7のエラーが表示される

- Hiro Nakamura の投稿

ご返信ありがとうございます。

試してみましたが、証明書情報が返ってきましたので接続できているようです。

* Establish HTTP proxy tunnel to moodle.org:443

> CONNECT moodle.org:443 HTTP/1.1

> Host: moodle.org:443

> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2

> Proxy-Connection: Keep-Alive

>

< HTTP/1.0 200 Connection established

HTTP/1.0 200 Connection established

<


* Proxy replied OK to CONNECT request

* Initializing NSS with certpath: sql:/etc/pki/nssdb

*   CAfile: /etc/pki/tls/certs/ca-bundle.crt

  CApath: none

* SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

* Server certificate:

*       subject: CN=sni.cloudflaressl.com,O="Cloudflare, Inc.",L=San Francisco,ST=CA,C=US

*       start date:  3月 25 00:00:00 2020 GMT

*       expire date: 10月 09 12:00:00 2020 GMT

*       common name: sni.cloudflaressl.com

*       issuer: CN=CloudFlare Inc ECC CA-2,O="CloudFlare, Inc.",L=San Francisco,ST=CA,C=US

> HEAD / HTTP/1.1

> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2

> Host: moodle.org

> Accept: */*

>

< HTTP/1.1 200 OK

HTTP/1.1 200 OK

< Date: Mon, 20 Apr 2020 00:01:42 GMT

Date: Mon, 20 Apr 2020 00:01:42 GMT

< Content-Type: text/html; charset=utf-8

Content-Type: text/html; charset=utf-8

< Connection: keep-alive

Connection: keep-alive

< Set-Cookie: __cfduid=d14d41ceae7a17313d5aa6abcf736e1591587340901; expires=Wed, 20-May-20 00:01:41 GMT; path=/; domain=.moodle.org; HttpOnly; SameSite=Lax

Set-Cookie: __cfduid=d14d41ceae7a17313d5aa6abcf736e1591587340901; expires=Wed, 20-May-20 00:01:41 GMT; path=/; domain=.moodle.org; HttpOnly; SameSite=Lax

< Vary: Front-End-Https,User-Agent

Vary: Front-End-Https,User-Agent

< Set-Cookie: MoodleSession=24614f49e9bb763be9e377b9b579352f; path=/; secure; HttpOnly

Set-Cookie: MoodleSession=24614f49e9bb763be9e377b9b579352f; path=/; secure; HttpOnly

< Expires: Mon, 20 Aug 1969 09:23:00 GMT

Expires: Mon, 20 Aug 1969 09:23:00 GMT

< Cache-Control: no-store, no-cache, must-revalidate

Cache-Control: no-store, no-cache, must-revalidate

< Pragma: no-cache

Pragma: no-cache

< Content-Language: en

Content-Language: en

< Content-Script-Type: text/javascript

Content-Script-Type: text/javascript

< Content-Style-Type: text/css

Content-Style-Type: text/css

< X-UA-Compatible: IE=edge

X-UA-Compatible: IE=edge

< Cache-Control: post-check=0, pre-check=0, no-transform

Cache-Control: post-check=0, pre-check=0, no-transform

< Last-Modified: Mon, 20 Apr 2020 00:01:42 GMT

Last-Modified: Mon, 20 Apr 2020 00:01:42 GMT

< Accept-Ranges: none

Accept-Ranges: none

< X-Frame-Options: sameorigin

X-Frame-Options: sameorigin

< CF-Cache-Status: DYNAMIC

CF-Cache-Status: DYNAMIC

< Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"

Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"

< Server: cloudflare

Server: cloudflare

< CF-RAY: 586a979afd7cef9a-NRT

CF-RAY: 586a979afd7cef9a-NRT

< cf-request-id: 02367d14dc0000ef9a7ea2e200000001

cf-request-id: 02367d14dc0000ef9a7ea2e200000001


Hiro Nakamura への返信

Re: アップデートの確認時にcURL error 7のエラーが表示される

- Mitsuhiro Yoshida の投稿
画像 Developers 画像 Particularly helpful Moodlers 画像 Translators

ご確認頂きまして、ありがとうございます。
以下のようにカーネルパラメータ設定ファイルを修正して、IPv6を無効にした方が良さそうですね。

修正対象ファイル:
/etc/sysctl.conf

[ 修正前 ]
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_synack_retries = 2

[ 修正後 ]
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_synack_retries = 2

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

参考資料:
[LinuxでIPv6を無効にする - IT基地局]
https://itbasesta.com/disable-ipv6

Mitsuhiro Yoshida への返信

Re: アップデートの確認時にcURL error 7のエラーが表示される

- Hiro Nakamura の投稿
ご返信ありがとうございます。
ご説明不足で申し訳ありませんが、あらかじめ/etc/sysctl.confを編集し、IPv6を無効にしてありました。
以下の記述を行い、sysctl -p で反映しております。(念のためOSも再起動済みです)

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

# ip a
を実行し、"inet6" が表示されないことも確認しております。
Hiro Nakamura への返信

Re: アップデートの確認時にcURL error 7のエラーが表示される

- Takayuki ISHIKAWA の投稿
画像 Developers

私は CentOS Stream 8 で同じ現象に遭い、こちらを読んで setsebool -P httpd_can_network_connect on で解決しました。

元の質問から1年以上経っていますが、他の方の参考のためにここに書き込んでおきます。

評点平均: お役立ち度: ★★★★★★★ (2)