以下是CentOS下MongoDB的安全防護措施:
/etc/mongod.conf
中設置security.authorization: enabled
,并創建管理員用戶(如userAdminAnyDatabase
角色),強制用戶認證。readWrite
、read
),通過db.createRole()
和db.grantRolesToUser()
管理。/etc/mongod.conf
中配置net.ssl.mode: requireSSL
及證書路徑,強制加密傳輸。--ssl --sslCAFile
)。/etc/mongod.conf
中通過bindIp
限制監聽IP(如僅允許本地或特定服務器IP)。firewalld
/iptables
)限制端口(默認27017)訪問。security.auditLog.destination: file
),定期審查異常行為。net.http.enabled: false
)。參考來源: