TMAegis
Weitere Regeln für postgres

TMA-POSTGRES-1.7

Verify That the 'PGPASSWORD' Environment Variable is Not in Use

MittelStufe 1Automatisiertpostgres

Beschreibung

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).

So wird geprüft

Prüfmethode: Shell-Befehl

shell
[ "$(id -u)" -eq 0 ] || exit 1; n=$(grep -lsaz '^PGPASSWORD=' /proc/[0-9]*/environ 2>/dev/null | wc -l); echo "$n"
Erwartete Ausgabe
0

So wird behoben

Behebungsmethode: Anleitung oder Infrastruktur-Patch

Find the processes (grep -lsaz ^PGPASSWORD= /proc/*/environ) and change the users or scripts that export PGPASSWORD to use ~/.pgpass or another secure method.

Eigenschaften

Betriebssysteme
Beliebig
Tags
postgresdatabasecredentials
Referenz
CIS PostgreSQL 18 Benchmark v1.0.0 - 1.7 Verify That the 'PGPASSWORD' Environment Variable is Not in Use

Diesen Host prüfen

Führen Sie dies auf einem Rechner aus, den Sie prüfen dürfen. Der Scan ist schreibgeschützt.

shell
tmaegis scan --target postgres