Vivek
Vivek

Reputation: 11

Issue while connecting to a remote postgresql server hosted on BTP

I have a postgresql instance on SAP BTP which is bound to a cloud foundry app. I want to access this instance from my local desktop using pgadmin4.

I have followed the steps mentioned in this blog and tried from cli as well following youtube video.

Still, In both the ways, I'm getting the same error:

psql: error: connection to server at "localhost" (127.0.0.1), port 2641 failed: FATAL: connection requires a valid client certificate connection to server at "localhost" (127.0.0.1), port 2641 failed: FATAL: pg_hba.conf rejects connection for host "hostname", user "username", database "dbname", no encryption

This seems like I need to provide a client certificate (ssl_cert on BTP service key) to be provided. How do I give this with psql on CLI?

I tried to give it in parameters section on pgadmin GUI, but got the same error.

I have also tried to use uri with psql to connect,

psql postgres://:@:5432/ psql: error: connection to server at "", port 5432 failed: Connection timed out (0x0000274C/10060) Is the server running on that host and accepting TCP/IP connections?

This is probably because connection to the remote host has to be done via a ssh tunnel and can't be done directly.

I also tried storing the sslcert,sslkey and sslrootcert from the service key of BTP in 3 local files .crt,.key and .crt and feeding these files as input parameters in pgAdmin, Still not working.

Error : FATAL : connection requires a valid client certificate

I'm at loss on how to proceed. Can anyone please provide some help?

Upvotes: 0

Views: 240

Answers (1)

Jay
Jay

Reputation: 19

You have to create a service key from BTP Cockpit. Click on Subscription tab, then click on the instance of your PostgreSQL. From there, click on the "Sevice Keys" tab, there is a "Create" button, click on this button. It will open a modal window with a service key that is essentially empty. But if you care it and then download it, it will generate everything you need to connect including user name, password, host name. It's all cryptic but enough info you need to setup the remote access from your PgAdmin4. Thing is, from here, it times out more often that connects so this issue may very well be the trial BTP Cockpit Foundry itself.

Upvotes: 0

Related Questions