跳到主要內容

發表文章

目前顯示的是 2020的文章

安全性修正 - OWASP ZAP 常見弱點掃描含修正

安全性修正 - 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 None Header unset ETag Header unset Pragma Header unset Cache-Control Header unset Last-Modified Header set Pragma "no-cache" Header set Cache-Control "max-age=0, no-cache, no-store,...

安全性修正 - 調整 SSL 安全性設定含檢測 Rank A+

SSL 相關安全測試含修正 SSL 申請可以透過 SSL For Free 進行申請免費 SSL https://www.sslforfree.com/ 檢測 SSL 憑證安全的十種工具 https://geekflare.com/ssl-test-certificate/#SSL-Labs 如果有使用 VirtualHost 記得加在設定裡就可以 $ vim /etc/httpd/conf/http.conf   <VirtualHost *:80> RewriteEngine on RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) RewriteRule .* - [F] Alias /cp /var/www/cp/public <Directory /var/www/cp> AllowOverride All </Directory> <Directory /var/www/html> AllowOverride All </Directory> DocumentRoot /var/www/html ServerName www.sakura-home.com.tw </VirtualHost> <VirtualHost *:443> Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;" RewriteEngine on RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) RewriteRule .* - [F] SSLEngine on SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 ...

安全性修正 - Apache: Disable the HTTP TRACE Method

Apache: Disable the HTTP TRACE Method 編輯 apache 的系統檔( Apache 1.3.34、2.0.55 以後版本) $ vi /etc/httpd/conf/httpd.conf 最下方找空白的地方加入 TraceEnable off 重啟 apache 服務 $ service httpd restart 測試是否正常關閉 $ curl -i -X TRACE http://www._website_.com/ HTTP/1.1 405 Method Not Allowed Date: Wed, 13 Feb 2013 14:30:32 GMT Server: Apache/2.2.15 (CentOS) Allow: Content-Length: 223 Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>405 Method Not Allowed</title> </head><body> <h1>Method Not Allowed</h1> <p>The requested method TRACE is not allowed for the URL /.</p> </body></html>

Apache, PHP 7.3 and MySQL on CentOS 7.6

在裝機之前有幾件事情要先確認 hostname 設定不可為 SSL 憑證相同,可以隨便取名 root 密碼一定要修改,透過密碼產生器配置超過 20 碼長度 預設環境為 Apache, PHP 7.3 and MySQL on CentOS 7.6 https://www.howtoforge.com/tutorial/centos-lamp-server-apache-mysql-php/ 安裝過程中會出現 firewall 找不到功能指令的錯誤,請參考下篇進行操作 https://bobcares.com/blog/firewall-cmd-command-not-found/ 安裝完畢後,請立即修正 ssh 的登入 port 建議使用 10000 以上,修改請參考 Denyhosts攻擊 Linux各平台現在基本上都可以直接安裝Denyhosts了,直接運行命令安裝 1 yum install denyhosts 安裝好了Denyhosts,默認的配置基本上就可以防禦一定的暴力攻擊了, /etc/hosts.deny 文件裡保存了被屏蔽的記錄。 如果你要自定義Denyhosts的相關配置,執行: vi /etc/denyhosts.conf ,相關參數的說明可以自行搜索,一般用戶默認即可。 https://i-square.github.io/post/%E5%A2%9E%E5%BC%BAVPS%E5%AE%89%E5%85%A8%E6%80%A7%E7%9A%84%E5%B8%B8%E7%94%A8%E6%96%B9%E6%B3%95/ 為了避免 SYN 洪水攻擊,請參考下列文章進行修正 對於SYN flood攻擊,調整下面三個參數就可以防範絕大部分的攻擊了。 方式1:減少SYN-ACK數據包的重發次數(默認是5次): sysctl -w net.ipv4.tcp_synack_retries=3 sysctl -w net.ipv4.tcp_syn_retries=3 方式2:使用SYN Cookie技術: sysctl -w net.ipv4.tcp_syncookies=1 方式3:增加backlog隊列(默認是1...