Linux中MongoDB安全審計實施步驟如下:
mongod.conf
中配置security.authorization: enabled
,并重啟服務。auditLog.destination
為file
或syslog
,指定路徑(如/var/log/mongodb/auditLog.bson
)和格式(BSON
/JSON
)。auditLog.filter
指定需記錄的事件類型(如authCheck
、insert
等),可使用MongoDB查詢表達式過濾(如排除admin
庫操作)。sudo systemctl restart mongod
。chmod 750
)防止未授權訪問。關鍵參數說明:
atype
:審計事件類型(如authCheck
認證事件、insert
數據插入等)。setParameter
:可動態調整審計策略,如開啟授權成功/失敗記錄。參考來源: