postgresqlamazon-web-servicessshamazon-auroraportforwarding

Postgres server rejected password, except when I ssh port forwarding


I'm using AWS aurora with a postgres db. I have the database sitting inside a vpc, and require to ssh into the vpc in order to connect to the database. I have two scenarios where one works and the other does not. Here are the two scenarios:

  1. The working scenario is I first I ssh into my vpc using

ssh -L 5000:dbhost:5432 jeremy@vpcip

I'm then able to use postico and connect to the db using localhost and the forwarded port of 5000.

  1. The not working scenario is I don't port forward and I configure my ssh tunnel in postico with the exact same information except the not being local and using the dbhost in the above snippet. Same user and password, same private key is being used. Except I get an error saying
The server rejected the password for the PostgreSQL user

which is not the issue, because the password is correct, i've even used different users in both scenarios to rule out that possibility.

I think the issue has to do with the port forwarding.

Any help would be appreciated.

UPDATE------------------------ Viewing the database logs I get the following:

2023-12-06 17:53:18 UTC:10.192.10.56(58824):company_api_user
company_user
company_user@companytitle_db:[29671]:FATAL:  password authentication failed for user "company_api_user
    company_user
    company_user"
2023-12-06 17:53:18 UTC:10.192.10.56(58824):company_api_user
company_user
company_user@companytitle_db:[29671]:DETAIL:  Role "company_api_user
    company_user
    company_user" does not exist.
    Connection matched pg_hba.conf line 14: "host    all             all             all            md5"
2023-12-06 17:53:19 UTC:10.192.10.56(58840):company_api_user

Solution

  • The solution for those who ever run into this issue in the future. There is a bug in postico version 1.5.21 (the one i'm using) where when you create a New Favorite connection, it does some padding of a text field. Simply create a new favorite and enter in information.