安全性修正 - OWASP ZAP 常見弱點掃描含修正
弱點:Secure Apache from Clickjacking with X-FRAME-OPTIONS 編輯 httpd.conf 檔案,並新增下列參數 #Secure Apache from Clickjacking with X-FRAME-OPTIONS Header always append X-Frame-Options SAMEORIGIN
儲存後退出,重啟伺服器
$ service httpd restart
弱點:Incomplete or No Cache-control and Pragma HTTP Header Set
在主目錄下編輯或建立 .htaccess 檔案,並複製貼上下列內容
# DISABLE CACHING<IfModule mod_headers.c>Header set Cache-Control "no-cache, no-store, must-revalidate"Header set Pragma "no-cache"Header set Expires 0</IfModule><FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|swf|txt)$"><IfModule mod_expires.c>ExpiresActive Off</IfModule><IfModule mod_headers.c>FileETag NoneHeader unset ETagHeader unset PragmaHeader unset Cache-ControlHeader unset Last-ModifiedHeader set Pragma "no-cache"Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"</IfModule></FilesMatch>儲存後退出,重啟伺服器
$ service httpd restart
#弱點:X-Content-Type-Options Header Missing 在主目錄下編輯或建立 .htaccess 檔案,並複製貼上下列內容 Header unset X-Powered-By 儲存後退出,重啟伺服器 $ service httpd restart#資料來源請參考:#https://stackoverflow.com/questions/2661799/removing-x-powered-by
弱點:Secure MIME Types in Apache & Nginx with X-Content-Type-Options編輯 httpd.conf 檔案並確認 /etc/httpd/conf.modules.d/00-base.conf裡面的 mod_headers.so 模組是啟用的.LoadModule headers_module modules/mod_headers.so並新增下列參數#Secure MIME Types in Apache & Nginx with X-Content-Type-OptionsHeader set X-Content-Type-Options nosniff儲存後退出,重啟伺服器 $ service httpd restart 來源請參考 https://geekflare.com/secure-mime-types-in-apache-nginx-with-x-content-type-options/
#Disable Server Signature on Apache by editing config file $ vim /etc/httpd/conf/httpd.conf 加入下列敘述 ServerSignature Off ServerTokens Prod儲存後退出,重啟伺服器$ service httpd restart
.httacess 設定檔,這個太好用了,很多安全防護功能都有了
https://gist.github.com/voku/d958041e7b1c19356e721de1eda1e6f8
留言
張貼留言