jakob / jakob/Postico

Pre-connect shell script not working with AWS RDS through Proxy RDS

Open
#875 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
485
Forks
8
PR merge metrics
No merged PRs in 30d

Description

## What did you do?

- I setup an AWS RDS database with an RDS Proxy
- I setup an SSH tunnel to reach the RDS Proxy to access the database
- I can connect with the `psql` CLI
- I created in Postico 2.1 a server configuration to reach my AWS RDS database through an RDS Proxy through an SSH tunnel with a pre-connect shell script
- **Unfortunately, the connection fails**
- I removed the RDS proxy,
- I can connect with the `psql` CLI
- I can connect with Postico

## What did you expect to happen?

- I expected to be able to connect through Postico onto the Proxy RDS

## What actually happened?

- I can see a loop with the following labels in the top bar during the connection :
- Negociating SSL
- Establishing SSH tunnel
- Executing password shell command
- Finally, I get this error message : `The server rejected the password provided by the pre-connect shell script.`
- However, the same script works for the same database if I remove the proxy
- I can connect to the database using `psql` CLI with the `sslmode=require` parameter

## What software versions are you using?

- Postico version: Version 2.1 (9682)
- macOS version: 14.4.1 (23E224)
- PostgreSQL version: `PostgreSQL 14.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-12), 64-bit`

Postico server JSON configuration:
```json
{
"connection" : {
"postgres" : {
"database" : "bopgdb",
"host" : "my-rds-proxy.proxy-id.eu-west-1.rds.amazonaws.com",
"port" : 5432,
"preconnectScript" : {
"enabled" : true,
"source" : "export PGPASSWORD=\"$(aws rds generate-db-auth-token --hostname my-rds-proxy.proxy-id.eu-west-1.rds.amazonaws.com --port 5432 --region eu-west-1 --username myuser --profile myprofile)\"\n\necho $PGPASSWORD"
},
"user" : "myuser"
},
"ssh" : {
"enabled" : true,
"host" : "1.2.3.4",
"port" : 22,
"privateKey" : {
"data" : "xxx",
"type" : "bookmark"
},
"user" : "my-ec2-bastion-user"
}
},
"displayName" : "RDS through Proxy RDS",
"startupQuery" : {
"enabled" : false
},
"type" : "server",
"uuid" : "1326EB50-2A12-4D6F-801A-6DB21ED7A4A6",
"version" : 2
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Postico 2.1 server configuration with the SSH tunnel, RDS Proxy endpoint, and pre-connect shell script, then compare it with the working psql command using sslmode=require. Trace the pre-connect password-shell and SSH-tunnel stages shown in the connection loop. Done means the same generated authentication token is accepted through the RDS Proxy.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, postgresql
Domain
cloud, databases, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.