以下是在Debian上對MongoDB進行安全審計的方法:
/etc/mongod.conf
中配置auditLog
參數,設置日志輸出路徑、格式及過濾條件,如security: auditLog: destination: file format: JSON path: /var/log/mongodb/audit.json
,重啟服務生效。grep
、awk
等工具定期分析審計日志,或通過監控工具(如Nagios、Zabbix)實時監控異常操作。bindIp
配置是否限制為受信任IP,避免暴露在公網。ufw
、iptables
)限制對MongoDB端口的訪問,僅允許可信IP連接。security.authorization: enabled
),并定期審查用戶權限,刪除冗余賬戶。apt update && apt upgrade
命令操作。