TMAegis
Više pravila za postgres

TMA-POSTGRES-1.6

Verify That 'PGPASSWORD' is Not Set in Users' Profiles

SrednjaNivo 1Automatskapostgres

Opis

PostgreSQL can read a default database password from an environment variable called PGPASSWORD. Run as root; counts Bash login scripts in /home/*, /root and /etc/environment that mention PGPASSWORD (other shells need manual review).

Kako se proverava

Metod provere: Komanda ljuske

shell
[ "$(id -u)" -eq 0 ] || exit 1; n=$(grep -ls PGPASSWORD /home/*/.bashrc /home/*/.profile /home/*/.bash_profile /root/.bashrc /root/.profile /root/.bash_profile /etc/environment 2>/dev/null | wc -l); echo "$n"
Očekivani izlaz
0

Kako se ispravlja

Metod ispravke: Smernica ili zakrpa infrastrukture

Remove PGPASSWORD from the listed login scripts and use ~/.pgpass (mode 0600), a service file without passwords, or certificate/peer authentication instead.

Svojstva

Operativni sistemi
Bilo koji
Oznake
postgresdatabasecredentials
Referenca
CIS PostgreSQL 18 Benchmark v1.0.0 - 1.6 Verify That 'PGPASSWORD' is Not Set in Users' Profiles

Proverite ovaj računar

Pokrenite ovo na računaru za koji imate dozvolu za proveru. Skeniranje radi u režimu samo za čitanje.

shell
tmaegis scan --target postgres