架站指引 - ntouind/ind.ntou.edu.tw GitHub Wiki

  1. 安裝 Ubuntu 16.04 伺服器版,安裝 SSH 伺服器
    • Netboot 安裝方式:(tasksel) Basic Ubuntu Server, SSH Server
  2. 安裝 Git 版本控制系統
  3. 安裝 etckeeper,管理設定檔版本
  4. 修正以 sudo 執行的命令預設會保留呼叫者的 HOME 環境變數的問題(Launchpad Bug #1373495)
  5. sudo - 允許 sudoedit 命令編輯 symbolic link · ntouind/sites.ind.ntou.edu.tw-etckeeper@659c56f
  6. 安裝 Fail2ban,保護 SSH 服務免於密碼窮舉攻擊
    1. Fail2ban - 啟用 ssh-ddos 監獄 · ntouind/sites.ind.ntou.edu.tw-etckeeper@bc5b8ca
  7. 套用資安政策
    1. 設定自動安裝資訊安全修正更新
    2. APT 軟體包管理系統 - 預設自動安裝所有軟體更新,不只是資訊安全更新而已 · ntouind/ind.ntou.edu.tw-etckeeper@dc165e1
    3. cron - # 遵從海洋大學網路發展協會安全伺服器規定,每日凌晨4點進行系統重新啟動作業 · ntouind/ind.ntou.edu.tw-etckeeper@5ffbfe0
  8. 安裝常用軟體 htop、manpages-zh、colortail
  9. 安裝與設定 Apache Web 伺服器
    1. Fail2ban - 啟用 Apache Web 伺服器監牢(?) · ntouind/sites.ind.ntou.edu.tw-etckeeper@b1aead4
    2. Apache - 將 Ubuntu 提供的預設首頁(/var/www/html/index.html)改名為 index.ubuntu_original.html
    3. Apache - 設定 ServerName
      • 編輯 /etc/apache2/sites-enabled/000-default.conf
    4. Apache - 禁止在沒有索引頁面時列出目錄下的檔案(有必要禁止嗎?)
    5. Apache - 設定 localized-error-pages
    6. Apache - 安裝 ModSecurity
      1. 啟用 CRS
      2. Apache - Security by Obscurity - 使用自定義 ServerSignature,增加駭客妹妹的攻擊難度 · ntouind/ind.ntou.edu.tw-etckeeper@8de440b
  10. 拓製(clone)本版本倉庫到本地端 /var/www
    • 設定讓 web-admin 群組使用者都能讀寫該版本倉庫
      • 版本倉庫目錄及其子目錄設定 SGID
      • 設定 core.sharedrepository = 1 Git 設定
  11. 停用預設網站,新增新 Apache 網站其文件根目錄指向本版控倉庫的「網站根目錄」目錄中
  12. 使用者管理 - 新增可自由編輯網站內容的 web-admin 使用者群組 · ntouind/sites.ind.ntou.edu.tw-etckeeper@2fcd246
  13. 設定 GitHub WebHook
    1. sudo: 讓 Web 伺服器能以 web-admin 群組身份執行 GitHub Webhook · ntouind/sites.ind.ntou.edu.tw-etckeeper@5015f41
1. 安裝 Z Shell 並[設定為使用者預設殼程式](https://github.com/ntouind/ind.ntou.edu.tw-etckeeper/commit/87fb68a1f9867ed5c395416906183d6a55d243cc)
1. 安裝 MySQL 資料庫服務跟 PHP 跟 PHPmyAdmin
    * 修正 [Ubuntu 14.04 中 phpmyadmin 抱怨「缺少 mcrypt 擴充套件。請檢查 PHP 設定。」的問題](https://bugs.launchpad.net/ubuntu/+source/phpmyadmin/+bug/1443384)
1. 安裝 [Webmin 系統管理工具](http://www.webmin.com/)與[Usermin 一般使用者管理工具](http://www.webmin.com/usermin.html)
    * [APT - 安裝 Webmin 官方軟體來源](https://github.com/ntouind/ind.ntou.edu.tw-etckeeper/commit/62337e875012cb88083fa71cf8d05270f7f565dd)
    * [安裝 Webmin](https://github.com/ntouind/ind.ntou.edu.tw-etckeeper/commit/eb9bcc5c726372639c0bac8d5a36e39cd87c1d34)
    * [Webmin - 預設不追蹤所有 /etc/webmin 底下的檔案,避免追蹤到無價值資料](https://github.com/ntouind/ind.ntou.edu.tw-etckeeper/commit/88116ccb9a9296043a51c53783f538ef58237e9d)
    * [Webmin - 開機不啟動服務,減少被入侵風險](https://github.com/ntouind/ind.ntou.edu.tw-etckeeper/commit/2dd7ae38b70fc858a105687d9bbac9213720e1ac)
        * [Webmin - 開機預設啟動服務,減少入侵風險(修正過去無效修正) · ntouind/ind.ntou.edu.tw-etckeeper@84b648b](https://github.com/ntouind/ind.ntou.edu.tw-etckeeper/commit/84b648b42c096586eb28832e63688913c4656308)
    * [Usermin - 開機不啟動服務,減少被入侵風險](https://github.com/ntouind/ind.ntou.edu.tw-etckeeper/commit/2dd6a1a8a6c39599f9747f8bc8d52176c5074f10)