OpenBSD基本ツールを使用してWebサイトからHTTPSレスポンスを取得するには?

OpenBSD基本ツールを使用してWebサイトからHTTPSレスポンスを取得するには?

curlwgetSuperiorなどのツールを使用すると、

私はサーバーの応答を得るための「安全な」方法が欲しいです(例:wikipedia.org)ツールを使用して私の端末にはいデフォルトではインストールされます。セキュリティとは、応答がプレーンテキストではないことを意味しますが、HTTP / 2やTLS 1.3 / TLS 1.2(もちろん、サーバーがサポートしている場合)などの現在の標準を使用してマイコンピュータに送信されるときに暗号化する必要があることを意味します。

ベストアンサー1

ヘッダー、レスポンスコード、またはTLSプロトコルの詳細が必要かどうかを指定する必要はありません。

すでに答えたように、スイッチをオンにするとHTTP(S)レベルに関する多くの情報が得られますftp-dftp

$ ftp -d -o /dev/null https://en.wikipedia.org
host en.wikipedia.org, port https, path , save as /dev/null, auth none.
Trying 91.198.174.192...
Requesting https://en.wikipedia.org
GET / HTTP/1.1
Connection: close
Host: en.wikipedia.org
User-Agent: OpenBSD ftp

received 'HTTP/1.1 301 Moved Permanently'
received 'Date: Thu, 03 Mar 2022 10:42:56 GMT'
received 'Server: mw1324.eqiad.wmnet'
received 'X-Content-Type-Options: nosniff'
received 'P3p: CP="See https://en.wikipedia.org/wiki/Special:CentralAutoLogin/P3P for more info."'
received 'Vary: Accept-Encoding,X-Forwarded-Proto,Cookie,Authorization'
received 'Cache-Control: s-maxage=1200, must-revalidate, max-age=0'
received 'Last-Modified: Thu, 03 Mar 2022 10:42:56 GMT'
received 'Location: https://en.wikipedia.org/wiki/Main_Page'
Redirected to https://en.wikipedia.org/wiki/Main_Page
host en.wikipedia.org, port https, path wiki/Main_Page, save as /dev/null, auth none.
Trying 91.198.174.192...
Requesting https://en.wikipedia.org/wiki/Main_Page
GET /wiki/Main_Page HTTP/1.1
Connection: close
Host: en.wikipedia.org
User-Agent: OpenBSD ftp

received 'HTTP/1.1 200 OK'
received 'Date: Thu, 03 Mar 2022 07:48:57 GMT'
received 'Server: mw1393.eqiad.wmnet'
received 'X-Content-Type-Options: nosniff'
received 'P3p: CP="See https://en.wikipedia.org/wiki/Special:CentralAutoLogin/P3P for more info."'
received 'Content-Language: en'
received 'Vary: Accept-Encoding,Cookie,Authorization'
received 'Last-Modified: Thu, 03 Mar 2022 07:48:56 GMT'
received 'Content-Type: text/html; charset=UTF-8'
received 'Age: 11005'
received 'X-Cache: cp3052 hit, cp3058 hit/120231'
received 'X-Cache-Status: hit-front'
received 'Server-Timing: cache;desc="hit-front", host;desc="cp3058"'
received 'Strict-Transport-Security: max-age=106384710; includeSubDomains; preload'
received 'Report-To: { "group": "wm_nel", "max_age": 86400, "endpoints": [{ "url": "https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0" }] }'
received 'NEL: { "report_to": "wm_nel", "max_age": 86400, "failure_fraction": 0.05, "success_fraction": 0.0}'
received 'Permissions-Policy: interest-cohort=()'
received 'Set-Cookie: WMF-Last-Access=03-Mar-2022;Path=/;HttpOnly;secure;Expires=Mon, 04 Apr 2022 00:00:00 GMT'
received 'Set-Cookie: WMF-Last-Access-Global=03-Mar-2022;Path=/;Domain=.wikipedia.org;HttpOnly;secure;Expires=Mon, 04 Apr 2022 00:00:00 GMT'
received 'X-Client-IP: 148.69.164.57'
received 'Cache-Control: private, s-maxage=0, max-age=0, must-revalidate'
received 'Set-Cookie: GeoIP=PT:06:Coimbra:40.21:-8.42:v4; Path=/; secure; Domain=.wikipedia.org'
received 'Accept-Ranges: bytes'
received 'Content-Length: 84542'
received 'Connection: close'
100% |*******************************************************************************************************************************************************| 84542       00:00
84542 bytes received in 0.22 seconds (368.47 KB/s)

opensslTLSに関するより具体的な情報については、基本システムにあるTLSを使用します。

$ openssl s_client -connect en.wikipedia.org:443 < /dev/null

(...)

New, TLSv1/SSLv3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 256 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.3
    Cipher    : TLS_AES_256_GCM_SHA384
    Session-ID:
    Session-ID-ctx:
    Master-Key:
    Start Time: 1646305125
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
---
DONE

おすすめ記事