cvs: phpdoc-zh /features safe-mode.xml
| From: | Dallas Thunder | Date: | Thu, 26 Sep 2002 09:11:26 +0000 |
| Subject: | cvs: phpdoc-zh /features safe-mode.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-644@lists.php.net to get a copy of this message | ||
dallas Thu Sep 26 05:11:26 2002 EDT
Modified files:
/phpdoc-zh/features safe-mode.xml
Log:
To UNIX file mode.
Index: phpdoc-zh/features/safe-mode.xml diff -u phpdoc-zh/features/safe-mode.xml:1.5 phpdoc-zh/features/safe-mode.xml:1.6 --- phpdoc-zh/features/safe-mode.xml:1.5 Thu Aug 29 03:06:22 2002 +++ phpdoc-zh/features/safe-mode.xml Thu Sep 26 05:11:26 2002 @@ -1,358 +1,358 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> -<!-- $Author: gregory $ --> -<!-- EN-Revision: 1.25 Maintainer: thomaslio Status: ready --> -<!-- CREDITS: Gregory --> - <chapter id="features.safe-mode"> - <title>°²È«Ä£Ê½</title> - - <para> - PHP µÄ°²È«Ä£Ê½ÊÇΪÁËÊÔͼ½â¾ö¹²Ïí·þÎñÆ÷£¨shared-server£©°²È«ÎÊÌâ¶øÉèÁ¢µÄ¡£ÔڽṹÉÏ£¬ÊÔͼÔÚ PHP ²ãÉϽâ¾öÕâ¸öÎÊÌâÊDz»ºÏÀíµÄ£¬µ«ÐÞ¸Ä WEB ·þÎñÆ÷²ãºÍ²Ù×÷ϵͳ²ãÏԵ÷dz£²»ÏÖʵ¡£Òò´ËÐí¶àÈË£¬ÌرðÊÇ ISP£¬Ä¿Ç°Ê¹Óð²È«Ä£Ê½¡£ - </para> - <para> - <table> - <title>¿ØÖư²È«Ä£Ê½µÄÉèÖÃÑ¡ÏîÓУº</title> - <tgroup cols="2"> - <thead> - <row> - <entry>ÉèÖÃÑ¡Ïî</entry> - <entry>ĬÈÏÖµ</entry> - </row> - </thead> - <tbody> - <row> - <entry> - <link linkend="ini.safe-mode">safe_mode</link> - </entry> - <entry><literal>Off</literal></entry> - </row> - <row> - <entry> - <link linkend="ini.safe-mode-gid">safe_mode_gid</link> - </entry> - <entry><literal>0</literal></entry> - </row> - <row> - <entry> - <link linkend="ini.safe-mode-include-dir">safe_mode_include_dir</link> - </entry> - <entry><literal>""</literal></entry> - </row> - <row> - <entry> - <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> - </entry> - <entry><literal>1</literal></entry> - </row> - <row> - <entry> - <link linkend="ini.open-basedir">open_basedir</link> - </entry> - <entry><literal>""</literal></entry> - </row> - <row> - <entry> - <literal>safe_mode_allowed_env_vars</literal> - </entry> - <entry><literal>PHP_</literal></entry> - </row> - <row> - <entry> - <literal>safe_mode_protected_env_vars</literal> - </entry> - <entry><literal>LD_LIBRARY_PATH</literal></entry> - </row> - <row> - <entry> - <literal>disable_functions</literal> - </entry> - <entry><literal>""</literal></entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <para> - µ± <link linkend="ini.safe-mode">safe_mode</link> ÉèÖÃΪ on£¬PHP ½«¼ì²éµ±Ç°½Å±¾µÄÓµÓÐÕßÊÇ·ñºÍ½«±»Îļþº¯Êý²Ù×÷µÄÎļþµÄÓµÓÐÕßÏàÆ¥Åä¡£ÀýÈ磺 - <programlisting role="ls"> -<![CDATA[ --rw-rw-r-- 1 rasmus rasmus 33 Jul 1 19:20 script.php --rw-r--r-- 1 root root 1116 May 26 18:01 /etc/passwd -]]> - </programlisting> - ÔËÐÐ script.php - <programlisting role="php"> -<![CDATA[ -<?php - readfile('/etc/passwd'); -?> -]]> - </programlisting> - Èç¹û°²È«Ä£Ê½±»¼¤»î£¬Ôò½«»áµ¼ÖÂÒÔÏ´íÎó£º - <screen> -<![CDATA[ -Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not -allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2 -]]> - </screen> - </para> - <para> - ͬʱ£¬»òÐí»á´æÔÚÕâÑùµÄ»·¾³£¬Ôڸû·¾³Ï£¬¿íËÉµÄ <literal>GID</literal> ¼ì²éÒѾ×ã¹»£¬µ«ÑϸñµÄ <literal>UID</literal> ¼ì²é·´¶øÊDz»Êʺϵġ£Äú¿ÉÒÔÓà <link linkend="ini.safe-mode-gid">safe_mode_gid</link> Ñ¡ÏîÀ´¿ØÖÆÕâÖÖ¼ì²é¡£Èç¹ûÉèÖÃΪ <literal>On</literal> Ôò½øÐпíËÉµÄ <literal>GID</literal> ¼ì²é£»ÉèÖÃΪ <literal>Off</literal>£¨Ä¬ÈÏÖµ£©Ôò½øÐÐ <literal>UID</literal> ¼ì²é¡£ - </para> - <para> - ³ýÁË <link linkend="ini.safe-mode">safe_mode</link> ÒÔÍ⣬Èç¹ûÄúÉèÖÃÁË <link linkend="ini.open-basedir">open_basedir</link> Ñ¡ÏÔòËùÓеÄÎļþ²Ù×÷½«±»ÏÞÖÆÔÚÄúÖ¸¶¨µÄĿ¼Ï¡£ÀýÈ磺 - <programlisting role="ini"> -<![CDATA[ -<Directory /docroot> - php_admin_value open_basedir /docroot -</Directory> -]]> - </programlisting> - Èç¹ûÄúÔÚÉèÖÃÁË <link linkend="ini.open-basedir">open_basedir</link> Ñ¡ÏîºóÔËÐÐͬÑùµÄ script.php£¬ÔòÆä½á¹û»áÊÇ£º - <screen> -<![CDATA[ -Warning: open_basedir restriction in effect. File is in wrong directory in -/docroot/script.php on line 2 -]]> - </screen> - </para> - <para> - ÄúÒ²¿ÉÒÔµ¥¶ÀµØÆÁ±ÎijЩº¯Êý¡£Çë×¢Òâ disable_functions Ñ¡Ïî²»ÄÜÔÚ &php.ini; ÎļþÍⲿʹÓã¬Ò²¾ÍÊÇ˵ÄúÎÞ·¨ÔÚ httpd.conf ÎļþµÄ°´²»Í¬ÐéÄâÖ÷»ú»ò²»Í¬Ä¿Â¼µÄ·½Ê½À´ÆÁ±Îº¯Êý¡£ - Èç¹ûÎÒÃǽ«ÈçÏÂÄÚÈݼÓÈëµ½ &php.ini; Îļþ£º - <programlisting role="ini"> -<![CDATA[ -disable_functions readfile,system -]]> - </programlisting> - ÔòÎÒÃÇ»áµÃµ½ÈçϵÄÊä³ö£º - <screen> -<![CDATA[ -Warning: readfile() has been disabled for security reasons in -/docroot/script.php on line 2 -]]> - </screen> - </para> - - <sect1 id="features.safe-mode.functions"> - <title>±»°²È«Ä£Ê½ÏÞÖÆ»òÆÁ±ÎµÄº¯Êý</title> - <para> - ÒÔÏÂ<link linkend="features.safe-mode">°²È«Ä£Ê½</link>Áбí¿ÉÄܲ»ÍêÕû»ò²»ÕýÈ·¡£ - <!-- TODO: add ¬e.sm.*; to the functions mentioned here. - That entity should link to this section --> - <table> - <title>°²È«Ä£Ê½ÏÞÖÆº¯Êý</title> - <tgroup cols="2"> - <thead> - <row> - <entry>º¯ÊýÃû</entry> - <entry>ÏÞÖÆ</entry> - </row> - </thead> - <tbody> - <row> - <entry><function>dbmopen</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>dbase_open</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>filepro</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>filepro_rowcount</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>filepro_retrieve</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>ifx_*</function></entry> - <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> - <!-- TODO: more info on sql-safe-mode --> - </row> - <row> - <entry><function>ingres_*</function></entry> - <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> - <!-- TODO: more info on sql-safe-mode --> - </row> - <row> - <entry><function>mysql_*</function></entry> - <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> - <!-- TODO: more info on sql-safe-mode --> - </row> - <row> - <entry><function>pg_loimport</function></entry> - <entry>&sm.uidcheck;</entry> - <!-- source TODO: there is no PHP-warning for that safe-mode-restriction --> - </row> - <row> - <entry><function>posix_mkfifo</function></entry> - <entry>&sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>putenv</function></entry> - <entry> - ×ñÑ ini ÉèÖÃµÄ safe_mode_protected_env_vars ºÍ safe_mode_allowed_env_vars Ñ¡Ïî¡£Çë²Î¿¼ <function>putenv</function> º¯ÊýµÄÓйØÎĵµ¡£ - </entry> - <!-- TODO: document those directives in chapters/config.xml --> - </row> - <row> - <entry><function>move_uploaded_file</function></entry> - <entry>&sm.uidcheck; <!-- TODO: check this --></entry> - </row> - - <!-- TODO: from here on, add warning to the function itself --> - - <row> - <entry><function>chdir</function></entry> - <entry>&sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>dl</function></entry> - <entry>&sm.disabled;</entry> - </row> - <row> - <entry><link linkend="language.operators.execution">backtick operator</link></entry> - <entry>&sm.disabled;</entry> - </row> - <row> - <entry><function>shell_exec</function>£¨ÔÚ¹¦ÄÜÉÏºÍ backticks º¯ÊýÏàͬ£©</entry> - <entry>&sm.disabled;</entry> - </row> - <row> - <entry><function>exec</function></entry> - <entry>ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ - </entry> - </row> - <row> - <entry><function>system</function></entry> - <entry> - ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ - </entry> - </row> - <row> - <entry><function>passthru</function></entry> - <entry> - ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ - </entry> - </row> - <row> - <entry><function>popen</function></entry> - <entry> - ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ - </entry> - <!-- TODO: not sure. popen uses a completely different implementation - Don't know why, don't know whether it's behaving the same --> - </row> - <row> - <entry><function>mkdir</function></entry> - <entry>&sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>rmdir</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>rename</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir;<!-- on the old name only, it seems. Is rename preventing moving files? --></entry> - </row> - <row> - <entry><function>unlink</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>copy</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir; (on - <parameter>source</parameter> and - <parameter>target</parameter>) </entry> - </row> - <row> - <entry><function>chgrp</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>chown</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>chmod</function></entry> - <entry>&sm.uidcheck; ÁíÍ⣬Äú²»ÄÜÉèÖà SUID¡¢SGID ºÍ sticky bits - </entry> - </row> - <row> - <entry><function>touch</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>symlink</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣺½ö²âÊÔ target£©</entry> - </row> - <row> - <entry><function>link</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣺½ö²âÊÔ target£©</entry> - </row> - <row> - <entry><function>getallheaders</function></entry> - <entry>ÔÚ°²È«Ä£Ê½Ï£¬ÒÔ¡°authorization¡±£¨Çø·Ö´óСд£©¿ªÍ·µÄÍ·ÐÅÏ¢½«²»»á±»·µ»Ø¡£¾¯¸æ£º<function>getallheaders</function> ÎÞ·¨ÔÚ aol-server ÏÂʵÏÖ£¡ - </entry> - </row> - <row> - <entry><function>header</function></entry> - <entry>ÔÚ°²È«Ä£Ê½Ï£¬Èç¹ûÄúÉèÖÃÁË <literal>WWW-Authenticate</literal>£¬µ±Ç°½Å±¾µÄ uid ½«±»Ìí¼Óµ½¸ÃÍ·ÐÅÏ¢µÄ <literal>realm</literal> ²¿·Ö¡£ - </entry> - </row> - <row> - <entry> - <function>highlight_file</function>, - <function>show_source</function> - </entry> - <entry> - &sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣬½öÔÚ 4.2.1 °æ±¾ºóÓÐЧ£© - </entry> - </row> - <row> - <entry> - <function>parse_ini_file</function> - </entry> - <entry> - &sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣬½öÔÚ 4.2.1 °æ±¾ºóÓÐЧ£© - </entry> - </row> - <row> - <entry>ÈκÎʹÓà - <filename>php4/main/fopen_wrappers.c</filename> µÄº¯Êý - </entry> - <entry>??</entry> - </row> - </tbody> - </tgroup> - </table> - </para> - </sect1> - - </chapter> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -indent-tabs-mode:nil -sgml-parent-document:nil -sgml-default-dtd-file:"../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: -vim600: syn=xml fen fdm=syntax fdl=2 si -vim: et tw=78 syn=sgml -vi: ts=1 sw=1 ---> +<?xml version="1.0" encoding="gb2312"?> +<!-- $Revision: 1.4 $ --> +<!-- $Author: gregory $ --> +<!-- EN-Revision: 1.25 Maintainer: thomaslio Status: ready --> +<!-- CREDITS: Gregory --> + <chapter id="features.safe-mode"> + <title>°²È«Ä£Ê½</title> + + <para> + PHP µÄ°²È«Ä£Ê½ÊÇΪÁËÊÔͼ½â¾ö¹²Ïí·þÎñÆ÷£¨shared-server£©°²È«ÎÊÌâ¶øÉèÁ¢µÄ¡£ÔڽṹÉÏ£¬ÊÔͼÔÚ PHP ²ãÉϽâ¾öÕâ¸öÎÊÌâÊDz»ºÏÀíµÄ£¬µ«ÐÞ¸Ä WEB ·þÎñÆ÷²ãºÍ²Ù×÷ϵͳ²ãÏԵ÷dz£²»ÏÖʵ¡£Òò´ËÐí¶àÈË£¬ÌرðÊÇ ISP£¬Ä¿Ç°Ê¹Óð²È«Ä£Ê½¡£ + </para> + <para> + <table> + <title>¿ØÖư²È«Ä£Ê½µÄÉèÖÃÑ¡ÏîÓУº</title> + <tgroup cols="2"> + <thead> + <row> + <entry>ÉèÖÃÑ¡Ïî</entry> + <entry>ĬÈÏÖµ</entry> + </row> + </thead> + <tbody> + <row> + <entry> + <link linkend="ini.safe-mode">safe_mode</link> + </entry> + <entry><literal>Off</literal></entry> + </row> + <row> + <entry> + <link linkend="ini.safe-mode-gid">safe_mode_gid</link> + </entry> + <entry><literal>0</literal></entry> + </row> + <row> + <entry> + <link linkend="ini.safe-mode-include-dir">safe_mode_include_dir</link> + </entry> + <entry><literal>""</literal></entry> + </row> + <row> + <entry> + <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> + </entry> + <entry><literal>1</literal></entry> + </row> + <row> + <entry> + <link linkend="ini.open-basedir">open_basedir</link> + </entry> + <entry><literal>""</literal></entry> + </row> + <row> + <entry> + <literal>safe_mode_allowed_env_vars</literal> + </entry> + <entry><literal>PHP_</literal></entry> + </row> + <row> + <entry> + <literal>safe_mode_protected_env_vars</literal> + </entry> + <entry><literal>LD_LIBRARY_PATH</literal></entry> + </row> + <row> + <entry> + <literal>disable_functions</literal> + </entry> + <entry><literal>""</literal></entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + µ± <link linkend="ini.safe-mode">safe_mode</link> ÉèÖÃΪ on£¬PHP ½«¼ì²éµ±Ç°½Å±¾µÄÓµÓÐÕßÊÇ·ñºÍ½«±»Îļþº¯Êý²Ù×÷µÄÎļþµÄÓµÓÐÕßÏàÆ¥Åä¡£ÀýÈ磺 + <programlisting role="ls"> +<![CDATA[ +-rw-rw-r-- 1 rasmus rasmus 33 Jul 1 19:20 script.php +-rw-r--r-- 1 root root 1116 May 26 18:01 /etc/passwd +]]> + </programlisting> + ÔËÐÐ script.php + <programlisting role="php"> +<![CDATA[ +<?php + readfile('/etc/passwd'); +?> +]]> + </programlisting> + Èç¹û°²È«Ä£Ê½±»¼¤»î£¬Ôò½«»áµ¼ÖÂÒÔÏ´íÎó£º + <screen> +<![CDATA[ +Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not +allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2 +]]> + </screen> + </para> + <para> + ͬʱ£¬»òÐí»á´æÔÚÕâÑùµÄ»·¾³£¬Ôڸû·¾³Ï£¬¿íËÉµÄ <literal>GID</literal> ¼ì²éÒѾ×ã¹»£¬µ«ÑϸñµÄ <literal>UID</literal> ¼ì²é·´¶øÊDz»Êʺϵġ£Äú¿ÉÒÔÓà <link linkend="ini.safe-mode-gid">safe_mode_gid</link> Ñ¡ÏîÀ´¿ØÖÆÕâÖÖ¼ì²é¡£Èç¹ûÉèÖÃΪ <literal>On</literal> Ôò½øÐпíËÉµÄ <literal>GID</literal> ¼ì²é£»ÉèÖÃΪ <literal>Off</literal>£¨Ä¬ÈÏÖµ£©Ôò½øÐÐ <literal>UID</literal> ¼ì²é¡£ + </para> + <para> + ³ýÁË <link linkend="ini.safe-mode">safe_mode</link> ÒÔÍ⣬Èç¹ûÄúÉèÖÃÁË <link linkend="ini.open-basedir">open_basedir</link> Ñ¡ÏÔòËùÓеÄÎļþ²Ù×÷½«±»ÏÞÖÆÔÚÄúÖ¸¶¨µÄĿ¼Ï¡£ÀýÈ磺 + <programlisting role="ini"> +<![CDATA[ +<Directory /docroot> + php_admin_value open_basedir /docroot +</Directory> +]]> + </programlisting> + Èç¹ûÄúÔÚÉèÖÃÁË <link linkend="ini.open-basedir">open_basedir</link> Ñ¡ÏîºóÔËÐÐͬÑùµÄ script.php£¬ÔòÆä½á¹û»áÊÇ£º + <screen> +<![CDATA[ +Warning: open_basedir restriction in effect. File is in wrong directory in +/docroot/script.php on line 2 +]]> + </screen> + </para> + <para> + ÄúÒ²¿ÉÒÔµ¥¶ÀµØÆÁ±ÎijЩº¯Êý¡£Çë×¢Òâ disable_functions Ñ¡Ïî²»ÄÜÔÚ &php.ini; ÎļþÍⲿʹÓã¬Ò²¾ÍÊÇ˵ÄúÎÞ·¨ÔÚ httpd.conf ÎļþµÄ°´²»Í¬ÐéÄâÖ÷»ú»ò²»Í¬Ä¿Â¼µÄ·½Ê½À´ÆÁ±Îº¯Êý¡£ + Èç¹ûÎÒÃǽ«ÈçÏÂÄÚÈݼÓÈëµ½ &php.ini; Îļþ£º + <programlisting role="ini"> +<![CDATA[ +disable_functions readfile,system +]]> + </programlisting> + ÔòÎÒÃÇ»áµÃµ½ÈçϵÄÊä³ö£º + <screen> +<![CDATA[ +Warning: readfile() has been disabled for security reasons in +/docroot/script.php on line 2 +]]> + </screen> + </para> + + <sect1 id="features.safe-mode.functions"> + <title>±»°²È«Ä£Ê½ÏÞÖÆ»òÆÁ±ÎµÄº¯Êý</title> + <para> + ÒÔÏÂ<link linkend="features.safe-mode">°²È«Ä£Ê½</link>Áбí¿ÉÄܲ»ÍêÕû»ò²»ÕýÈ·¡£ + <!-- TODO: add ¬e.sm.*; to the functions mentioned here. + That entity should link to this section --> + <table> + <title>°²È«Ä£Ê½ÏÞÖÆº¯Êý</title> + <tgroup cols="2"> + <thead> + <row> + <entry>º¯ÊýÃû</entry> + <entry>ÏÞÖÆ</entry> + </row> + </thead> + <tbody> + <row> + <entry><function>dbmopen</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>dbase_open</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>filepro</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>filepro_rowcount</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>filepro_retrieve</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>ifx_*</function></entry> + <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> + <!-- TODO: more info on sql-safe-mode --> + </row> + <row> + <entry><function>ingres_*</function></entry> + <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> + <!-- TODO: more info on sql-safe-mode --> + </row> + <row> + <entry><function>mysql_*</function></entry> + <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> + <!-- TODO: more info on sql-safe-mode --> + </row> + <row> + <entry><function>pg_loimport</function></entry> + <entry>&sm.uidcheck;</entry> + <!-- source TODO: there is no PHP-warning for that safe-mode-restriction --> + </row> + <row> + <entry><function>posix_mkfifo</function></entry> + <entry>&sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>putenv</function></entry> + <entry> + ×ñÑ ini ÉèÖÃµÄ safe_mode_protected_env_vars ºÍ safe_mode_allowed_env_vars Ñ¡Ïî¡£Çë²Î¿¼ <function>putenv</function> º¯ÊýµÄÓйØÎĵµ¡£ + </entry> + <!-- TODO: document those directives in chapters/config.xml --> + </row> + <row> + <entry><function>move_uploaded_file</function></entry> + <entry>&sm.uidcheck; <!-- TODO: check this --></entry> + </row> + + <!-- TODO: from here on, add warning to the function itself --> + + <row> + <entry><function>chdir</function></entry> + <entry>&sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>dl</function></entry> + <entry>&sm.disabled;</entry> + </row> + <row> + <entry><link linkend="language.operators.execution">backtick operator</link></entry> + <entry>&sm.disabled;</entry> + </row> + <row> + <entry><function>shell_exec</function>£¨ÔÚ¹¦ÄÜÉÏºÍ backticks º¯ÊýÏàͬ£©</entry> + <entry>&sm.disabled;</entry> + </row> + <row> + <entry><function>exec</function></entry> + <entry>ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ + </entry> + </row> + <row> + <entry><function>system</function></entry> + <entry> + ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ + </entry> + </row> + <row> + <entry><function>passthru</function></entry> + <entry> + ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ + </entry> + </row> + <row> + <entry><function>popen</function></entry> + <entry> + ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ + </entry> + <!-- TODO: not sure. popen uses a completely different implementation + Don't know why, don't know whether it's behaving the same --> + </row> + <row> + <entry><function>mkdir</function></entry> + <entry>&sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>rmdir</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>rename</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir;<!-- on the old name only, it seems. Is rename preventing moving files? --></entry> + </row> + <row> + <entry><function>unlink</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>copy</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir; (on + <parameter>source</parameter> and + <parameter>target</parameter>) </entry> + </row> + <row> + <entry><function>chgrp</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>chown</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>chmod</function></entry> + <entry>&sm.uidcheck; ÁíÍ⣬Äú²»ÄÜÉèÖà SUID¡¢SGID ºÍ sticky bits + </entry> + </row> + <row> + <entry><function>touch</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>symlink</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣺½ö²âÊÔ target£©</entry> + </row> + <row> + <entry><function>link</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣺½ö²âÊÔ target£©</entry> + </row> + <row> + <entry><function>getallheaders</function></entry> + <entry>ÔÚ°²È«Ä£Ê½Ï£¬ÒÔ¡°authorization¡±£¨Çø·Ö´óСд£©¿ªÍ·µÄÍ·ÐÅÏ¢½«²»»á±»·µ»Ø¡£¾¯¸æ£º<function>getallheaders</function> ÎÞ·¨ÔÚ aol-server ÏÂʵÏÖ£¡ + </entry> + </row> + <row> + <entry><function>header</function></entry> + <entry>ÔÚ°²È«Ä£Ê½Ï£¬Èç¹ûÄúÉèÖÃÁË <literal>WWW-Authenticate</literal>£¬µ±Ç°½Å±¾µÄ uid ½«±»Ìí¼Óµ½¸ÃÍ·ÐÅÏ¢µÄ <literal>realm</literal> ²¿·Ö¡£ + </entry> + </row> + <row> + <entry> + <function>highlight_file</function>, + <function>show_source</function> + </entry> + <entry> + &sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣬½öÔÚ 4.2.1 °æ±¾ºóÓÐЧ£© + </entry> + </row> + <row> + <entry> + <function>parse_ini_file</function> + </entry> + <entry> + &sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣬½öÔÚ 4.2.1 °æ±¾ºóÓÐЧ£© + </entry> + </row> + <row> + <entry>ÈκÎʹÓà + <filename>php4/main/fopen_wrappers.c</filename> µÄº¯Êý + </entry> + <entry>??</entry> + </row> + </tbody> + </tgroup> + </table> + </para> + </sect1> + + </chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +-->
Index: phpdoc-zh/features/safe-mode.xml diff -u phpdoc-zh/features/safe-mode.xml:1.5 phpdoc-zh/features/safe-mode.xml:1.6 --- phpdoc-zh/features/safe-mode.xml:1.5 Thu Aug 29 03:06:22 2002 +++ phpdoc-zh/features/safe-mode.xml Thu Sep 26 05:11:26 2002 @@ -1,358 +1,358 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> -<!-- $Author: gregory $ --> -<!-- EN-Revision: 1.25 Maintainer: thomaslio Status: ready --> -<!-- CREDITS: Gregory --> - <chapter id="features.safe-mode"> - <title>°²È«Ä£Ê½</title> - - <para> - PHP µÄ°²È«Ä£Ê½ÊÇΪÁËÊÔͼ½â¾ö¹²Ïí·þÎñÆ÷£¨shared-server£©°²È«ÎÊÌâ¶øÉèÁ¢µÄ¡£ÔڽṹÉÏ£¬ÊÔͼÔÚ PHP ²ãÉϽâ¾öÕâ¸öÎÊÌâÊDz»ºÏÀíµÄ£¬µ«ÐÞ¸Ä WEB ·þÎñÆ÷²ãºÍ²Ù×÷ϵͳ²ãÏԵ÷dz£²»ÏÖʵ¡£Òò´ËÐí¶àÈË£¬ÌرðÊÇ ISP£¬Ä¿Ç°Ê¹Óð²È«Ä£Ê½¡£ - </para> - <para> - <table> - <title>¿ØÖư²È«Ä£Ê½µÄÉèÖÃÑ¡ÏîÓУº</title> - <tgroup cols="2"> - <thead> - <row> - <entry>ÉèÖÃÑ¡Ïî</entry> - <entry>ĬÈÏÖµ</entry> - </row> - </thead> - <tbody> - <row> - <entry> - <link linkend="ini.safe-mode">safe_mode</link> - </entry> - <entry><literal>Off</literal></entry> - </row> - <row> - <entry> - <link linkend="ini.safe-mode-gid">safe_mode_gid</link> - </entry> - <entry><literal>0</literal></entry> - </row> - <row> - <entry> - <link linkend="ini.safe-mode-include-dir">safe_mode_include_dir</link> - </entry> - <entry><literal>""</literal></entry> - </row> - <row> - <entry> - <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> - </entry> - <entry><literal>1</literal></entry> - </row> - <row> - <entry> - <link linkend="ini.open-basedir">open_basedir</link> - </entry> - <entry><literal>""</literal></entry> - </row> - <row> - <entry> - <literal>safe_mode_allowed_env_vars</literal> - </entry> - <entry><literal>PHP_</literal></entry> - </row> - <row> - <entry> - <literal>safe_mode_protected_env_vars</literal> - </entry> - <entry><literal>LD_LIBRARY_PATH</literal></entry> - </row> - <row> - <entry> - <literal>disable_functions</literal> - </entry> - <entry><literal>""</literal></entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <para> - µ± <link linkend="ini.safe-mode">safe_mode</link> ÉèÖÃΪ on£¬PHP ½«¼ì²éµ±Ç°½Å±¾µÄÓµÓÐÕßÊÇ·ñºÍ½«±»Îļþº¯Êý²Ù×÷µÄÎļþµÄÓµÓÐÕßÏàÆ¥Åä¡£ÀýÈ磺 - <programlisting role="ls"> -<![CDATA[ --rw-rw-r-- 1 rasmus rasmus 33 Jul 1 19:20 script.php --rw-r--r-- 1 root root 1116 May 26 18:01 /etc/passwd -]]> - </programlisting> - ÔËÐÐ script.php - <programlisting role="php"> -<![CDATA[ -<?php - readfile('/etc/passwd'); -?> -]]> - </programlisting> - Èç¹û°²È«Ä£Ê½±»¼¤»î£¬Ôò½«»áµ¼ÖÂÒÔÏ´íÎó£º - <screen> -<![CDATA[ -Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not -allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2 -]]> - </screen> - </para> - <para> - ͬʱ£¬»òÐí»á´æÔÚÕâÑùµÄ»·¾³£¬Ôڸû·¾³Ï£¬¿íËÉµÄ <literal>GID</literal> ¼ì²éÒѾ×ã¹»£¬µ«ÑϸñµÄ <literal>UID</literal> ¼ì²é·´¶øÊDz»Êʺϵġ£Äú¿ÉÒÔÓà <link linkend="ini.safe-mode-gid">safe_mode_gid</link> Ñ¡ÏîÀ´¿ØÖÆÕâÖÖ¼ì²é¡£Èç¹ûÉèÖÃΪ <literal>On</literal> Ôò½øÐпíËÉµÄ <literal>GID</literal> ¼ì²é£»ÉèÖÃΪ <literal>Off</literal>£¨Ä¬ÈÏÖµ£©Ôò½øÐÐ <literal>UID</literal> ¼ì²é¡£ - </para> - <para> - ³ýÁË <link linkend="ini.safe-mode">safe_mode</link> ÒÔÍ⣬Èç¹ûÄúÉèÖÃÁË <link linkend="ini.open-basedir">open_basedir</link> Ñ¡ÏÔòËùÓеÄÎļþ²Ù×÷½«±»ÏÞÖÆÔÚÄúÖ¸¶¨µÄĿ¼Ï¡£ÀýÈ磺 - <programlisting role="ini"> -<![CDATA[ -<Directory /docroot> - php_admin_value open_basedir /docroot -</Directory> -]]> - </programlisting> - Èç¹ûÄúÔÚÉèÖÃÁË <link linkend="ini.open-basedir">open_basedir</link> Ñ¡ÏîºóÔËÐÐͬÑùµÄ script.php£¬ÔòÆä½á¹û»áÊÇ£º - <screen> -<![CDATA[ -Warning: open_basedir restriction in effect. File is in wrong directory in -/docroot/script.php on line 2 -]]> - </screen> - </para> - <para> - ÄúÒ²¿ÉÒÔµ¥¶ÀµØÆÁ±ÎijЩº¯Êý¡£Çë×¢Òâ disable_functions Ñ¡Ïî²»ÄÜÔÚ &php.ini; ÎļþÍⲿʹÓã¬Ò²¾ÍÊÇ˵ÄúÎÞ·¨ÔÚ httpd.conf ÎļþµÄ°´²»Í¬ÐéÄâÖ÷»ú»ò²»Í¬Ä¿Â¼µÄ·½Ê½À´ÆÁ±Îº¯Êý¡£ - Èç¹ûÎÒÃǽ«ÈçÏÂÄÚÈݼÓÈëµ½ &php.ini; Îļþ£º - <programlisting role="ini"> -<![CDATA[ -disable_functions readfile,system -]]> - </programlisting> - ÔòÎÒÃÇ»áµÃµ½ÈçϵÄÊä³ö£º - <screen> -<![CDATA[ -Warning: readfile() has been disabled for security reasons in -/docroot/script.php on line 2 -]]> - </screen> - </para> - - <sect1 id="features.safe-mode.functions"> - <title>±»°²È«Ä£Ê½ÏÞÖÆ»òÆÁ±ÎµÄº¯Êý</title> - <para> - ÒÔÏÂ<link linkend="features.safe-mode">°²È«Ä£Ê½</link>Áбí¿ÉÄܲ»ÍêÕû»ò²»ÕýÈ·¡£ - <!-- TODO: add ¬e.sm.*; to the functions mentioned here. - That entity should link to this section --> - <table> - <title>°²È«Ä£Ê½ÏÞÖÆº¯Êý</title> - <tgroup cols="2"> - <thead> - <row> - <entry>º¯ÊýÃû</entry> - <entry>ÏÞÖÆ</entry> - </row> - </thead> - <tbody> - <row> - <entry><function>dbmopen</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>dbase_open</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>filepro</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>filepro_rowcount</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>filepro_retrieve</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>ifx_*</function></entry> - <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> - <!-- TODO: more info on sql-safe-mode --> - </row> - <row> - <entry><function>ingres_*</function></entry> - <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> - <!-- TODO: more info on sql-safe-mode --> - </row> - <row> - <entry><function>mysql_*</function></entry> - <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> - <!-- TODO: more info on sql-safe-mode --> - </row> - <row> - <entry><function>pg_loimport</function></entry> - <entry>&sm.uidcheck;</entry> - <!-- source TODO: there is no PHP-warning for that safe-mode-restriction --> - </row> - <row> - <entry><function>posix_mkfifo</function></entry> - <entry>&sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>putenv</function></entry> - <entry> - ×ñÑ ini ÉèÖÃµÄ safe_mode_protected_env_vars ºÍ safe_mode_allowed_env_vars Ñ¡Ïî¡£Çë²Î¿¼ <function>putenv</function> º¯ÊýµÄÓйØÎĵµ¡£ - </entry> - <!-- TODO: document those directives in chapters/config.xml --> - </row> - <row> - <entry><function>move_uploaded_file</function></entry> - <entry>&sm.uidcheck; <!-- TODO: check this --></entry> - </row> - - <!-- TODO: from here on, add warning to the function itself --> - - <row> - <entry><function>chdir</function></entry> - <entry>&sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>dl</function></entry> - <entry>&sm.disabled;</entry> - </row> - <row> - <entry><link linkend="language.operators.execution">backtick operator</link></entry> - <entry>&sm.disabled;</entry> - </row> - <row> - <entry><function>shell_exec</function>£¨ÔÚ¹¦ÄÜÉÏºÍ backticks º¯ÊýÏàͬ£©</entry> - <entry>&sm.disabled;</entry> - </row> - <row> - <entry><function>exec</function></entry> - <entry>ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ - </entry> - </row> - <row> - <entry><function>system</function></entry> - <entry> - ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ - </entry> - </row> - <row> - <entry><function>passthru</function></entry> - <entry> - ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ - </entry> - </row> - <row> - <entry><function>popen</function></entry> - <entry> - ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ - </entry> - <!-- TODO: not sure. popen uses a completely different implementation - Don't know why, don't know whether it's behaving the same --> - </row> - <row> - <entry><function>mkdir</function></entry> - <entry>&sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>rmdir</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>rename</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir;<!-- on the old name only, it seems. Is rename preventing moving files? --></entry> - </row> - <row> - <entry><function>unlink</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>copy</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir; (on - <parameter>source</parameter> and - <parameter>target</parameter>) </entry> - </row> - <row> - <entry><function>chgrp</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>chown</function></entry> - <entry>&sm.uidcheck;</entry> - </row> - <row> - <entry><function>chmod</function></entry> - <entry>&sm.uidcheck; ÁíÍ⣬Äú²»ÄÜÉèÖà SUID¡¢SGID ºÍ sticky bits - </entry> - </row> - <row> - <entry><function>touch</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry> - </row> - <row> - <entry><function>symlink</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣺½ö²âÊÔ target£©</entry> - </row> - <row> - <entry><function>link</function></entry> - <entry>&sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣺½ö²âÊÔ target£©</entry> - </row> - <row> - <entry><function>getallheaders</function></entry> - <entry>ÔÚ°²È«Ä£Ê½Ï£¬ÒÔ¡°authorization¡±£¨Çø·Ö´óСд£©¿ªÍ·µÄÍ·ÐÅÏ¢½«²»»á±»·µ»Ø¡£¾¯¸æ£º<function>getallheaders</function> ÎÞ·¨ÔÚ aol-server ÏÂʵÏÖ£¡ - </entry> - </row> - <row> - <entry><function>header</function></entry> - <entry>ÔÚ°²È«Ä£Ê½Ï£¬Èç¹ûÄúÉèÖÃÁË <literal>WWW-Authenticate</literal>£¬µ±Ç°½Å±¾µÄ uid ½«±»Ìí¼Óµ½¸ÃÍ·ÐÅÏ¢µÄ <literal>realm</literal> ²¿·Ö¡£ - </entry> - </row> - <row> - <entry> - <function>highlight_file</function>, - <function>show_source</function> - </entry> - <entry> - &sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣬½öÔÚ 4.2.1 °æ±¾ºóÓÐЧ£© - </entry> - </row> - <row> - <entry> - <function>parse_ini_file</function> - </entry> - <entry> - &sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣬½öÔÚ 4.2.1 °æ±¾ºóÓÐЧ£© - </entry> - </row> - <row> - <entry>ÈκÎʹÓà - <filename>php4/main/fopen_wrappers.c</filename> µÄº¯Êý - </entry> - <entry>??</entry> - </row> - </tbody> - </tgroup> - </table> - </para> - </sect1> - - </chapter> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -indent-tabs-mode:nil -sgml-parent-document:nil -sgml-default-dtd-file:"../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: -vim600: syn=xml fen fdm=syntax fdl=2 si -vim: et tw=78 syn=sgml -vi: ts=1 sw=1 ---> +<?xml version="1.0" encoding="gb2312"?> +<!-- $Revision: 1.4 $ --> +<!-- $Author: gregory $ --> +<!-- EN-Revision: 1.25 Maintainer: thomaslio Status: ready --> +<!-- CREDITS: Gregory --> + <chapter id="features.safe-mode"> + <title>°²È«Ä£Ê½</title> + + <para> + PHP µÄ°²È«Ä£Ê½ÊÇΪÁËÊÔͼ½â¾ö¹²Ïí·þÎñÆ÷£¨shared-server£©°²È«ÎÊÌâ¶øÉèÁ¢µÄ¡£ÔڽṹÉÏ£¬ÊÔͼÔÚ PHP ²ãÉϽâ¾öÕâ¸öÎÊÌâÊDz»ºÏÀíµÄ£¬µ«ÐÞ¸Ä WEB ·þÎñÆ÷²ãºÍ²Ù×÷ϵͳ²ãÏԵ÷dz£²»ÏÖʵ¡£Òò´ËÐí¶àÈË£¬ÌرðÊÇ ISP£¬Ä¿Ç°Ê¹Óð²È«Ä£Ê½¡£ + </para> + <para> + <table> + <title>¿ØÖư²È«Ä£Ê½µÄÉèÖÃÑ¡ÏîÓУº</title> + <tgroup cols="2"> + <thead> + <row> + <entry>ÉèÖÃÑ¡Ïî</entry> + <entry>ĬÈÏÖµ</entry> + </row> + </thead> + <tbody> + <row> + <entry> + <link linkend="ini.safe-mode">safe_mode</link> + </entry> + <entry><literal>Off</literal></entry> + </row> + <row> + <entry> + <link linkend="ini.safe-mode-gid">safe_mode_gid</link> + </entry> + <entry><literal>0</literal></entry> + </row> + <row> + <entry> + <link linkend="ini.safe-mode-include-dir">safe_mode_include_dir</link> + </entry> + <entry><literal>""</literal></entry> + </row> + <row> + <entry> + <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> + </entry> + <entry><literal>1</literal></entry> + </row> + <row> + <entry> + <link linkend="ini.open-basedir">open_basedir</link> + </entry> + <entry><literal>""</literal></entry> + </row> + <row> + <entry> + <literal>safe_mode_allowed_env_vars</literal> + </entry> + <entry><literal>PHP_</literal></entry> + </row> + <row> + <entry> + <literal>safe_mode_protected_env_vars</literal> + </entry> + <entry><literal>LD_LIBRARY_PATH</literal></entry> + </row> + <row> + <entry> + <literal>disable_functions</literal> + </entry> + <entry><literal>""</literal></entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + µ± <link linkend="ini.safe-mode">safe_mode</link> ÉèÖÃΪ on£¬PHP ½«¼ì²éµ±Ç°½Å±¾µÄÓµÓÐÕßÊÇ·ñºÍ½«±»Îļþº¯Êý²Ù×÷µÄÎļþµÄÓµÓÐÕßÏàÆ¥Åä¡£ÀýÈ磺 + <programlisting role="ls"> +<![CDATA[ +-rw-rw-r-- 1 rasmus rasmus 33 Jul 1 19:20 script.php +-rw-r--r-- 1 root root 1116 May 26 18:01 /etc/passwd +]]> + </programlisting> + ÔËÐÐ script.php + <programlisting role="php"> +<![CDATA[ +<?php + readfile('/etc/passwd'); +?> +]]> + </programlisting> + Èç¹û°²È«Ä£Ê½±»¼¤»î£¬Ôò½«»áµ¼ÖÂÒÔÏ´íÎó£º + <screen> +<![CDATA[ +Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not +allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2 +]]> + </screen> + </para> + <para> + ͬʱ£¬»òÐí»á´æÔÚÕâÑùµÄ»·¾³£¬Ôڸû·¾³Ï£¬¿íËÉµÄ <literal>GID</literal> ¼ì²éÒѾ×ã¹»£¬µ«ÑϸñµÄ <literal>UID</literal> ¼ì²é·´¶øÊDz»Êʺϵġ£Äú¿ÉÒÔÓà <link linkend="ini.safe-mode-gid">safe_mode_gid</link> Ñ¡ÏîÀ´¿ØÖÆÕâÖÖ¼ì²é¡£Èç¹ûÉèÖÃΪ <literal>On</literal> Ôò½øÐпíËÉµÄ <literal>GID</literal> ¼ì²é£»ÉèÖÃΪ <literal>Off</literal>£¨Ä¬ÈÏÖµ£©Ôò½øÐÐ <literal>UID</literal> ¼ì²é¡£ + </para> + <para> + ³ýÁË <link linkend="ini.safe-mode">safe_mode</link> ÒÔÍ⣬Èç¹ûÄúÉèÖÃÁË <link linkend="ini.open-basedir">open_basedir</link> Ñ¡ÏÔòËùÓеÄÎļþ²Ù×÷½«±»ÏÞÖÆÔÚÄúÖ¸¶¨µÄĿ¼Ï¡£ÀýÈ磺 + <programlisting role="ini"> +<![CDATA[ +<Directory /docroot> + php_admin_value open_basedir /docroot +</Directory> +]]> + </programlisting> + Èç¹ûÄúÔÚÉèÖÃÁË <link linkend="ini.open-basedir">open_basedir</link> Ñ¡ÏîºóÔËÐÐͬÑùµÄ script.php£¬ÔòÆä½á¹û»áÊÇ£º + <screen> +<![CDATA[ +Warning: open_basedir restriction in effect. File is in wrong directory in +/docroot/script.php on line 2 +]]> + </screen> + </para> + <para> + ÄúÒ²¿ÉÒÔµ¥¶ÀµØÆÁ±ÎijЩº¯Êý¡£Çë×¢Òâ disable_functions Ñ¡Ïî²»ÄÜÔÚ &php.ini; ÎļþÍⲿʹÓã¬Ò²¾ÍÊÇ˵ÄúÎÞ·¨ÔÚ httpd.conf ÎļþµÄ°´²»Í¬ÐéÄâÖ÷»ú»ò²»Í¬Ä¿Â¼µÄ·½Ê½À´ÆÁ±Îº¯Êý¡£ + Èç¹ûÎÒÃǽ«ÈçÏÂÄÚÈݼÓÈëµ½ &php.ini; Îļþ£º + <programlisting role="ini"> +<![CDATA[ +disable_functions readfile,system +]]> + </programlisting> + ÔòÎÒÃÇ»áµÃµ½ÈçϵÄÊä³ö£º + <screen> +<![CDATA[ +Warning: readfile() has been disabled for security reasons in +/docroot/script.php on line 2 +]]> + </screen> + </para> + + <sect1 id="features.safe-mode.functions"> + <title>±»°²È«Ä£Ê½ÏÞÖÆ»òÆÁ±ÎµÄº¯Êý</title> + <para> + ÒÔÏÂ<link linkend="features.safe-mode">°²È«Ä£Ê½</link>Áбí¿ÉÄܲ»ÍêÕû»ò²»ÕýÈ·¡£ + <!-- TODO: add ¬e.sm.*; to the functions mentioned here. + That entity should link to this section --> + <table> + <title>°²È«Ä£Ê½ÏÞÖÆº¯Êý</title> + <tgroup cols="2"> + <thead> + <row> + <entry>º¯ÊýÃû</entry> + <entry>ÏÞÖÆ</entry> + </row> + </thead> + <tbody> + <row> + <entry><function>dbmopen</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>dbase_open</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>filepro</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>filepro_rowcount</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>filepro_retrieve</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>ifx_*</function></entry> + <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> + <!-- TODO: more info on sql-safe-mode --> + </row> + <row> + <entry><function>ingres_*</function></entry> + <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> + <!-- TODO: more info on sql-safe-mode --> + </row> + <row> + <entry><function>mysql_*</function></entry> + <entry>sql_safe_mode ÏÞÖÆ, (!= safe mode)</entry> + <!-- TODO: more info on sql-safe-mode --> + </row> + <row> + <entry><function>pg_loimport</function></entry> + <entry>&sm.uidcheck;</entry> + <!-- source TODO: there is no PHP-warning for that safe-mode-restriction --> + </row> + <row> + <entry><function>posix_mkfifo</function></entry> + <entry>&sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>putenv</function></entry> + <entry> + ×ñÑ ini ÉèÖÃµÄ safe_mode_protected_env_vars ºÍ safe_mode_allowed_env_vars Ñ¡Ïî¡£Çë²Î¿¼ <function>putenv</function> º¯ÊýµÄÓйØÎĵµ¡£ + </entry> + <!-- TODO: document those directives in chapters/config.xml --> + </row> + <row> + <entry><function>move_uploaded_file</function></entry> + <entry>&sm.uidcheck; <!-- TODO: check this --></entry> + </row> + + <!-- TODO: from here on, add warning to the function itself --> + + <row> + <entry><function>chdir</function></entry> + <entry>&sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>dl</function></entry> + <entry>&sm.disabled;</entry> + </row> + <row> + <entry><link linkend="language.operators.execution">backtick operator</link></entry> + <entry>&sm.disabled;</entry> + </row> + <row> + <entry><function>shell_exec</function>£¨ÔÚ¹¦ÄÜÉÏºÍ backticks º¯ÊýÏàͬ£©</entry> + <entry>&sm.disabled;</entry> + </row> + <row> + <entry><function>exec</function></entry> + <entry>ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ + </entry> + </row> + <row> + <entry><function>system</function></entry> + <entry> + ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ + </entry> + </row> + <row> + <entry><function>passthru</function></entry> + <entry> + ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ + </entry> + </row> + <row> + <entry><function>popen</function></entry> + <entry> + ÄúÖ»ÄÜÔÚ <link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link> ÉèÖõÄĿ¼Ï½øÐÐÖ´ÐвÙ×÷¡£»ùÓÚijЩÔÒò£¬Ä¿Ç°²»ÄÜÔÚ¿ÉÖ´ÐжÔÏóµÄ·¾¶ÖÐʹÓà <literal>..</literal>¡£ + </entry> + <!-- TODO: not sure. popen uses a completely different implementation + Don't know why, don't know whether it's behaving the same --> + </row> + <row> + <entry><function>mkdir</function></entry> + <entry>&sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>rmdir</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>rename</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir;<!-- on the old name only, it seems. Is rename preventing moving files? --></entry> + </row> + <row> + <entry><function>unlink</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>copy</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir; (on + <parameter>source</parameter> and + <parameter>target</parameter>) </entry> + </row> + <row> + <entry><function>chgrp</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>chown</function></entry> + <entry>&sm.uidcheck;</entry> + </row> + <row> + <entry><function>chmod</function></entry> + <entry>&sm.uidcheck; ÁíÍ⣬Äú²»ÄÜÉèÖà SUID¡¢SGID ºÍ sticky bits + </entry> + </row> + <row> + <entry><function>touch</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir;</entry> + </row> + <row> + <entry><function>symlink</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣺½ö²âÊÔ target£©</entry> + </row> + <row> + <entry><function>link</function></entry> + <entry>&sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣺½ö²âÊÔ target£©</entry> + </row> + <row> + <entry><function>getallheaders</function></entry> + <entry>ÔÚ°²È«Ä£Ê½Ï£¬ÒÔ¡°authorization¡±£¨Çø·Ö´óСд£©¿ªÍ·µÄÍ·ÐÅÏ¢½«²»»á±»·µ»Ø¡£¾¯¸æ£º<function>getallheaders</function> ÎÞ·¨ÔÚ aol-server ÏÂʵÏÖ£¡ + </entry> + </row> + <row> + <entry><function>header</function></entry> + <entry>ÔÚ°²È«Ä£Ê½Ï£¬Èç¹ûÄúÉèÖÃÁË <literal>WWW-Authenticate</literal>£¬µ±Ç°½Å±¾µÄ uid ½«±»Ìí¼Óµ½¸ÃÍ·ÐÅÏ¢µÄ <literal>realm</literal> ²¿·Ö¡£ + </entry> + </row> + <row> + <entry> + <function>highlight_file</function>, + <function>show_source</function> + </entry> + <entry> + &sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣬½öÔÚ 4.2.1 °æ±¾ºóÓÐЧ£© + </entry> + </row> + <row> + <entry> + <function>parse_ini_file</function> + </entry> + <entry> + &sm.uidcheck; &sm.uidcheck.dir; £¨×¢Ò⣬½öÔÚ 4.2.1 °æ±¾ºóÓÐЧ£© + </entry> + </row> + <row> + <entry>ÈκÎʹÓà + <filename>php4/main/fopen_wrappers.c</filename> µÄº¯Êý + </entry> + <entry>??</entry> + </row> + </tbody> + </tgroup> + </table> + </para> + </sect1> + + </chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +-->