MongoDB
TMA-MONGODB-7.1
Ensure appropriate key file permissions are set
Mô tả
In the Shared Cluster, the certificate or keyfile is utilized for authentications. Implementing proper file permissions on the certificate or keyfile will prevent unauthorized access to it. The benchmark rates this recommendation Manual; the automated check covers its objective pass criterion. Checks the YAML config file /etc/mongod.conf (SKIP when it does not exist). Every keyFile, PEMKeyFile, certificateKeyFile and clusterFile referenced in the config must be mode 600 or stricter (a referenced file that cannot be read also fails).
Cách kiểm tra
Phương pháp kiểm tra: Lệnh shell
[ -r /etc/mongod.conf ] || exit 1; bad=0; for f in $(awk '/^[[:space:]]*(keyFile|PEMKeyFile|certificateKeyFile|clusterFile):/ {v=$2; gsub(/["\047]/, "", v); print v}' /etc/mongod.conf); do p=$(stat -c %a "$f" 2>/dev/null) || { bad=1; continue; }; [ $((0$p & 077)) -eq 0 ] || bad=1; done; [ $bad -eq 0 ] && echo compliant || echo noncompliant- Đầu ra mong đợi
compliant
Cách khắc phục
Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng
chmod 600 <keyfile/PEM key> and chown mongodb:mongodb <keyfile/PEM key> for every key file referenced in /etc/mongod.conf.
Thuộc tính
- Hệ điều hành
- Bất kỳ
- Thẻ
- mongodbpermissionstls
- Tham chiếu
- CIS MongoDB 8 Benchmark v2.0.0 - 7.1 Ensure appropriate key file permissions are set
Kiểm tra máy này
Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.
tmaegis scan --target mongodb