Skip to main content

Connecting PostgreSQL

Connect a PostgreSQL database to FreshGuard for monitoring.

PostgreSQL requires a Professional plan or higher. Professional+

Connection Fields

When adding a PostgreSQL source, provide the following:

FieldDescriptionExample
HostHostname or IP addressdb.example.com
PortPostgreSQL port (default 5432)5432
DatabaseDatabase nameanalytics
UsernameDatabase userfreshguard_readonly
PasswordUser password
SSL ModeSSL connection moderequire

SSL Modes

FreshGuard supports all standard PostgreSQL SSL modes:

  • disable — No SSL (not recommended for production).
  • require — Require SSL but don’t verify the server certificate.
  • verify-ca — Require SSL and verify the server certificate against a CA.
  • verify-full — Require SSL and verify both the certificate and the hostname.

Warning

Always use require or stricter for production databases. The disable mode sends credentials in plaintext.

Connection String

As an alternative to filling in individual fields, you can paste a full connection string:

postgresql://freshguard_readonly:password@db.example.com:5432/analytics?sslmode=require

FreshGuard will parse the string and populate the fields automatically.

Common Issues

Connection Timeout

If the test connection hangs or times out:

  • Verify your database is accessible from the internet (or from FreshGuard’s outgoing IPs — find them in Settings → Network).
  • Check firewall rules and security groups to allow inbound connections on your PostgreSQL port.
  • If your database is in a private network, consider setting up a bastion host or VPN.

Authentication Failed

  • Confirm the username and password are correct.
  • Ensure the user exists and has CONNECT permission on the target database.
  • Check pg_hba.conf allows connections from external hosts.

SSL Required

If you see “SSL connection required” errors, set the SSL Mode to require or higher.

For the most secure configuration, create a dedicated read-only role. See the PostgreSQL: Read-Only Role guide for the exact SQL commands.