Aapche
以下設定,皆是編輯 /etc/httpd/conf/httpd.conf1.關閉Apache回應資訊功能
ServerTokens ProductOnly
ServerSignature Off
TraceEnable Off
2.設定 Cookie HttpOnly,降低XSS漏洞攻擊。ServerSignature Off
TraceEnable Off
Header edit Set-Cookie ^(.*)$ $1;HttpOnly; Secure
較舊的版本則改用
Header set Set-Cookie HttpOnly;Secure
3.關閉Apache回應目錄功能找到網頁放置目錄的標籤,在<Directory "/var/www">與</Directory>包含的區塊內新增
Options None
4.限制特定目錄的存取權限例:限制phpMyAdmin目錄存取
找到phpmyadmin目錄的標籤(若沒有可自行建立)
在<Directory "/var/www/phpmyadmin">與</Directory>包含的區塊內新增
Order allow,deny
Allow from [來源IP]
Allow from [來源IP]
PHP
以下設定,皆是編輯 /etc/php.ini1.關閉開啟遠端檔案與include遠端檔案功能
allow_url_fopen = Off
allow_url_include = Off
2.禁用易造成危害的functionallow_url_include = Off
disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
3.隱藏php版本(並無法增加安全性)
expose_php = Off
4.設定正確的時區
date.timezone = "Asia/Taipei"
5.限制腳本可取得的最大記憶體
memory_limit = 32M
6.關閉register_globals本特性已自 PHP 5.3.0 起廢棄並將自 PHP 5.4.0 起移除。
register_globals = Off
7.關閉magic_quotes本特性已自 PHP 5.3.0 起廢棄並將自 PHP 5.4.0 起移除。
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
8.關閉display_errorsmagic_quotes_runtime = Off
magic_quotes_sybase = Off
display_errors = Off
9.使用HttpOnly cookie,降低XSS漏洞攻擊。
session.cookie_httponly = 1
沒有留言:
張貼留言