目次
25 PHPセキュリティプラクティスは、システム管理者のために書かれ、システム管理者のために書かれています php
PHPを使用して権限設定を記述するには、スーパー管理者は通常の管理者を削除できます
ホームページ バックエンド開発 PHPチュートリアル システム管理者のための 25 の PHP セキュリティ実践、システム管理者のための php_PHP チュートリアル

システム管理者のための 25 の PHP セキュリティ実践、システム管理者のための php_PHP チュートリアル

Jul 13, 2016 am 10:15 AM
スーパー管理者

<p></p> <h2 id="PHPセキュリティプラクティスは-システム管理者のために書かれ-システム管理者のために書かれています-php">25 PHPセキュリティプラクティスは、システム管理者のために書かれ、システム管理者のために書かれています php</h2> <p> PHPは、広く使用されているオープンソースのサーバーサイドスクリプト言語です。 Apache Web サービスを使用すると、ユーザーは HTTP または HTTPS プロトコルを通じてファイルやコンテンツにアクセスできます。サーバーサイドのスクリプト言語の構成が間違っていると、さまざまな問題が発生する可能性があります。したがって、PHP は注意して使用する必要があります。ここでは、システム管理者向けに PHP を安全に構成する方法に関する 25 の実践的な例を示します。 </p> <p><img src="/static/imghw/default1.png" data-src="http://www.bkjia.com/uploads/allimg/141105/164PKU0-0.JPG" class="lazy" alt=""></p> <p> 以下で使用するサンプル PHP 設定</p> <ul> <li>ドキュメントルート:/var/www/html</li> <li>デフォルトのWebサービス: Apache (代わりにLighttpdまたはNginxを使用できます) </li> <li>デフォルトのPHP設定ファイル: /etc/php.ini</li> <li>デフォルトの PHP 拡張機能設定ディレクトリ: /etc/php.d/</li> <li>PHP セキュリティ構成サンプル ファイル: /etc/php.d/security.ini (このファイルを作成するにはテキスト エディターを使用する必要があります)</li> <li>オペレーティング システム: RHEL/CentOS/Fedora Linux (この手順は、Debian/Ubuntu などの他のすべての Linux ディストリビューション、または OpenBSD/FreeBSD/HP-UX などの Unix 系オペレーティング システムで正常に実行されるはずです)</li> <li>PHP サービスのデフォルトの TCP/UDP ポート: なし</li> </ul> <p>今日の午後にリストされた操作のほとんどは、root ユーザーが bash またはその他の最新のシェルで操作を実行できるという前提に基づいています。 </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">$ php -</code><code class="bash functions">v</code> </td> </tr> </tbody> </table> <p> サンプル出力</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 </td> <td class="code"> <code class="bash plain">PHP 5.3.3 (cli) (built: Oct 24 2011 08:35:41)</code> <code class="bash spaces"> </code><code class="bash plain">Copyright (c) 1997-2010 The PHP Group</code> <code class="bash spaces"> </code><code class="bash plain">Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies</code> </td> </tr> </tbody> </table> <p> この記事で使用しているオペレーティングシステム</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">$ </code><code class="bash functions">cat</code> <code class="bash plain">/etc/redhat-release</code> </td> </tr> </tbody> </table> <p> サンプル出力</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">Red Hat Enterprise Linux Server release 6.1 (Santiago)</code> </td> </tr> </tbody> </table> <p><strong> #1: 敵を知る</strong></p> <p> PHP ベースのアプリケーションはさまざまな攻撃に直面します: </p> <ul> <li>XSS: PHP Web アプリケーションの場合、クロスサイト スクリプティングは脆弱な点です。攻撃者はこれを使用してユーザー情報を盗むことができます。 XSS 攻撃を防ぐために、Apache を構成するか、より安全な PHP コード (すべてのユーザー入力を検証) を作成できます</li> <li>SQL インジェクション: これは、PHP アプリケーションのデータベース層における攻撃の脆弱点です。予防方法は上記と同様です。一般的な方法は、mysql_real_escape_string() を使用してパラメータをエスケープし、SQL クエリを実行することです。 </li> <li>ファイルのアップロード: 訪問者がサーバーにファイルを配置 (アップロード) できるようにします。これにより、サーバーファイルやデータベースの削除、ユーザー情報の取得など、一連の問題が発生します。 PHP を使用してファイルのアップロードを禁止したり、より安全なコード (ユーザー入力を検証し、png や gif などの画像形式のアップロードのみを許可するなど) を記述したりすることができます </li> <li>ローカル ファイルとリモート ファイルが含まれる: 攻撃者は、リモート サーバーにファイルを開かせ、PHP コードを実行させ、ファイルをアップロードまたは削除してバックドアをインストールすることができます。リモートファイル実行設定を解除することで回避できます</li> <li>eval(): この関数は、PHP コードのように文字列を実行させることができます。これは、攻撃者がサーバー上のコードやツールを隠すためによく使用されます。これは、PHP を設定し、eval() 関数呼び出しをキャンセルすることで実現できます</li> <li>Sea-surt 攻撃 (クロスサイト リクエスト フォージェリ、CSRF。クロスサイト リクエスト フォージェリ): この攻撃により、エンド ユーザーは現在のアカウントで不特定の動作を実行します。これにより、エンドユーザーのデータと運用上のセキュリティが危険にさらされます。ターゲットのエンド ユーザーのアカウントが管理者権限で使用されている場合、Web アプリケーション全体が危険にさらされます。 </li> </ul> <p><strong> #2: 組み込みの PHP モジュールを減らす</strong></p> <p> 次のコマンドを実行して、現在 PHP によってコンパイルされているモジュールを表示します</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">$ php -m</code> </td> </tr> </tbody> </table> <p> サンプル出力: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 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 </td> <td class="code"> <code class="bash plain">[PHP Modules]</code> <code class="bash spaces"> </code><code class="bash plain">apc</code> <code class="bash spaces"> </code><code class="bash plain">bcmath</code> <code class="bash spaces"> </code><code class="bash plain">bz2</code> <code class="bash spaces"> </code><code class="bash plain">calendar</code> <code class="bash spaces"> </code><code class="bash plain">Core</code> <code class="bash spaces"> </code><code class="bash plain">ctype</code> <code class="bash spaces"> </code><code class="bash plain">curl</code> <code class="bash spaces"> </code><code class="bash functions">date</code> <code class="bash spaces"> </code><code class="bash plain">dom</code> <code class="bash spaces"> </code><code class="bash plain">ereg</code> <code class="bash spaces"> </code><code class="bash plain">exif</code> <code class="bash spaces"> </code><code class="bash plain">fileinfo</code> <code class="bash spaces"> </code><code class="bash plain">filter</code> <code class="bash spaces"> </code><code class="bash functions">ftp</code> <code class="bash spaces"> </code><code class="bash plain">gd</code> <code class="bash spaces"> </code><code class="bash plain">gettext</code> <code class="bash spaces"> </code><code class="bash plain">gmp</code> <code class="bash spaces"> </code><code class="bash functions">hash</code> <code class="bash spaces"> </code><code class="bash plain">iconv</code> <code class="bash spaces"> </code><code class="bash plain">imap</code> <code class="bash spaces"> </code><code class="bash plain">json</code> <code class="bash spaces"> </code><code class="bash plain">libxml</code> <code class="bash spaces"> </code><code class="bash plain">mbstring</code> <code class="bash spaces"> </code><code class="bash plain">memcache</code> <code class="bash spaces"> </code><code class="bash plain">mysql</code> <code class="bash spaces"> </code><code class="bash plain">mysqli</code> <code class="bash spaces"> </code><code class="bash plain">openssl</code> <code class="bash spaces"> </code><code class="bash plain">pcntl</code> <code class="bash spaces"> </code><code class="bash plain">pcre</code> <code class="bash spaces"> </code><code class="bash plain">PDO</code> <code class="bash spaces"> </code><code class="bash plain">pdo_mysql</code> <code class="bash spaces"> </code><code class="bash plain">pdo_sqlite</code> <code class="bash spaces"> </code><code class="bash plain">Phar</code> <code class="bash spaces"> </code><code class="bash plain">readline</code> <code class="bash spaces"> </code><code class="bash plain">Reflection</code> <code class="bash spaces"> </code><code class="bash plain">session</code> <code class="bash spaces"> </code><code class="bash plain">shmop</code> <code class="bash spaces"> </code><code class="bash plain">SimpleXML</code> <code class="bash spaces"> </code><code class="bash plain">sockets</code> <code class="bash spaces"> </code><code class="bash plain">SPL</code> <code class="bash spaces"> </code><code class="bash plain">sqlite3</code> <code class="bash spaces"> </code><code class="bash plain">standard</code> <code class="bash spaces"> </code><code class="bash plain">suhosin</code> <code class="bash spaces"> </code><code class="bash plain">tokenizer</code> <code class="bash spaces"> </code><code class="bash plain">wddx</code> <code class="bash spaces"> </code><code class="bash plain">xml</code> <code class="bash spaces"> </code><code class="bash plain">xmlreader</code> <code class="bash spaces"> </code><code class="bash plain">xmlrpc</code> <code class="bash spaces"> </code><code class="bash plain">xmlwriter</code> <code class="bash spaces"> </code><code class="bash plain">xsl</code> <code class="bash spaces"> </code><code class="bash plain">zip</code> <code class="bash spaces"> </code><code class="bash plain">zlib</code> <code class="bash spaces"> </code><code class="bash plain">[Zend Modules] </code> <code class="bash spaces"> </code><code class="bash plain">Suhosin</code> </td> </tr> </tbody> </table> <p> パフォーマンスとセキュリティの観点から、PHPを使用する場合は不要なモジュールを減らすことをお勧めします。例えば上記のsqlite3は不要です。その後、/etc/php.d/sqlite3.ini ファイルを削除するか名前を変更することでキャンセルできます: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># rm /etc/php.d/sqlite3.ini</code> </td> </tr> </tbody> </table> <p> または</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># mv /etc/php.d/sqlite3.ini /etc/php.d/sqlite3.disable</code> </td> </tr> </tbody> </table> <p> 一部のモジュールは、PHP を再コンパイルしてインストールすることによってのみ削除できます。たとえば、php.net から PHP ソース コードをダウンロードした後、次の手順を使用して GD、fastcgi、および MySQL サポートをコンパイルします。 </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> 1 <td class="gutter"> </td> <td class="code"> <code class="bash plain">.</code><code class="bash plain">/configure</code> <code class="bash plain">--with-libdir=lib64 --with-gd --with-mysql --prefix=</code><code class="bash plain">/usr</code> <code class="bash plain">--</code><code class="bash functions">exec</code><code class="bash plain">-prefix=</code><code class="bash plain">/usr</code> <code class="bash plain">--bindir=</code><code class="bash plain">/usr/bin</code> <code class="bash plain">--sbindir=</code><code class="bash plain">/usr/sbin</code> <code class="bash plain">--sysconfdir=</code><code class="bash plain">/etc</code> <code class="bash plain">--datadir=</code><code class="bash plain">/usr/share</code> <code class="bash plain">--includedir=</code><code class="bash plain">/usr/include</code> <code class="bash plain">--libexecdir=</code><code class="bash plain">/usr/libexec</code> <code class="bash plain">--localstatedir=</code><code class="bash plain">/var</code> <code class="bash plain">--sharedstatedir=</code><code class="bash plain">/usr/com</code> <code class="bash plain">--mandir=</code><code class="bash plain">/usr/share/man</code> <code class="bash plain">--infodir=</code><code class="bash plain">/usr/share/info</code> <code class="bash plain">--cache-</code><code class="bash functions">file</code><code class="bash plain">=..</code><code class="bash plain">/config</code><code class="bash plain">.cache --with-config-</code><code class="bash functions">file</code><code class="bash plain">-path=</code><code class="bash plain">/etc</code> <code class="bash plain">--with-config-</code><code class="bash functions">file</code><code class="bash plain">-scan-</code><code class="bash functions">dir</code><code class="bash plain">=</code><code class="bash plain">/etc/php</code><code class="bash plain">.d  --</code><code class="bash functions">enable</code><code class="bash plain">-fastcgi --</code><code class="bash functions">enable</code><code class="bash plain">-force-cgi-redirect</code> </td> </tr> </tbody> </table> 詳細については、Unix のようなオペレーティング システムで php をコンパイルして再インストールする方法を参照してください<p> </p> <p> #3: PHP 情報漏洩を防ぐ<strong></strong> </p> export_phpを解除することでPHPの情報漏洩を制限できます。 /etc/php.d/security.ini を次のように編集します: <p> </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> 1 <td class="gutter"> </td> <td class="code"> <code class="bash plain">expose_php=Off</code> </td> </tr> </tbody> </table> expose_php は、バージョンを含むサーバー上の PHP 情報を HTTP ヘッダーに追加します (例: X-Powered-By: PHP/5.3.3)。同時に、PHP のグローバル統一識別子も公開されます。 export_php が有効になっている場合は、次のコマンドで PHP バージョン情報を確認できます: <p> </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> 1 <td class="gutter"> </td> <td class="code"> <code class="bash plain">$ curl -I http:</code><code class="bash plain">//www</code><code class="bash plain">.cyberciti.biz</code><code class="bash plain">/index</code><code class="bash plain">.php</code> </td> </tr> </tbody> <p> サンプル出力: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 4 5 6 7 </td> <td class="code"> <code class="bash plain">HTTP</code><code class="bash plain">/1</code><code class="bash plain">.1 200 OK</code> <code class="bash spaces"> </code><code class="bash plain">X-Powered-By: PHP</code><code class="bash plain">/5</code><code class="bash plain">.3.3</code> <code class="bash spaces"> </code><code class="bash plain">Content-</code><code class="bash functions">type</code><code class="bash plain">: text</code><code class="bash plain">/html</code><code class="bash plain">; charset=UTF-8</code> <code class="bash spaces"> </code><code class="bash plain">Vary: Accept-Encoding, Cookie</code> <code class="bash spaces"> </code><code class="bash plain">X-Vary-Options: Accept-Encoding;list-contains=</code><code class="bash functions">gzip</code><code class="bash plain">,Cookie;string-contains=wikiToken;string-contains=wikiLoggedOut;string-contains=wiki_session</code> <code class="bash spaces"> </code><code class="bash plain">Last-Modified: Thu, 03 Nov 2011 22:32:55 GMT </code> <code class="bash spaces"> </code><code class="bash plain">...</code> </td> </tr> </tbody> </table> <p> Apacheのバージョンなどの情報も同時に非表示にすることをお勧めします: httpd.confのServerTokensとServerSignatureディレクティブでApacheのバージョンを非表示にします</p> <p><strong> #4: ロード可能なPHPモジュールを最小限に抑える(動的拡張)</strong></p> <p> PHPは「動的拡張機能」をサポートしています。デフォルトでは、RHEL はすべての拡張モジュールを /etc/php.d/ ディレクトリにロードします。特定のモジュールを有効またはキャンセルする必要がある場合は、/etc/php.d/ ディレクトリの設定ファイル内のモジュールをコメントアウトするだけです。ファイルを削除したり、モジュールの構成ファイルの名前を変更したりすることもできます。 PHP のパフォーマンスとセキュリティを最適化するには、Web アプリケーションに必要な拡張機能のみを有効にする必要があります。たとえば、次のコマンドを使用して GD モジュールをキャンセルします: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 </td> <td class="code"> <code class="bash comments"># cd /etc/php.d/</code> <code class="bash spaces"> </code><code class="bash comments"># mv gd.{ini,disable}</code> <code class="bash spaces"> </code><code class="bash comments"># <tbody> <tr> <td class="gutter"> 1 2 </td> <td class="code"> <code class="bash comments"># mv gd.{disable,ini}</code># mv gd.{無効化,ini} <code class="bash spaces"> </code><code class="bash comments"># <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">display_errors=Off</code> </td> </tr> </tbody> </code> </td> </tr> </tbody></code> </td> </tr> </tbody> </table> <p> すべてのエラー メッセージを必ずログ ファイルに記録してください</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 </td> <td class="code"> <code class="bash plain">log_errors=On</code> <code class="bash plain">error_log=</code><code class="bash plain">/var/log/httpd/php_scripts_error</code><code class="bash plain">.log</code> </td> </tr> </tbody> </table> <p><strong> #6: ファイルのアップロードを無効にする</strong></p> <p>セキュリティ上の理由から、ファイルのアップロードをキャンセルするには/etc/php.d/security.iniを次のように編集してください</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">file_uploads=Off</code> </td> </tr> </tbody> </table> <p> ユーザーが本当にファイルをアップロードする必要がある場合は、それを有効にしてから、PHP が受け入れる最大ファイル サイズを制限します。 </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 </td> <td class="code"> <code class="bash plain">file_uploads=On</code> <code class="bash comments"># user can only upload upto 1MB via php</code># 人のユーザーは php 経由で最大 1MB までしかアップロードできません <code class="bash plain">upload_max_filesize=1M</code> </td> </tr> </tbody> </table> <p><strong> #7: リモートコード実行をオフにする</strong></p> <p> この機能が有効になっている場合、PHP は file_get_contents() で FTP や Web コンテンツなどのリモート データを取得し、allow_url_fopen を通じて include、require することができます。プログラマはユーザー入力のサニタイズを忘れることが多く、これらの関数がこのデータを呼び出すと、インジェクションの脆弱性が発生します。 PHP ベースの Web アプリケーションでは、コード内の多数のインジェクション脆弱性がこれによって引き起こされます。この機能は、/etc/php.d/security.ini を編集することでオフにできます: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">allow_url_fopen=Off</code> </td> </tr> </tbody> </table> <p> さらに、allow_url_include をキャンセルすることをお勧めします: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">allow_url_include=Off</code> </td> </tr> </tbody> </table> <p><strong> #8: SQL セーフ モードを有効にする</strong></p> <p> /etc/php.d/security.iniを次のように変更します。 </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> 1 <td class="gutter"> </td> <td class="code"> <code class="bash plain">sql.safe_mode=On</code> </td> </tr> </tbody> </table> この機能が有効になっている場合、mysql_connect() と mysql_pconnect() は渡されたすべてのパラメーターを無視します。同時に、コードにも対応する変更を加える必要があります。 WordPress などのサードパーティおよびオープンソース アプリケーションは、sql.safe_mode では正しく動作しない可能性があります。また、PHP バージョン 5.3.x の magic_quotes_gpc フィルタリングは単純で粗雑で非効率であるため、オフにすることをお勧めします。 mysql_escape_string() とカスタムフィルター関数を使用する方が良いでしょう<p> </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> 1 <td class="gutter"> </td> <td class="code"> <code class="bash plain">magic_quotes_gpc=Off</code> </td> </tr> </tbody> </table> <p> #9: POSTデータサイズの制御<strong></strong> </p> HTTP POST は通常、ファイルのアップロードやフォームの送信など、Apache Web サーバーにデータを送信するリクエストの一部としてクライアントによって使用されます。攻撃者は、サーバー リソースを消費するために非常に大規模な POST リクエストを送信しようとします。 /etc/php.d/security.ini を次のように編集して、POST の最大サイズを制限します: <p> </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> 1 2 <td class="gutter"> </td> <td class="code"> <code class="bash plain">; 在这里设置一个靠谱的数值</code> <code class="bash spaces"> </code><code class="bash plain">post_max_size=1K</code> </td> </tr> </tbody> </table> ここでは最大サイズ1Kを設定します。この設定はファイルのアップロードに影響します。大きなファイルをアップロードするには、この値を update_max_filesize より大きくする必要があります。 <p>Apache で使用可能なリクエスト メソッドを制限し、httpd.conf を次のように編集することをお勧めします。 <br> </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> 1 2 3 4 5 6 <tr> <td class="gutter"> </td> <td class="code"> <code class="bash plain"><Directory </code><code class="bash plain">/var/www/html</code><code class="bash plain">></code> <code class="bash spaces">     </code><code class="bash plain"><LimitExcept GET POST></code> <code class="bash spaces">         </code><code class="bash plain">Order allow,deny</code> <code class="bash spaces">     </code><code class="bash plain"><</code><code class="bash plain">/LimitExcept</code><code class="bash plain">></code> <code class="bash spaces"> </code><code class="bash comments">## Add rest of the config goes here... ##</code> <code class="bash spaces"> </code><code class="bash plain"><</code><code class="bash plain">/Directory</code><code class="bash plain">></code> </td> </tr> </tbody> </table> #10: リソース制御(DoS制御)<p><strong> </strong> 各PHPスクリプトの最大実行時間を設定します。また、要求されたデータの処理に費やされる最大時間と、使用可能なメモリの最大量を制限することをお勧めします。 </p> <p> #単位:秒</p> <p> </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> 1 2 3 <tr> <td class="gutter"> </td> <td class="code"> <code class="bash plain">max_execution_time = 30</code> <code class="bash plain">max_input_time = 30</code> <code class="bash plain">memory_limit = 40M</code> </td> </tr> </tbody> </table> #11: PHP 用 Suhosin Advanced Protection System をインストールする<p><strong> </strong> 詳細はSuhosinプロジェクトページ:プロジェクトページをご覧ください</p> <p></p> #12: 危険な PHP 関数をキャンセルする<p><strong> </strong> PHPにはサーバーに侵入できる機能が多数あり、使い方を誤ると脆弱性になってしまいます。これらの機能を次のようにキャンセルします: </p> <p> </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> 1 <tr> <td class="gutter"> </td> <td class="code"> <code class="bash plain">disable_functions =</code><code class="bash functions">exec</code><code class="bash plain">,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source</code> </td> </tr> <p><strong> #13: PHP Fastcgi/CGI – cgi.force_redirect 管理</strong></p> <p> PHPはFastcgiと連携できます。 Fastcgi は、Web サーバーのメモリ使用量を削減し、PHP のパフォーマンスを向上させることができます。 Apache2+PHP+FastCGIの設定はこれを参照してください。この構成では、cgi.force_redirect により、ユーザーが URL にアクセスして PHP を呼び出すことができなくなります。セキュリティ上の理由から、この機能を有効にしてください: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 </td> <td class="code"> <code class="bash plain">; Enable cgi.force_redirect </code><code class="bash keyword">for</code> <code class="bash plain">security reasons </code><code class="bash keyword">in</code> <code class="bash plain">a typical *Apache+PHP-CGI</code><code class="bash plain">/FastCGI</code><code class="bash plain">* setup</code> <code class="bash spaces"> </code><code class="bash plain">cgi.force_redirect=On</code> </td> </tr> </tbody> </table> <p><strong> #14: PHPユーザーとユーザーグループID</strong></p> <p> mod_fastcgi は、外部の FASTCGI サーバーに接続できる Apache Web サービスの CGI モジュールです。 PHP が非 root ユーザーとして実行されていることを確認する必要があります。 UID が 100 未満の root 権限またはユーザー権限を使用すると、オペレーティング システム ファイルにもアクセスできます。 PHP CGI は、Apache の suEXEC または mod_suPHP を介して、特権のないユーザーで実行できます。 suEXEC は、CGI プログラムを呼び出す Apache のユーザー ID が、実行中の Apache のユーザー ID と異なる可能性があります。以下の通り: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># ps aux | grep php-cgi</code> </td> </tr> </tbody> </table> <p>サンプル出力: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 4 5 6 7 </td> <td class="code"> <code class="bash plain">phpcgi      6012  0.0  0.4 225036 60140          S    Nov22   0:12 </code><code class="bash plain">/usr/bin/php-cgi</code> <code class="bash plain">phpcgi      6054  0.0  0.5 229928 62820          S    Nov22   0:11 </code><code class="bash plain">/usr/bin/php-cgi</code> <code class="bash plain">phpcgi      6055  0.1  0.4 224944 53260          S    Nov22   0:18 </code><code class="bash plain">/usr/bin/php-cgi</code> <code class="bash plain">phpcgi      6085  0.0  0.4 224680 56948          S    Nov22   0:11 </code><code class="bash plain">/usr/bin/php-cgi</code> <code class="bash plain">phpcgi      6103  0.0  0.4 224564 57956          S    Nov22   0:11 </code><code class="bash plain">/usr/bin/php-cgi</code> <code class="bash plain">phpcgi      6815  0.4  0.5 228556 61220          S    00:52   0:19 </code><code class="bash plain">/usr/bin/php-cgi</code> <code class="bash plain">phpcgi      6821  0.3  0.5 228008 61252          S    00:55   0:12 </code><code class="bash plain">/usr/bin/php-cgi</code> </td> </tr> </tbody> </table> <p> spawn-fcgi を使用して、phpcgi ユーザー用にリモートまたはローカルの FastCGI プロセスを生成できます (このユーザーが存在する場合)。 </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> 1 <td class="gutter"> </td> <td class="code"> <code class="bash comments"># spawn-fcgi -a 127.0.0.1 -p 9000 -u phpcgi -g phpcgi -f /usr/bin/php-cgi</code> </td> </tr> </tbody> <p> 127.0.0.1:9000 で実行されている FastCGI を呼び出すように、Apache、Lighthttpd、または Nginx Web サービスを構成できるようになりました。 </p> <p><strong> #15: ファイルシステムへの PHP アクセスを制限する</strong></p> <p> open_basedir は、fopen() などの関数を通じてアクセスできるディレクトリなど、PHP の実行ディレクトリを制限します。アクセスされたディレクトリが open_basedir 内にない場合、PHP はアクセスを拒否します。ソフト リンクをワークスペースとして使用しないでください。たとえば、/var/www/html へのアクセスのみを許可し、/var/www、/tmp、または /etc ディレクトリへのアクセスは許可しません。 </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 4 5 6 7 </td> <td class="code"> <code class="bash plain">; Limits the PHP process from accessing files outside </code> <code class="bash spaces"> </code><code class="bash plain">; of specifically designated directories such as </code><code class="bash plain">/var/www/html/</code> <code class="bash spaces"> </code><code class="bash plain">open_basedir=</code><code class="bash string">"/var/www/html/"</code> <code class="bash spaces"> </code><code class="bash plain">; ------------------------------------</code> <code class="bash spaces"> </code><code class="bash plain">; Multiple </code><code class="bash functions">dirs</code> <code class="bash plain">example </code> <code class="bash spaces"> </code><code class="bash plain">; open_basedir=</code><code class="bash string">"/home/httpd/vhost/cyberciti.biz/html/:/home/httpd/vhost/nixcraft.com/html/:/home/httpd/vhost/theos.in/html/"</code> <code class="bash spaces"> </code><code class="bash plain">; ------------------------------------</code> </td> </tr> </tbody> </table> <p><strong> #16: セッションパス</strong></p> <p> PHPセッションユーザーは、次回以降のアクセスのためのデータ保存機能を提供します。これにより、アプリがよりカスタマイズ可能になり、より魅力的になります。すべてのセッション関連データは session.save_path に保存されます。 RHEL/CentOS/Fedora Linux のデフォルト設定は次のとおりです: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 </td> <td class="code"> <code class="bash plain">session.save_path=</code><code class="bash string">"/var/lib/php/session"</code> <code class="bash spaces"> </code><code class="bash plain">; Set the temporary directory used </code><code class="bash keyword">for</code> <code class="bash plain">storing files when doing </code><code class="bash functions">file</code> <code class="bash plain">upload</code> <code class="bash spaces"> </code><code class="bash plain">upload_tmp_dir=</code><code class="bash string">"/var/lib/php/session"</code> </td> </tr> </tbody> </table> <p> このパスが /var/www/html の外側にあり、他のシステム ユーザーがアクセスできないことを確認します。 </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># ls -Z /var/lib/php/</code> </td> </tr> </tbody> </table> <p> サンプル出力: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">drwxrwx---. root apache system_u:object_r:httpd_var_run_t:s0 session</code> </td> </tr> </tbody> </table> <p> 注: ls -Z は、ファイル モード、ユーザー、グループ、セキュリティ情報、ファイル名などの SELinux セキュリティ情報を表示します。 </p> <p><strong> #17: PHP、ソフトウェア、オペレーティング システムが最新のものに更新されていることを確認してください</strong></p> <p> Linux、Apache、PHP、MySQL サーバーのメンテナンスの重要な部分は、セキュリティ パッチの更新です。すべての PHP セキュリティ更新をできるだけ早く確認し、更新する必要があります。次のコマンドを使用できます (パッケージマネージャーを通じて PHP をインストールした場合): </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># yum update</code> </td> </tr> </tbody> </table> <p> または</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># apt-get update && apt-get upgrade</code> </td> </tr> </tbody> </table> <p> Red Hat/CentOS/Fedora Linux を設定して yum パッケージ更新リマインダーを電子メールで送信したり、Debian/Ubuntu Linux で apticron を設定してリマインダーを送信したりできます。または、cron スケジュールされたタスクを通じて更新します。 </p> <p>注: 最新の PHP バージョン情報については、php.net を確認してください</p> <p><strong> #18: ファイルとディレクトリへのアクセスを制限する</strong></p> <p> Apache や www などの非 root ユーザーとして Apache を実行することを確認します。 /var/www/html ディレクトリの所有者も非 root ユーザーである必要があります: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># chown -R apache:apache /var/www/html/</code> </td> </tr> </tbody> </table> <p> DocumentRoot配下のファイルの実行や作成を禁止する必要があります。このディレクトリのファイル権限を 0444 (読み取り専用) に設定します: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># chmod -R 0444 /var/www/html/</code> </td> </tr> </tbody> </table> <p> このディレクトリ内のすべてのフォルダーの権限を 0445 に設定します</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># find /var/www/html/ -type d -print0 | xargs -0 -I {} chmod 0445 {}</code> </td> </tr> </tbody> </table> <p><strong> #19: Apache、PHP、MySQL 設定ファイルの書き込み保護</strong></p> <p> chattr コマンドを使用して、次の構成ファイルに書き込み保護を追加します: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 4 5 </td> <td class="code"> <code class="bash comments"># chattr +i /etc/php.ini</code> <code class="bash comments"># chattr +i /etc/php.d/*</code> <code class="bash comments"># chattr +i /etc/my.ini</code> <code class="bash comments"># chattr +i /etc/httpd/conf/httpd.conf</code> <code class="bash comments"># chattr +i /etc/</code> </td> </tr> </tbody> </table> <p> /var/www/html ディレクトリに書き込み保護を追加することもできます </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># chattr +i /var/www/html/file1.php# chattr +i /var/www/html/</code> </td> </tr> </tbody> </table> <p><strong> #20: Linux セキュリティ拡張機能 (SELinux など) を使用する</strong></p> <p> Linuxには、サービスプログラムの設定ミスや脆弱性を防ぐためのさまざまなセキュリティソリューションがあります。可能な限り、SELinux またはその他の Linux セキュリティ ソリューションを使用して、ネットワークとプログラムを制限します。たとえば、SELinux は、Linux カーネルまたは Apache Web サービスにさまざまなセキュリティ ポリシーを提供します。次のコマンドを使用して、すべての Apache 保護情報を一覧表示します: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># getsebool -a | grep httpd</code> </td> </tr> </tbody> </table> <p>サンプル出力: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 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 </td> <td class="code"> <code class="bash plain">allow_httpd_anon_write --> off</code> <code class="bash plain">allow_httpd_mod_auth_ntlm_winbind --> off</code> <code class="bash plain">allow_httpd_mod_auth_pam --> off</code> <code class="bash plain">allow_httpd_sys_script_anon_write --> off</code> <code class="bash plain">httpd_builtin_scripting --> on</code> <code class="bash plain">httpd_can_check_spam --> off</code> <code class="bash plain">httpd_can_network_connect --> off</code> <code class="bash plain">httpd_can_network_connect_cobbler --> off</code> <code class="bash plain">httpd_can_network_connect_db --> off</code> <code class="bash plain">httpd_can_network_memcache --> off</code> <code class="bash plain">httpd_can_network_relay --> off</code> <code class="bash plain">httpd_can_sendmail --> off</code> <code class="bash plain">httpd_dbus_avahi --> on</code> <code class="bash plain">httpd_enable_cgi --> on</code> <code class="bash plain">httpd_enable_ftp_server --> off</code> <code class="bash plain">httpd_enable_homedirs --> off</code> <code class="bash plain">httpd_execmem --> off</code> <code class="bash plain">httpd_read_user_content --> off</code> <code class="bash plain">httpd_setrlimit --> off</code> <code class="bash plain">httpd_ssi_exec --> off</code> <code class="bash plain">httpd_tmp_exec --> off</code> <code class="bash plain">httpd_tty_comm --> on</code> <code class="bash plain">httpd_unified --> on</code> <code class="bash plain">httpd_use_cifs --> off</code> <code class="bash plain">httpd_use_gpg --> off</code> <code class="bash plain">httpd_use_nfs --> off</code> </td> </tr> </tbody> </table> <p> Apache CGI サポートをキャンセルするには、次のように入力できます: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash comments"># setsebool -P httpd_enable_cgi off</code> </td> </tr> </tbody> </table> <p> 詳細なリファレンス: Red Hat SELinux ガイド</p> <p><strong> #21: Mod_securityをインストールする</strong></p> <p> ModSecurity は、オープンソースの侵入検知および防御 Web アプリケーション エンジンです。 mod_security をインストールして、Apache および PHP アプリケーションを XSS やその他の攻撃から保護します。 </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 4 5 6 7 </td> <td class="code"> <code class="bash comments">## A few Examples ##</code> <code class="bash spaces"> </code><code class="bash comments"># Do not allow to open files in /etc/</code> <code class="bash spaces"> </code><code class="bash plain">SecFilter </code><code class="bash plain">/etc/</code> ​ <code class="bash spaces"> </code><code class="bash comments"># Stop SQL injection</code> <code class="bash spaces"> </code><code class="bash plain">SecFilter </code><code class="bash string">"delete[[:space:]]+from"</code> <code class="bash spaces"> </code><code class="bash plain">SecFilter </code><code class="bash string">"select.+from"</code> </td> </tr> </tbody> </table> <p><strong> #22: 可能であれば、Chroot Jail で Apache/PHP を実行します</strong></p> <p> Chroot Jail の下で Apache/PHP を実行すると、ファイル システムの下の小さな領域への損傷の可能性を最小限に抑えることができます。 Apache は、Apache で通常の chroot: chroot のようなセットアップを使用して設定できます。ただし、FreeBSD ジェイル、XEN、KVM、または OpenVZ 仮想化を使用することをお勧めします。 </p> <p><strong> #23: ファイアウォールを使用して発信接続を制限する</strong></p> <p>攻撃者は wget などのツールを使用して Web サーバーからファイルをダウンロードします。 iptables を使用して、Apache ユーザーの発信接続をブロックします。 ipt_owner モジュールは、ローカル パケットのジェネレーターにさまざまな役割を割り当てます。 OUTPUT チェーンに対してのみ有効です。次のコマンドにより、vivek ユーザーはポート 80 を介して外部からアクセスできます: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 </td> <td class="code"> <code class="bash plain">/sbin/iptables</code> <code class="bash plain">-A OUTPUT -o eth0 -m owner --uid-owner vivek -p tcp --dport 80 -m state --state NEW,ESTABLISHED  -j ACCEPT</code> </td> </tr> </tbody> </table> <p> 次の例では、すべての Apache ユーザーからの発信接続をブロックし、smtp サービスとスパム識別 API サービスのみの通過を許可します。 </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 <td class="gutter"> </td> <td class="code"> <code class="bash comments"># ....  </code> <code class="bash spaces"> </code><code class="bash plain">/sbin/iptables</code> <code class="bash plain">--new-chain apache_user</code> <code class="bash spaces"> </code><code class="bash plain">/sbin/iptables</code> <code class="bash plain">--append OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</code> <code class="bash spaces"> </code><code class="bash plain">/sbin/iptables</code> <code class="bash plain">--append OUTPUT -m owner --uid-owner apache -j apache_user</code> <code class="bash spaces"> </code><code class="bash comments"># allow apache user to connec to our smtp server </code> <code class="bash spaces"> </code><code class="bash plain">/sbin/iptables</code> <code class="bash plain">--append apache_user -p tcp --syn -d 192.168.1.100 --dport 25 -j RETURN</code> <code class="bash spaces"> </code><code class="bash comments"># Allow apache user to connec to api server for spam validation</code> <code class="bash spaces"> </code><code class="bash plain">/sbin/iptables</code> <code class="bash plain">--append apache_user -p tcp --syn -d  66.135.58.62 --dport 80 -j RETURN</code> <code class="bash spaces"> </code><code class="bash plain">/sbin/iptables</code> <code class="bash plain">--append apache_user -p tcp --syn -d  66.135.58.61 --dport 80 -j RETURN</code> <code class="bash spaces"> </code><code class="bash plain">/sbin/iptables</code> <code class="bash plain">--append apache_user -p tcp --syn -d  72.233.69.89 --dport 80 -j RETURN</code> <code class="bash spaces"> </code><code class="bash plain">/sbin/iptables</code> <code class="bash plain">--append apache_user -p tcp --syn -d  72.233.69.88 --dport 80 -j RETURN</code> <code class="bash spaces"> </code><code class="bash comments">#########################</code> <code class="bash spaces"> </code><code class="bash comments">## Add more rules here ##</code> <code class="bash spaces"> </code><code class="bash comments">#########################</code> <code class="bash spaces"> </code><code class="bash comments"># No editing below</code> <code class="bash spaces"> </code><code class="bash comments"># Drop everything for apache outgoing connection</code> <code class="bash spaces"> </code><code class="bash plain">/sbin/iptables</code> <code class="bash plain">--append apache_user -j REJECT</code> </td> </tr> </tbody> <p><strong> #24: ログを表示してレビューする</strong></p> <p>Apache ログ ファイルを表示する: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 </td> <td class="code"> <code class="bash comments"># tail -f /var/log/httpd/error_log</code> <code class="bash comments"># grep 'login.php' /var/log/httpd/error_log</code> <code class="bash comments"># egrep -i "denied|error|warn" /var/log/httpd/error_log</code> </td> </tr> </tbody> </table> <p>PHP ログ ファイルを表示: </p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 </td> <td class="code"> <code class="bash comments"># tail -f /var/log/httpd/php_scripts_error.log</code> <code class="bash comments"># grep "...etc/passwd" /var/log/httpd/php_scripts_error.log</code> </td> </tr> </tbody> </table> <p> ログファイルを見ると、サーバーがどのような攻撃を受けているかを知ることができ、現在のセキュリティレベルが十分かどうかを分析できます。システム監査の監査サービスを有効にします。これにより、SELinux 時間、検証イベント、ファイル変更、アカウント変更などを監査できます。 Web サーバーを監視するには、Linux システム監視ツールを使用することをお勧めします。 </p> <p><strong> #25: サービスを異なるサーバーまたは仮想マシンに分離する</strong></p> <p>比較的大規模なインストール構成の場合は、操作、データベース、静的および動的コンテンツを異なるサーバーに分離することをお勧めします</p> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="gutter"> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 </td> <td class="code"> <code class="bash plain">///////////////</code> <code class="bash spaces"> </code><code class="bash plain">/ ISP</code><code class="bash plain">/Router</code> <code class="bash plain">/</code> <code class="bash spaces"> </code><code class="bash plain">//////////////</code> <code class="bash spaces">   </code><code class="bash plain"></code> <code class="bash spaces">    </code><code class="bash plain">|</code> <code class="bash spaces">    </code><code class="bash plain">Firewall</code> <code class="bash spaces">      </code><code class="bash plain"></code> <code class="bash spaces">       </code><code class="bash plain">|</code> <code class="bash spaces">      </code><code class="bash plain">+------------+</code> <code class="bash spaces">      </code><code class="bash plain">| LB01       |</code> <code class="bash spaces">      </code><code class="bash plain">+------------+                 +--------------------------+</code> <code class="bash spaces">                   </code><code class="bash plain">|                 | static.lan.cyberciti.biz |</code> <code class="bash spaces">                   </code><code class="bash plain">+-----------------+--------------------------+</code> <code class="bash spaces">                                     </code><code class="bash plain">| phpcgi1.lan.cyberciti.biz|</code> <code class="bash spaces">                                     </code><code class="bash plain">+--------------------------+</code> <code class="bash spaces">                                     </code><code class="bash plain">| phpcgi2.lan.cyberciti.biz|</code> <code class="bash spaces">                                     </code><code class="bash plain">+--------------------------+</code> <code class="bash spaces">                                     </code><code class="bash plain">| mysql1.lan.cyberciti.biz |</code> <code class="bash spaces">                                     </code><code class="bash plain">+--------------------------+</code> <code class="bash spaces">                                     </code><code class="bash plain">| mcache1.lan.cyberciti.biz|</code> <code class="bash spaces">                                     </code><code class="bash plain">+--------------------------+</code> </td> </tr> </tbody> </table> <p> 異なるサーバーまたは仮想マシンで異なるネットワーク サービスを実行すると、他のサービスへの侵入による影響を軽減できます。たとえば、攻撃者が Apache に侵入すると、同じサーバー内の他のサービス (MySQL、電子メール サービスなど) にアクセスできます。しかし、上の例ではそうではありません: </p> <ul> <ul> <li>static.lan.cybercity.biz – lighttpd または nginx を使用して、js/css/images などの静的リソースを保存します</li> <li>phpcgi1.lan.cyberciti.biz および phpcgi2.lan.cyberciti.biz – 動的コンテンツを生成するための Apache Web サービス + PHP </li> <li>mysql1.lan.cyberciti.biz – MySQL データベース サービス</li> <li>mcache1.lan.cyberciti.biz – Memcached サービス (MySQL のキャッシュ システム)。 libevent または epoll を使用して、任意の数の接続に対応します。また、ノンブロッキングネットワーク IO を使用します。 </li> <li>LB01 – Nginx サーバー、Web および Apache フロントエンド用のリバース プロキシ。すべてのアクセス接続は直接処理されるか、nginx プロキシ サービスを通じて対応する Web サーバーに配信されます。 LB01 は、シンプルな負荷分散を提供します。 </li> </ul> </ul> <div class="header2"><span class="icon i-relatedanswer"><h3 id="PHPを使用して権限設定を記述するには-スーパー管理者は通常の管理者を削除できます">PHPを使用して権限設定を記述するには、スーパー管理者は通常の管理者を削除できます</h3></span></div> <div class="best-replyer">。 </div> dz が行うことは、設定ファイルに創設者の uid を書き込むことです。複数の<p class="ft"><br>削除がある場合、削除された当事者が創設者ではないかどうかを判断するだけです<br><br>。これにはデータテーブルの変更(フィールド識別子の追加)は必要ありません。 ))、比較的便利です。 <br><br>詳しいコードはありません^_^<br> <br> </p> <div class="header2"><span class="icon i-relatedanswer">ASP と php ではどちらの方が安全ですか?<h3></h3></span></div> <div class="best-replyer"> </div>開発言語にはセキュリティの高低の区別はありません <p class="ft p1">セキュリティ意識の高いプログラマのみが対象です <br>Windows のセキュリティは Mac システムや LUNIX システムの何倍も高いですが、常にセキュリティ ホールが存在します。 Mac システムは安全性が高いですか? 答えは間違いなく「ノー」です。なぜなら、人々は Windows を使用しており、ハッカー マスターは Windows を研究しているからです。考えてみてください。 MAC の研究をして、やっと調べたのですが、ハッキングする MAC システムが見つからなくて落ち込むことがあります。 <br><br>例えば、私が会社のサーバーをハッキングしたいのに、相手のサーバーが Windows システムを使用している場合でも、私は Mac システムの脆弱性を調査すると思いますか? <br><br>同様に。 <br><br>ASPやPHPと同じ。 <br>重要なのは、プログラムを書くプログラマーになることです。 <br> <br><br> <br><br><br>http://www.bkjia.com/PHPjc/905901.html<br><br>www.bkjia.com</p>tru​​e<p align="left"></p> <div style="display:none;">http://www.bkjia.com/PHPjc/905901.html<span id="url" itemprop="url"></span>技術記事<span id="indexUrl" itemprop="indexUrl"></span> 25 システム管理者のための PHP セキュリティ実践、システム管理者のための php PHP は、広く使用されているオープン ソースのサーバー側スクリプト言語です。 HTTP または HTTPS プロトコルを介して、Apache Web サービスによりユーザーは...<span id="isOriginal" itemprop="isOriginal"></span><span id="isBasedOnUrl" itemprop="isBasedOnUrl"></span> にアクセスできるようになります。 <span id="genre" itemprop="genre"></span> </div> </table> </table> </tbody> </table> </table>
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

11ベストPHP URLショートナースクリプト(無料およびプレミアム) 11ベストPHP URLショートナースクリプト(無料およびプレミアム) Mar 03, 2025 am 10:49 AM

多くの場合、キーワードと追跡パラメーターで散らかった長いURLは、訪問者を阻止できます。 URL短縮スクリプトはソリューションを提供し、ソーシャルメディアやその他のプラットフォームに最適な簡潔なリンクを作成します。 これらのスクリプトは、個々のWebサイトにとって価値があります

Instagram APIの紹介 Instagram APIの紹介 Mar 02, 2025 am 09:32 AM

2012年のFacebookによる有名な買収に続いて、Instagramはサードパーティの使用のために2セットのAPIを採用しました。これらはInstagramグラフAPIとInstagram Basic Display APIです。

Laravelでフラッシュセッションデータを使用します Laravelでフラッシュセッションデータを使用します Mar 12, 2025 pm 05:08 PM

Laravelは、直感的なフラッシュメソッドを使用して、一時的なセッションデータの処理を簡素化します。これは、アプリケーション内に簡単なメッセージ、アラート、または通知を表示するのに最適です。 データは、デフォルトで次の要求のためにのみ持続します。 $リクエスト -

LaravelのバックエンドでReactアプリを構築する:パート2、React LaravelのバックエンドでReactアプリを構築する:パート2、React Mar 04, 2025 am 09:33 AM

これは、LaravelバックエンドとのReactアプリケーションの構築に関するシリーズの2番目と最終部分です。シリーズの最初の部分では、基本的な製品上場アプリケーションのためにLaravelを使用してRESTFUL APIを作成しました。このチュートリアルでは、開発者になります

Laravelテストでの簡略化されたHTTP応答のモッキング Laravelテストでの簡略化されたHTTP応答のモッキング Mar 12, 2025 pm 05:09 PM

Laravelは簡潔なHTTP応答シミュレーション構文を提供し、HTTP相互作用テストを簡素化します。このアプローチは、テストシミュレーションをより直感的にしながら、コード冗長性を大幅に削減します。 基本的な実装は、さまざまな応答タイプのショートカットを提供します。 Illuminate \ support \ facades \ httpを使用します。 http :: fake([[ 'google.com' => 'hello world'、 'github.com' => ['foo' => 'bar']、 'forge.laravel.com' =>

PHPのカール:REST APIでPHPカール拡張機能を使用する方法 PHPのカール:REST APIでPHPカール拡張機能を使用する方法 Mar 14, 2025 am 11:42 AM

PHPクライアントURL(CURL)拡張機能は、開発者にとって強力なツールであり、リモートサーバーやREST APIとのシームレスな対話を可能にします。尊敬されるマルチプロトコルファイル転送ライブラリであるLibcurlを活用することにより、PHP Curlは効率的なexecuを促進します

Codecanyonで12の最高のPHPチャットスクリプト Codecanyonで12の最高のPHPチャットスクリプト Mar 13, 2025 pm 12:08 PM

顧客の最も差し迫った問題にリアルタイムでインスタントソリューションを提供したいですか? ライブチャットを使用すると、顧客とのリアルタイムな会話を行い、すぐに問題を解決できます。それはあなたがあなたのカスタムにより速いサービスを提供することを可能にします

2025 PHP状況調査の発表 2025 PHP状況調査の発表 Mar 03, 2025 pm 04:20 PM

2025 PHP Landscape Surveyは、現在のPHP開発動向を調査しています。 開発者や企業に洞察を提供することを目的とした、フレームワークの使用、展開方法、および課題を調査します。 この調査では、現代のPHP Versioの成長が予想されています

See all articles