本卡屬 FR-169(母卡 (建卡後補 Case No)),卡 A1,批 3。只改 evidence-agent。依賴:P1。

這張卡做什麼(白話)

Agent 主控台後端:①檔案頁兩條下載與診斷包下載改呼叫一支 Agent 側 helper(讀密碼 header、查本機快取的開關、呼叫套件、寫本機稽核);②心跳 observer 收主系統帶下來的開關值寫進本機檔,離線沿用最後一份——🔴 沒收到(舊主系統沒帶、或從未連線)一律視為開啟,寫反了從未連線的新 Agent 會整台不加密;③pyproject.toml 加 jedi-file-protect。主控台的前端在 FE repo 的 console/ 資料夾,由 F3 做,本卡不碰。

reuse/extend/new

extend:core/console/files.py 兩條下載與 ops_routes.py 診斷包下載改呼叫一支 Agent 側 helper core/console/file_protect.py(讀 header、查本機快取的開關、呼叫套件、稽核;與主系統 helper 同介面但不共用程式——主系統 helper 綁 Flask-RESTful 與 EventCode);心跳 observer 照 ldap_source.py 形狀收 data.file_protect,寫 data/file_protect.json,沒帶(舊主系統)視為開啟;pyproject.toml 加 jedi-file-protect。前端在 FE repo console/,由 F3 做

在哪裡

repo:~/Projects/Billows/Audit-Manager/evidence-agent
改既有:core/console/files.py
改既有:core/console/ops_routes.py
改既有:core/console/heartbeat.py(掛 observer)
改既有:pyproject.toml
新開:core/console/file_protect.py
新開:core/file_protect_sync.py(心跳 observer+本機快取)
新開:tests/test_file_protect.py

怎麼做

驗收(首腦照這個驗)

Agent 本機:下載不帶 header 400、帶 header 回加密檔;拔主系統後重啟 Agent 仍加密(讀快取);主系統關開關→下一跳後不加密、data/file_protect.json 為 false;開回來下一跳恢復;從未連過主系統的新 Agent 預設加密;system_logs 有 AGENT_FILE_DOWNLOADED 帶 encrypted 欄且無密碼;套件 tests 綠

必讀

紀律