TMA-MONGODB-3.3
Ensure that MongoDB is run using a non-privileged, dedicated service account
ÉlevéeNiveau 1Automatiséemongodb
Description
The MongoDB service should not be run using a privileged account such as 'root' because this unnecessarily exposes the operating system to high risk. The benchmark rates this recommendation Manual; the automated check covers its objective pass criterion. Passes when every running mongod/mongos process runs as a non-root account (FAIL when none are running).
Méthode de vérification
Méthode d'audit: Commande shell
shell
out=$(ps -eo user=,comm= 2>/dev/null) || exit 1; printf '%s\n' "$out" | awk '$2 == "mongod" || $2 == "mongos" {n++; if ($1 == "root") r++} END {if (n == 0) print "not running"; else if (r > 0) print "root"; else print "compliant"}'- Sortie attendue
compliant
Méthode de correction
Méthode de correction: Recommandation ou correctif d'infrastructure
Create a dedicated mongodb system account, make the data, keyfile and TLS key files readable only by it, set User=mongodb in the service unit and restart mongod.
Propriétés
- Systèmes d'exploitation
- Tous
- Étiquettes
- mongodbservice-account
- Référence
- CIS MongoDB 8 Benchmark v2.0.0 - 3.3 Ensure that MongoDB is run using a non-privileged, dedicated service account
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