プロキシ自動設定スクリプト

PAC (Web)

文脈

[26] 組織内ネットワークなどで管理者が提供していることがよくあります。 プロキシの設定を管理者側で一括管理できるので便利です。

[27] WPAD により PACURL 自体を配布することもできます。

機能

[32] 要求メソッドにより分岐することはできません。

処理

[16] PACファイル自体の取得は、プロキシを使わずに直接行う必要があります。

[17] 信頼できないネットワークに接続されている場合や、 PACファイルの取得元が自ネットワーク外で信頼できない場合 (HTTPS でない場合など) は、PACファイルも信用してはいけないかもしれません。

[13] PACファイルJavaScript として評価して得られた FindProxyForURL 関数に、引数として URLホストを与えて実行し、得られた値をプロキシの指定として解釈します。

[14] ホストは、URLのうち、ホストの部分です。

[15] 便宜上指定されていますが、冗長な情報です >>6

[18] 返される値はプロキシの指定の文字列と解釈されますが、これには ; 区切りで複数の指定を連結できます。前の指定のプロキシに接続できないとき、 次の指定で接続を試みます。

[7] WebSocket の場合の、かつての Chromews: URL を使っていましたが、後に HTTP(S) URL に変更されました >>33。 入力 URL についての規定は WebSocket接続の確立を参照。

プロキシの種別

[8]

name
種別
desc
意味
name
DIRECT >>6
desc
直接接続 (プロキシなし)
name
PROXY >>6
desc
HTTP over TCP
name
HTTPS >>4
desc
HTTPS
name
SOCKS >>6
desc
SOCKS4 >>9
name
SOCKS4
desc
SOCKS4
name
SOCKS5
desc
SOCKS5

MIME 型

[10] PACファイルMIME型として、 application/x-ns-proxy-autoconfigapplication/x-javascript-config が使われています。

発見と更新

[20] 使用する PAC ファイルの指定は、利用者が手動で行う他に、 WPAD によりネットワークから自動取得することもできます。

[22] PAC は適宜変更されるものですから、適当なタイミング・頻度で最新のものを取得し直す必要があるようです。

実装

[24] 大抵の Webブラウザーが対応しています。

[25] Webブラウザー以外のクライアントは対応していないことが多いです。

[51] GitHub - creaktive/dePAC: seamless Proxy Auto-Config (a.k.a. Web Proxy Auto Discovery) for CLI apps, https://github.com/creaktive/dePAC

メモ

[1] @IT:検証:IEの自動Proxy設定とセキュリティ・ゾーン 2.イントラネット・ゾーン ( 版) http://www.atmarkit.co.jp/fwin2k/experiments/ieproxy/ieproxy_02.html

ある種の自動構成スクリプトを使うと(正確には「return "DIRECT"」を実行すると)、本来「インターネットゾーン」となるべきサイトが「イントラネットゾーン」となってしまうのは、IEの仕様なのだろうか、それとも何か重大なセキュリティ上の脆弱性なのだろうか、気になるところである。そこでこの件を Microsoft Security Response Center(Microsoft社の総合的なセキュリティ担当部署)に問い合わせてみたところ、これは“仕様”であるとの回答を得た。

[2] 元々の Netscape の文書は http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html にあったみたいです。

[3] 第 17 章 クライアント自動設定ファイルの使用 ( 版) https://docs.oracle.com/cd/E19438-01/820-0863/6ncisupt1/index.html

[5] Welcome to Netscape Navigator Version 2.0 ( 版) http://web.archive.org/web/20030202175634/http://wp.netscape.com/eng/mozilla/2.0/relnotes/windows-2.0.html

Automatic Proxy Configuration: It is now easier to specify complicated proxy configurations for an entire site. You can tell the Navigator to use different proxies depending on the URL or host being contacted. It's easier to specify a large number of hosts that should not be using a proxy.

[6] Proxy Client Autoconfig File Format ( 版) http://web.archive.org/web/20030202155744/http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html

[4] Secure Web Proxy - The Chromium Projects ( 版) https://www.chromium.org/developers/design-documents/secure-web-proxy

[9] 78176 – PAC: SOCKS return value is not version specific ( 版) https://bugzilla.mozilla.org/show_bug.cgi?id=78176

[11] Proxy auto-config - Wikipedia, the free encyclopedia ( 版) https://en.wikipedia.org/wiki/Proxy_auto-config

[12] 378637 – Add support for connecting to HTTP proxy over HTTPS ( 版) https://bugzilla.mozilla.org/show_bug.cgi?id=378637

[19] 76649 – PAC: dnsDomainIs should match ANY subdomain to an FQDN ( ()) https://bugzilla.mozilla.org/show_bug.cgi?id=76649

[21] draft-cooper-webi-wpad-00 - Web Proxy Auto-Discovery Protocol ( ()) https://tools.ietf.org/html/draft-cooper-webi-wpad-00#section-5.6

The client then requests the CURL via HTTP. When making the request

it MUST transmit HTTP "Accept" headers indicating what CFILE formats

it is capable of accepting. For example, Netscape Navigator browsers

with versions 2.0 and beyond might include the following line in the

HTTP Request:

Accept: application/x-ns-proxy-autoconfig

The client MUST follow HTTP redirect directives (response codes 3xx)

returned by the server. The client SHOULD send a valid "User-Agent"

header.

[28] PAC - Glossary | MDN ( ()) https://developer.mozilla.org/en-US/docs/Glossary/PAC

[29] Proxy Auto-Configuration (PAC) file - Mozilla | MDN ( ()) https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Necko/Proxy_Auto-Configuration_(PAC)_file

[30] chrome.proxy - Google Chrome ( ()) https://developer.chrome.com/extensions/proxy

[31] Define the property name for the PAC URL. (#311) (juangj著, ) https://github.com/w3c/webdriver/commit/0aa076ed7d0529d84164e1074e92b7eb003b8291

[33] 426736 - WebSocket connections not using configured system HTTPS Proxy in MacOS - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=426736

[34] Proxy: if `pac` require a config url (shs96c著, ) https://github.com/w3c/webdriver/commit/ee8c8d1938d7c71009754abda0846808312e959d

[35] firefox - How to force Chrome to reload proxy configuration file? - Super User () https://superuser.com/questions/343445/how-to-force-chrome-to-reload-proxy-configuration-file

[36] 85529 - PAC file handling seems to have regressed - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=85529

[37] 77847 - Use v8's isolates to implement ProxyResolverV8 - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=77847

[38] Understanding Web Proxy Configuration – IEInternals () https://blogs.msdn.microsoft.com/ieinternals/2013/10/11/understanding-web-proxy-configuration/

[39] Understanding Web Proxy Configuration – IEInternals () https://blogs.msdn.microsoft.com/ieinternals/2013/10/11/understanding-web-proxy-configuration/

A problem arises if the server requests credentials using HTTP BASIC or HTTP DIGEST authentication, as these authentication methods require that the user respond to a credential prompt dialog box. (In contrast, NTLM and Negotiate authenticate silently).

Many applications cannot handle showing prompts as a part of this workflow and will fail silently. To promote interoperability, IE11 also blocks the use of Proxy Configuration scripts that require authentication.

[40] Proxy Client Autoconfig File Format () https://web.archive.org/web/20060424005037/wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html

[41] IPv6-Aware Proxy Helper API Definitions (Windows) () https://msdn.microsoft.com/en-us/library/windows/desktop/gg308477(v=vs.85).aspx

[42] 162721 - Support FindProxyForURLEx() in PAC scripts - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=162721

[43] FindProxyForURLEx does not work in 1.3.5 · Issue #55 · pacparser/pacparser () https://github.com/pacparser/pacparser/issues/55

[44] pacparser/pacparser: A library to parse proxy auto-config (PAC) files () https://github.com/pacparser/pacparser

[45] Pacparser by pacparser () http://pacparser.manugarg.com/

[46] 25407 - Support Internet Explorers PAC extensions - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=25407

[47] Extensions to the Navigator Proxy Auto-Config File Format specification to support IPv6 v0.9 – Windows Core Networking () https://blogs.msdn.microsoft.com/wndp/2006/07/13/extensions-to-the-navigator-proxy-auto-config-file-format-specification-to-support-ipv6-v0-9/

[48] 24641 - [compatibility] IPv6 addresses mess up proxy autoconfig scripts - chromium - Monorail () https://bugs.chromium.org/p/chromium/issues/detail?id=24641

[49] Chromehttps: URL のとき path を含まない URLPAC に与えるらしい。

[50] Apple、「macOS Monterey 12.0.1」をリリース:CodeZine(コードジン) () https://codezine.jp/article/detail/15096

また、ネットワークでは、プロキシ自動設定(PAC)のクリアテキストHTTP URLスキームのサポートが非推奨になり、PACにはHTTPS URLスキームのみを使用する必要がある。