Skip to content

Commit

Permalink
cgi-bin.xml Add tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mumumu committed Dec 14, 2024
1 parent 1961f8c commit 3a000bf
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions security/cgi-bin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 6a5b42e0d34c76890fd96be2b0b57516363b4c8a Maintainer: hirokawa Status: ready -->
<!-- EN-Revision: 87d3bf2e9ea7da5abbeca3e60ea7cf7abfa6f7f3 Maintainer: hirokawa Status: ready -->

<chapter xml:id="security.cgi-bin" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>CGI バイナリとしてインストール</title>
Expand All @@ -13,11 +13,16 @@
モジュールとして(Apache のような)サーバーソフトウエアに組み込み
たくない何らかの理由がある場合や安全な chroot と setuid 環境をス
クリプトに提供する他の <acronym>CGI</acronym> ラッパーと組み合わせて PHP を使用する
場合の設定オプションです。セットアップ時には、通常、PHP 実行バイ
ナリを Web サーバーの cgi-bin ディレクトリにインストールします。
場合の設定オプションです。セットアップ時には、通常、
<command>php</command> 実行バイ
ナリを Web サーバーの
<filename class="directory">cgi-bin</filename>
ディレクトリにインストールします。
CERT 勧告 <link xlink:href="&url.cert;">CA-96.11</link>は、いかなるイ
ンタプリタを cgi-bin に置くことにも反対しています。
PHP バイナリをスタンドアロンのインタプリタとして使用することが
ンタプリタを <filename class="directory">cgi-bin</filename>
に置くことにも反対しています。
<command>php</command>
バイナリをスタンドアロンのインタプリタとして使用することが
できる場合でも、PHP は、セットアップにより生じる可能性がある
次のような攻撃を防ぐように設計されています。
</simpara>
Expand All @@ -28,14 +33,15 @@
role="url">http://my.host/cgi-bin/php?/etc/passwd</filename>
</simpara>
<simpara>
URL において疑問符 (?) の後のクエリー情報は、CGI インターフェー
URL において疑問符 (<literal>?</literal>)
の後のクエリー情報は、CGI インターフェー
スにより、インタプリタにコマンドライン引数として渡されます。通
常、インタプリタは、コマンドライン上の最初の引数に指定されたファ
イルを開き、実行します。
</simpara>
<simpara>
CGI バイナリとして実行された場合、PHP は、コマンドライン引数の
解釈を拒否します
CGI バイナリとして実行された場合、<command>php</command> は、
コマンドライン引数の解釈を拒否します
</simpara>
</listitem>
<listitem>
Expand All @@ -50,7 +56,7 @@
ファイルの名前を指定するために従来より使用されています。
<filename role="url">http://my.host/secret/script.php</filename>
のようなドキュメントへの要求を PHP インタプリタにリダイレクト
するために、通常、何らかの Web サーバー設定用命令(Apache では Action)
するために、通常、何らかの Web サーバー設定用命令(Apache では <literal>Action</literal>)
が使用されます。この設定により、Web サーバーは、まずディレクトリ
<filename role="uri">/secret</filename> へのアクセス権をチェックし、
リダイレクト要求 <filename
Expand Down Expand Up @@ -95,8 +101,8 @@
する必要があります。
</simpara>
<simpara>
リダイレクションは、例えば Apache では命令 AddHandler および
Action で設定することができます。(以下を参照ください。)
リダイレクションは、例えば Apache では命令 <literal>AddHandler</literal>
および <literal>Action</literal> で設定することができます。(以下を参照ください。)
</simpara>
</sect1>

Expand All @@ -106,7 +112,7 @@
設定ディレクティブ <link
linkend="ini.cgi.force-redirect">cgi.force_redirect</link> は、
<filename role="php">http://my.host/cgi-bin/php/secretdir/script.php
</filename> のように URL から直接 PHP を呼び出すことを禁止します。
</filename> のように URL から直接 <command>php</command> を呼び出すことを禁止します。
代わりに、
Web サーバーのリダイレクションにより処理された場合は、
PHP はこのモードでのみ処理を行います。
Expand Down Expand Up @@ -149,7 +155,7 @@ AddHandler php-script .php
<simpara>
前節で記したようなリクエストがリダイレクトされたものでないことを
確かめる方法が利用可能でない場合、
スクリプト用の doc_root を Web ドキュメント用ルートとは別に
スクリプト用の <link linkend="ini.doc-root">doc_root</link> を Web ドキュメント用ルートとは別に
セットアップする必要があります。
</simpara>
<simpara>
Expand All @@ -166,18 +172,18 @@ AddHandler php-script .php
</simpara>
<simpara>
ここで利用可能な別のオプションは、<link
linkend="ini.user-dir">user_dir</link> です。user_dir が設定されていない場合、
linkend="ini.user-dir">user_dir</link> です。<parameter>user_dir</parameter> が設定されていない場合、
開かれるファイル名を制御するのは、<parameter>doc_root</parameter>
のみです。
<filename role="url">http://my.host/~user/doc.php</filename> のような
URL は、ユーザーホームディレクトリ以下のファイルを開かず、
doc_root 以下の <filename role="uri">~user/doc.php</filename>
<parameter>user_dir</parameter> 以下の <filename role="uri">~user/doc.php</filename>
というファイルを開くことになります。
(ディレクトリ名がチルダ [<literal>~</literal>] で始まっている
ということになります)
</simpara>
<simpara>
user_dir が例えば、<filename role="dir">public_php</filename>に
<parameter>user_dir</parameter> が例えば、<filename role="dir">public_php</filename>に
設定されていた場合、
<filename role="url">http://my.host/~user/doc.php</filename> の
ようなリクエストは、そのユーザー user のホームディレクトリにある
Expand Down

0 comments on commit 3a000bf

Please sign in to comment.