查询mongodb是否开启安全审计、查看审计日志、查看密码复杂度策略、查看口令长度、查看口令更换周期和登陆失败策略的数据库指令是什么?
时间: 2023-09-30 18:12:18 浏览: 126
mongodb数据库的6个安全设置命令
查询 MongoDB 是否开启安全审计:
```
db.getMongo().getDB("admin").runCommand({getParameter: 1, auditAuthorizationSuccess: 1, auditAuthorizationFailure: 1, auditAuthenticationSuccess: 1, auditAuthenticationFailure: 1})
```
查看审计日志:
```
db.getSiblingDB("admin").getCollection("system.auditLog").find()
```
查看密码复杂度策略:
```
db.getSiblingDB("admin").runCommand({getParameters: 1, showPasswordRules: true})
```
查看口令长度:
```
db.getSiblingDB("admin").runCommand({getParameters: 1}).security.passwordValidator
```
查看口令更换周期:
```
db.getSiblingDB("admin").runCommand({getParameters: 1}).security.authenticationRestrictions
```
查看登录失败策略:
```
db.getSiblingDB("admin").runCommand({getParameters: 1}).security.authorizationFailuresLog
```
阅读全文