Page MenuHomeDevCentral

Test if PostgreSQL connections for pg_hba.conf use CIDR notation
ClosedPublic

Authored by dereckson on Tue, Nov 11, 15:50.

Details

Summary

[ Context ]

PostgreSQL doesn't accept "127.0.0.1" anymore in pg_hba.conf, as
it accepts two notation, IP range or "ip-address ip-mask".

To represent the "127.0.0.1" address, two notations are valid:
"127.0.0.1/32" or "127.0.0.1 255.255.255.255".

Nasqueron configuration uses the CIDR notation format.

[ Test suite for connections ]

  • Check all mandatory keys are there
  • Check no unknown key is there (would be ignored by our template)
  • Check the ips parameter is a CIDR range (contains "/")

Reference: https://www.postgresql.org/docs/17/auth-pg-hba-conf.html

Test Plan
  • New tests pass for current configuration
  • Tests fail for "ips: 127.0.0.1"
  • Tests fail if we mess with the keys
  • DNS test still pass

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Not Applicable
Unit
Tests Not Applicable