本卡屬 FR-166(母卡 CM-3109),批 7。repo:BE(主 repo,Repo 欄空著)。依賴 CM-3151(P3-0,BE 改吃工作坊套件),所以排第 7 批。由首腦在驗收 P0-2/P0-3/P0-6/P0-7 時發現、沒有任何卡負責的主系統接縫。
主系統 LDAP 的「首次信任釘住」目前沒有作用:套件留了存指紋的接口,主系統沒接,每次登入都當第一次見到。設定頁的「重新信任」按鈕要打的端點也不存在。另外 Agent 回報的五種主控台稽核動作、套件新的五個事件碼,主系統都還不認得;資安守衛的例外還指著舊位置。
repo:~/Projects/Billows/Audit-Manager/compliance-manager-be
改:core/plugins/identity.py(IdentityAdapters 接 ldap_trust_writer、掛重新信任路由)
新:core/plugins/_ldap_trust.py(ILdapTrustWriter 實作+重新信任 service)
新:api 層重新信任 route(照既有 route 形狀)
改:common/enum/event_code.py(鏡像 6093~6097)
改:core/plugins/_agent_console_audit.py(_ACTIONS 加五個 action)
改:test/security/code/test_security_shape_external_calls.py(CERT_NONE 白名單)
🔴 不動 core/plugins/remote_agent.py(同批 P3-6 在改)
ILdapTrustWriter:把指紋寫回系統設定 THIRD_PARTY_LOGIN 的 trusted_fingerprint/trusted_at。🔴 一定要走 update_config_by_group_key,不要走 update_system_config(那條是設定頁用的,P0-3 刻意讓它清掉表單送來的指紋)。傳進 IdentityAdapters(ldap_trust_writer=...)。POST /api/1.0/ldap/retrust,body {fingerprint}:把 trusted_fingerprint 換成這個值、trusted_at 換成現在,同樣走 update_config_by_group_key;寫稽核。權限照既有 LDAP 設定端點(/ldap/connect-test)同一組能力點,用 admin_required。前端 P0-7 已照這個契約呼叫。common/enum/event_code.py 鏡像 jedi-remote-agent common/code.py 裡 P0-6 加的 6093~6097(值以套件為準,不要自己編)。_agent_console_audit._ACTIONS 加 Agent REPORTED_ACTIONS 的五個新動作:local_login、local_scan_started、net_diag_run、restart_requested、report_exported,對到上面的事件碼。test_security_shape_external_calls.py:32 的 CERT_NONE 白名單:從 jedi_iam/.../ldap_adapter.py::LdapAdapter._get_ldap_server::CERT_NONE 改成 jedi_ldap/directory.py::LdapDirectory._get_ldap_server::CERT_NONE,理由寫「首次信任釘住,送帳密前比對指紋」。system_configs 的 THIRD_PARTY_LOGIN 有 trusted_fingerprint;換一張憑證後登入被擋(LOGIN_401017);打 /ldap/retrust 後恢復。test_security_shape_external_calls.py 綠;remote-agent 相關既有測試綠。