1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
|
<?xml version="1.0" encoding="iso-8859-2"?>
<!-- EN-Revision: 1.18 Maintainer: goba Status: ready -->
<chapter id="features.safe-mode">
<title>Safe Mode</title>
<para>
A safe mode egy prblkozs a megosztott szerverek biztonsgi
problminak megoldsra. Architektrlisan nem korrekt, hogy
ezt a problmt a PHP szintjn prbljuk megoldani, de mivel
a tbbi alternatva a webszerver s opercis rendszer szinteken
nem igazn hasznlhat, sokan - klnsen az internetszolgltatk -
a safe mode-ot hasznljk egyelre.
</para>
<para>
A safe mode mkdst befolysol belltsok:
<programlisting role="ini">
<![CDATA[
safe_mode = Off
open_basedir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_fnctions =
]]>
</programlisting>
</para>
<para>
Ha a <link linkend="ini.safe-mode">safe_mode</link>
bellts be van kapcsolva, a PHP ellenrzi, hogy az aktulisan
fut szkript tulajdonosa megegyezik-e a kezelsre megnyitand
file tulajdonosval. Pldul:
<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>
Futtatva ezt a script.php programot:
<programlisting role="php">
<![CDATA[
<?php
readfile('/etc/passwd');
?>
]]>
</programlisting>
a kvetkez hibt kapod, ha a safe mode be van kapcsolva:
<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>
Ha a <link linkend="ini.safe-mode">safe_mode</link> helyett
egy <link linkend="ini.open-basedir">open_basedir</link>
knyvtrat lltasz be, akkor minden engedlyezett file
mvelet erre a knyvtrra korltozdik. Pldul (Apache
httpd.conf plda):
<programlisting role="ini">
<![CDATA[
<Directory /docroot>
php_admin_value open_basedir /docroot
</Directory>
]]>
</programlisting>
Ha a fenti script.php programot futtatod, ezzel az open_basedir
belltssal, akkor a kvetkez eredmnyt kapod:
<screen>
<![CDATA[
Warning: open_basedir restriction in effect. File is in wrong directory in
/docroot/script.php on line 2
]]>
</screen>
</para>
<para>
Le tudsz tiltani klnbz fggvnyeket akr egyenknt is.
Ha hozzadod ezt a php.ini llomnyodhoz:
<programlisting role="ini">
<![CDATA[
disable_functions readfile,system
]]>
</programlisting>
A kvetkez hibt kapod:
<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>A safe mode hasznlatakor tiltott/korltozott fggvnyek</title>
<para>
Ez mg valsznleg nem teljes, s nem korrekt listja a
fggvnyeknek, amiket a
<link linkend="features.safe-mode">safe mode</link> korltoz.
<table>
<title>Safe modeban korltozott fggvnyek</title>
<tgroup cols="2">
<thead>
<row>
<entry>Fggvny</entry>
<entry>Korltozs</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 megktsek, (!= safe mode)</entry>
</row>
<row>
<entry><function>ingres_*</function></entry>
<entry>sql_safe_mode megktsek, (!= safe mode)</entry>
</row>
<row>
<entry><function>mysql_*</function></entry>
<entry>sql_safe_mode megktsek, (!= safe mode)</entry>
</row>
<row>
<entry><function>pg_loimport</function></entry>
<entry>&sm.uidcheck;</entry>
</row>
<row>
<entry><function>posix_mkfifo</function></entry>
<entry>&sm.uidcheck.dir;</entry>
</row>
<row>
<entry><function>putenv</function></entry>
<entry>Alkalmazkodik a safe_mode_protected_env_vars s
safe_mode_allowed_env_vars ini belltsokhoz.
Lsd mg a <function>putenv</function> lerst</entry>
</row>
<row>
<entry><function>move_uploaded_file</function></entry>
<entry>&sm.uidcheck;</entry>
</row>
<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">vgrehajt opertor</link></entry>
<entry>&sm.disabled;</entry>
</row>
<row>
<entry><function>shell_exec</function> (a vgrehajt opertor fggvny megfelelje)</entry>
<entry>&sm.disabled;</entry>
</row>
<row>
<entry><function>exec</function></entry>
<entry>Futtathat llomnyok vgrehajtsra csak a
<link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link>
knyvtron bell van lehetsg. Praktikus okok miatt nem lehetsges
<literal>..</literal> komponenst elhelyeni a futtatand program
elrsi tjban.
</entry>
</row>
<row>
<entry><function>system</function></entry>
<entry>Futtathat llomnyok vgrehajtsra csak a
<link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link>
knyvtron bell van lehetsg. Praktikus okok miatt nem lehetsges
<literal>..</literal> komponenst elhelyeni a futtatand program
elrsi tjban.
</entry>
</row>
<row>
<entry><function>passthru</function></entry>
<entry>Futtathat llomnyok vgrehajtsra csak a
<link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link>
knyvtron bell van lehetsg. Praktikus okok miatt nem lehetsges
<literal>..</literal> komponenst elhelyeni a futtatand program
elrsi tjban.
</entry>
</row>
<row>
<entry><function>popen</function></entry>
<entry>Futtathat llomnyok vgrehajtsra csak a
<link linkend="ini.safe-mode-exec-dir">safe_mode_exec_dir</link>
knyvtron bell van lehetsg. Praktikus okok miatt nem lehetsges
<literal>..</literal> komponenst elhelyeni a futtatand program
elrsi tjban.
</entry>
</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 --></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; (a
<parameter>source</parameter> s
<parameter>target</parameter> paramterekre)</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; Radsul nem llthatod t a SUID, SGID s sticky biteket</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; (csak a cl ellenrztt)</entry>
</row>
<row>
<entry><function>link</function></entry>
<entry>&sm.uidcheck; &sm.uidcheck.dir; (csak a cl ellenrztt)</entry>
</row>
<row>
<entry><function>ob_gzhandler</function></entry>
<entry>&sm.uidcheck;</entry>
</row>
<row>
<entry><function>getallheaders</function></entry>
<entry>Safe modeban, semmilyen 'authorization' (nem kisbet/nagybet rzkeny)
kezdet fejlc sem kerl visszaadsra. Figyelem: ez nem mkdik megfelelen
a <function>getallheaders</function> AOL szerveres megvalstsban.</entry>
</row>
<row>
<entry>Minden fggvny, ami a
<filename>php4/main/fopen_wrappers.c</filename> funkcikat hasznlja.
</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
-->
|