iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 25
3
Security

資安這條路─以自建漏洞環境學習資訊安全系列 第 25

資安這條路 25- [Web 伺服器軟體] Nginx

Nginx

  • Nginx 一樣也是伺服器軟體
    • 非同步框架的開源伺服器軟體
    • 用途:反向代理、 HTTP Cache、平衡負載器
    • 處理 IO /靜態檔案比 Apache 好
    • 模組化設計
    • 記憶體消耗較低
    • 官網
  • 安裝 Nginx
    • apt-get install nginx
  • Docker
    • docker run -d -p 8080:80 --name nginx-web-server nginx
  • 預設設定檔案資料夾位置
    • /usr/local/nginx/conf/
    • /etc/nginx/
  • 預設設定檔案名稱 nginx.conf
    • /usr/local/nginx/conf/nginx.conf
    • /etc/nginx/nginx.conf
  • 預設網頁檔案資料夾
    • /usr/local/nginx/html/
    • /var/www/html
  • 預設 log 位置資料夾
    • /usr/local/nginx/logs/
    • /var/log/nginx
  • 更新 Nginx
    • yum update nginx
    • apt-get update nginx
  • 測試設定
    • nginx -t
  • 修改設定後可以重新仔入
    • nginx -s reload
  • 停止
    • nginx -s stop

針對 SSL

  • 有次在公事上執行弱點掃描的案子,客戶的機器上有許多跟 SSL 相關的弱點。
  • 我們推薦 https://ssl-config.mozilla.org/
  • SSL 安全設定供客戶使用

Https

  • 一樣使用 Certbot

常見弱點

  • 避免 clickjacking
    • add_header X-Frame-Options SAMEORIGIN;
  • 增加 XSS protection
    • add_header X-XSS-Protection "1; mode=block";
  • 啟用 傳輸性安全
    • add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
  • 關閉伺服器資訊與版本
    • server_tokens off;

Online Certificate Status Protocol (OCSP)

  • 線上憑證狀態協定
    • Good
      • 憑證合法
    • Revoked
      • 憑證過期
    • Unknown
      • 沒有憑證資訊
  • 開啟 OCSP 驗證
    • ssl_ocsp on ;

參考文章


上一篇
資安這條路 24- [Web 伺服器軟體] Apache
下一篇
資安這條路 26- [Web 伺服器軟體] IIS (Internet Information Services)
系列文
資安這條路─以自建漏洞環境學習資訊安全31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言