林博仁 Buo-ren Lin
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 網路服務維運<br>安全實務 分享我在前公司維運工程師工作的~~勸退~~相關經驗 林博仁 0w0/ (前)中信安科技維運工程師 <https://hackmd.io/@brlin/operations-security-talk-presentation> --- ## {我是誰|`$ whoami`} * (前)網路發展協會社長、講師、雜工 * (成功存活了四年才被開除的)中信安科技維運工程師 * (剛跳槽成功的)晟鑫科技軟體應用工程師 \#Ubuntu \#KDE \#Snapcraft \#L10N-TW --- ## {免責聲明|Disclaimer} 因為以下原因演說內容僅供參考: * 可能不代表典型的維運工程師工作 * 有些東西可能不符合現代的安全實務 * 有些東西可能是*夢到*、*自身經驗*或是*朋友說的*,**{與我先前的雇主不一定有關係|如有雷同,那就雷同}** --- ## {維運工程師|Operations engineer}是在做什麼工作? * 確保{服務|service}正常運行 * 確保{伺服器|server}不被入侵 * 與工程師配合開發新功能/服務與設計架構以完善服務 * {開通|Provision}與部署{開發|development}、{測試|test}與{生產|production}環境 --- ## 維運工程師會用到些什麼? --- ### 遠端管理主機的工具 * 要能夠保存多主機的連接{設定檔|profile} * 主機密碼不明文保存 相關工具與技能: * OpenSSH 客戶端 * 連線多工(ControlMaster) * [MobaXterm](https://mobaxterm.mobatek.net/download.html) * [XSHELL](https://www.netsarang.com/en/xshell/) --- ### {自動化|Automation} * 減少繁複的人工作業 * 使部署環境一致化 相關工具與技能: * (主要是 Bash 的){Shell 腳本|shell script} * Ansible/Chef/Terraform * YAML 標記語言 --- ### 調閱{運行紀錄|log} * 快速定位服務問題 * 提早發現潛在問題與最佳化細節 相關工具與技能: * 運行紀錄查詢方式: - `journalctl` - Windows 事件檢視器 * 運行紀錄分析工具:[GoAccess](https://goaccess.io/) * 中心化運行紀錄管理系統:[Graylog](https://graylog.org/)、[ELK Stack](https://aws.amazon.com/tw/what-is/elk-stack/) --- #### GoAccess ![Example GoAccess screenshot](https://hackmd.io/_uploads/rJ0Gtsi7Je.png) --- #### GoAccess (dashboard) ![Example GoAccess dashboard screenshot](https://hackmd.io/_uploads/Sy4ljsiXJe.png) --- ### 規劃服務架構 * 確保服務的{高可用|high-availability}(HA) * 讓其他維運工程師能夠快速掌握架構 相關工具與技能: * [PlantUML](https://plantuml.com/) * [Draw&period;io](https://app.diagrams.net/) --- #### PlantUML 架構圖範例 ```plantuml title Git 版控庫異地備份架構圖 frame "公司內部網路" as internal_network{ node "來源 Git 伺服器" as source_server { database "來源 Git 版控庫" as git_repository } actor "軟體開發人員" as developer actor "授權備份存取者" as backup_manager } frame "外部網路" as external_network{ node "異地備份伺服器" as remote_backup_server { database "Git 版控庫(備份)" as backup_git_repository } } developer -up-> git_repository: 提交 backup_manager -[#hidden]up-> git_repository git_repository -right-> backup_git_repository: 排程推送 backup_manager -up-> backup_git_repository: 於來源版控庫不可用時取出內容 ``` --- ### 監控服務與主機狀態 * 定期採集服務、通訊埠、儲存、網路等層面的各種監控指標數據 * 如果出現非預期的結果就發送告警讓維運人員進行應對 相關工具與技能: * [Hostmonitor](https://www.ks-soft.net/hostmon.eng/) * [ZABBIX](https://www.zabbix.com/) * [Prometheus](https://prometheus.io/) --- #### ZABBIX 主機網路延遲監控範例 ![ZABBIX 主機網路延遲監控範例](https://hackmd.io/_uploads/Hy4L93iQyl.png) --- #### Postman Web 服務回應監控範例 ![PoPostman Web 服務回應監控範例](https://hackmd.io/_uploads/Hy5DK3iXyl.png) --- ### 撰寫服務與基礎建設的維運文件 * 包含但不限於架構、服務建置流程、服務通訊{埠|ㄅㄨˋ}號、功能驗證、常用命令與檔案路徑等相關資訊 * 確保專案的永續性 相關工具與技能: * [Markdown](https://markdown.tw/) * [HackMD](https://hackmd.io/)([CodiMD](https://github.com/hackmdio/codimd)) --- ### 操作 RESTful/GraphQL API * 測試服務功能是否正常 * 調用第三方服務 API 來實作自動化功能 * Telegram 機器人 API <!--發送告警訊息到指定群組/頻道--> * GitHub/GitLab API <!--上傳並發布軟體建構產物--> 相關工具與技能: * [curl](https://curl.se/) * [Postman](https://www.postman.com/) --- ### 自{來源碼|source code}建構軟體 * 加入{預建構|pre-built}軟體沒有的功能 * 針對執行環境最佳化 * 滿足客戶的機車需求 --- ### 源碼建構的基本流程 以基於 GNU Autotools 軟體建構系統的軟體為例: 1. {產生軟體建構配置程序|autogen.sh} 2. {配置軟體建構細節|./configure} 3. {建構軟體|make} 4. {安裝軟體|make install} --- ### English * 閱讀要維護之服務的*原文*技術文件 * 看服務運行紀錄與配置檔 相關工具與技能: * Google 翻譯 * LLM 大語言模型(ChatGPT/Gemini/...) --- ### ~~用水晶球~~<br>通靈主管或客戶的意思 不解釋。 --- ## 資訊安全 同時也是你飯碗的安全 --- ### <ruby>堡壘機<rp>(</rp><rt>Bastion host</rt><rp>)</rp></ruby> * 業務服務器遠端管理服務不直接對外 * 避免密碼被窮舉爆破 * 管理並紀錄維運工程師的操作行為 --- ```plantuml actor 維運工程師 as operations_engineer node "堡壘機" as bastion_host frame "業務伺服器" as business_servers{ node "業務伺服器1" as business_server1 node "業務伺服器2" as business_server2 node "業務伺服器3" as business_server3 } operations_engineer -> bastion_host bastion_host -> business_server1 bastion_host -> business_server2 bastion_host -> business_server3 bastion_host .[#hidden]right. business_servers business_server1 .[#hidden]down. business_server2 business_server2 .[#hidden]down. business_server3 ``` --- ### {虛擬私人網路|Virtual Private Network}(VPN) ```plantuml actor "維運工程師" as operations_engineer actor "一般大眾" as general_public node "VPN 伺服器" as vpn_server node "業務伺服器" as business_server{ component "對外服務" as public_facing_service component "非對外服務\n(如後台與遠端管理)" as non_public_facing_service } general_public -> public_facing_service: 訪問 operations_engineer -down-> vpn_server: 連接 vpn_server -left-> non_public_facing_service: 連接 operations_engineer .left.> non_public_facing_service: 訪問 ``` --- ## 監控<br>Monitoring --- ### 要監控什麼? * 服務可用性 * 伺服器資源使用量 * 雲平台費用 * ... --- ![图片](https://hackmd.io/_uploads/BJOMEP2X1x.png) --- ![图片](https://hackmd.io/_uploads/H1z44wnQyx.png) --- ![图片](https://hackmd.io/_uploads/S10SND2QJx.png) --- ![china-gfw-like-datacenter-blocking.sanitized](https://hackmd.io/_uploads/Bk3oVv27Jg.png) --- ![图片](https://hackmd.io/_uploads/Hk464vhX1x.png) --- ![图片](https://hackmd.io/_uploads/HyNT8Dh7yx.png) --- ### 案例:堡壘機中毒 * 某同事所使用的堡壘機於凌晨五點時大量登入業務伺服器 * 應對方式:Ansible 全業務主機批量取消防火牆白名單 --- ### 案例:VPS 機房新開通伺服器被埋木馬 * 新開通的伺服器每十五分鐘跟一個可疑的 IP 地址建立連線 * PAM 程式庫被調包 * 跟乾淨系統比對全系統檔案的指紋 --- ### 案例:VPS 機房主機被人為重開機之後埋木馬 * 凌晨 3~5 點某業務服務器突然被重開機 * 檔案異動告警被觸發,服務啟動腳本被插命令啟動 DDoS agent * IPMI/BMC --- ![图片](https://hackmd.io/_uploads/ByKrEOnXJg.png) --- ![图片](https://hackmd.io/_uploads/rJuGE_hQ1g.png) --- ![图片](https://hackmd.io/_uploads/HyLgBd2Xye.png) --- 1. 機房透過 IPMI 重啟伺服器 1. 使用開機碟開機獲得系統權限 1. 安裝惡意程式 1. 重開回受害系統 --- ![图片](https://hackmd.io/_uploads/Hkz6rOn7ye.png) --- ## 勸退 為何當一個維運工程師可能不是個好出路? --- ### 有 <ruby>輪值<rp>(</rp><rt>on-call</rt><rp>)</rp></ruby> * 要當輪班星人在下班/假日期間應對告警 * 手機不能離身,筆電也在在附近 * 手放在~~方向盤~~鍵盤上才叫做加班 ※依各公司政策不同 --- ### 有補休 / 加班費? * 都說可以申請加班費,但是沒人不讀空氣真的去申請 * 補休價值觀爭議:加班加深夜/假日,補休補平日 ※依各公司政策不同 --- ### (待遇)有落差 * 正規行業→待遇普通(?) * 待遇好的→高機率{賭博|博奕、博彩、波菜}行業 ※依各公司政策不同 --- ### 如何識別可能涉及賭博的公司 * 出差會到包含但不限於下列國家: * 菲律賓 * 柬埔寨 * 杜拜 * 出差前需要跟公司申請離職(???)然後在當地入職另一間不同名字的公司 * 薪資透過加密貨幣支付 ※友人經驗轉述,僅供參考 --- ## 沒惹 | 本簡報 | 更多資訊 | | :-: | :-: | | ![簡報網址的 QR 二維條碼圖片](https://hackmd.io/_uploads/Hk0Ygv27yg.png "簡報網址的 QR 二維條碼" =300x300) | ![script-qrcode](https://hackmd.io/_uploads/ByBW-v2QJx.png =300x300) | <style> /* 調大旁註文字的字元大小 */ rt{ font-size: 15pt; } /* 不限制代碼區塊的高度 */ .reveal pre code{ max-height: 100%; } /* 迴避清單的排版美觀問題 */ .reveal .slides{ text-align: left; } .reveal .slides > img{ margin-left: auto; margin-right: auto; text-align: center; } :root{ --r-block-margin: 10px; --r-heading-margin: 0 0 15px 0; } </style> <!-- --- ## 案例:雲平台 API key 被冒用 --- ## 案例: --- ![图片](https://hackmd.io/_uploads/BJEn4_hXyx.png) -->

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully