Unable to connect to PostgreSQL database via SIA
Symptom
When connecting to an On-prem PostgreSQL database, the below error is show in the session diagnostics log
------------------------------------------
Failed to grant ephemeral access, Access has not been granted to PostgreSQL, reason: DPA_EPHEMERAL_ACCESS_FAILED_TO_CONNI Failed to connect to the database or database refused the connection, please contact your system administrator. [The database could not be connected to using the strong account
---------------------------
Environment
14.0;14.2 Secure Infrastructure Access (formerly DPA) DPA for Databases
SIA for database
Cause
TLS/SSL is not configured for the database and it needs to be setup . If you’re using a managed database service (e.g., AWS RDS, Azure Database for PostgreSQL, Google Cloud SQL), TLS/SSL is typically enforced automatically.
Resolution
1) Enable TLS on the PostgreSQL server : If you’re running PostgreSQL on your own server (not a managed service like RDS), you’ll need to enable TLS/SSL in postgresql.conf and configure certificates.
Example below:
Open the postgresql.conf and ensure the following settings are present
ssl = on
ssl_cert_file = 'server.crt' # or your certificate file name/path
ssl_key_file = 'server.key' # or your key file name/path
Ensure you Move or copy the server.crt and server.key into your PostgreSQL data folder (C:\Program Files\PostgreSQL\14\data)
You'll also need to ensure you enforce SSL in the pg_hba.conf e.g: add hostssl all all 0.0.0.0/0 scram-sha-256 (Security Note: Using 0.0.0.0/0 allows anyone on the internet to attempt to connect. A more secure approach is to replace it with your specific IP range (e.g. 192.168.1.0/24).
Restart the postgresql service and restest the connection.