TMAegis
Plus de règles pour mongodb

TMA-MONGODB-7.2

Ensure appropriate database file permissions are set

ÉlevéeNiveau 1Automatiséemongodb

Description

MongoDB database files need to be protected using file permissions. 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). storage.dbPath (default /var/lib/mongodb) must be 770 or stricter, with no access for other users.

Méthode de vérification

Méthode d'audit: Commande shell

shell
[ -r /etc/mongod.conf ] || exit 1; d=$(awk '/^[[:space:]]*dbPath:/ {v=$2; gsub(/["\047]/, "", v); print v}' /etc/mongod.conf); d=${d:-/var/lib/mongodb}; p=$(stat -c %a "$d" 2>/dev/null) || exit 1; if [ $((0$p & 007)) -eq 0 ]; then echo compliant; else echo "mode $p"; fi
Sortie attendue
compliant

Méthode de correction

Méthode de correction: Recommandation ou correctif d'infrastructure

chmod 770 <dbPath> and chown mongodb:mongodb <dbPath> (default /var/lib/mongodb).

Propriétés

Systèmes d'exploitation
Tous
Étiquettes
mongodbpermissions
Référence
CIS MongoDB 8 Benchmark v2.0.0 - 7.2 Ensure appropriate database file permissions are set

Vérifier cet hôte

Exécutez cette commande sur une machine que vous êtes autorisé à auditer. L'analyse est en lecture seule.

shell
tmaegis scan --target mongodb