TMAegis
Aturan lainnya untuk postgres

TMA-POSTGRES-1.7

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

SedangLevel 1Otomatispostgres

Deskripsi

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

Cara pemeriksaan

Metode audit: Perintah shell

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

Cara perbaikan

Metode perbaikan: Panduan atau patch infrastruktur

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

Properti

Sistem operasi
Apa saja
Tag
postgresdatabasecredentials
Referensi
CIS PostgreSQL 18 Benchmark v1.0.0 - 1.7 Verify That the 'PGPASSWORD' Environment Variable is Not in Use

Periksa host ini

Jalankan ini pada mesin yang diizinkan untuk Anda audit. Pemindaian bersifat hanya baca.

shell
tmaegis scan --target postgres