TMA-POSTGRES-1.7
Verify That the 'PGPASSWORD' Environment Variable is Not in Use
MoyenneNiveau 1Automatiséepostgres
Description
PostgreSQL can read a default database password from an environment variable called PGPASSWORD. Run as root; counts processes whose environment contains PGPASSWORD (including the scanner itself if it was given PGPASSWORD).
Méthode de vérification
Méthode d'audit: Commande shell
shell
[ "$(id -u)" -eq 0 ] || exit 1; n=$(grep -lsaz '^PGPASSWORD=' /proc/[0-9]*/environ 2>/dev/null | wc -l); echo "$n"- Sortie attendue
0
Méthode de correction
Méthode de correction: Recommandation ou correctif d'infrastructure
Find the processes (grep -lsaz ^PGPASSWORD= /proc/*/environ) and change the users or scripts that export PGPASSWORD to use ~/.pgpass or another secure method.
Propriétés
- Systèmes d'exploitation
- Tous
- Étiquettes
- postgresdatabasecredentials
- Référence
- CIS PostgreSQL 18 Benchmark v1.0.0 - 1.7 Verify That the 'PGPASSWORD' Environment Variable is Not in Use
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 postgres