Trouble connecting pgadmin AWS-RDS - postgresql

I've created an AWS RDS database instance and I've created a new server connection on pgAdmin. It's connecting but when I click on the database I get the below error message. What kind of things could I be doing wrong? ( I get the same error on PSQL too)
" The operation or option is not available
could not initiate GSSAPI security context: Credential for asked mech-type mech not found in the credential handle
FATAL: pg_hba.conf rejects connection for host "86.159.85.29", user "postgres", database "rdsadmin", SSL on
FATAL: pg_hba.conf rejects connection for host "86.159.85.29", user "postgres", database "rdsadmin", SSL off"

You must use SSL when authenticating via RDS IAM authentication. The message you're receiving hints at this by saying SSL off.

Related

Connection to postgresql with SSL on through a service in GCP

I am configuring a feature store called FEAST in GCP. I did all the requires steps and I can create and deploy infrastructure.
Now, I have enabled the SSL for Postgresql and I can connect to Postgres DB directly as I have created the SSL certs(client-cert.pem, client-key.pem and server-ca.pem). But, doing the exact process to generate and deploy infrastructure with the feast apply is throwing an error.
The error says ""psycopg2.OperationalError: connection to server at "xx.xxx.xx.x", port 0000 failed: FATAL: connection requires a valid client certificate
connection to server at "xx.xxx.xx.x", port 0000 failed: FATAL: pg_hba.conf rejects connection for host "xx.xxx.xx.x", user "postgres", database "postgres", SSL off ""
Any help and advice is much appreciated!!

PostgreSQL: FATAL: password authentication failed for user "postgres"

I have a ThingsBoard Professional Edition setup using AWS EC2 instance. The database is PostgreSQL-12. I tend to get the following error: FATAL: password authentication failed for user "postgres" FATAL: password authentication failed for user "postgres" when trying to log into the remote database server on pgAdmin4.
Here is a screenshot of the error shown when attempting to log in to server created on pgAdmin4.
Here is how I configured the remote database server (where Host name/address is the Public IPv4 of my EC2 instance).
In postgresql.conf, I have replaced the line listen_address='127.0.0.1' with listen_addresses='*'.
In pg_hba.conf, I added host all all 0.0.0.0/0 md5.
Here is a screenshot of my pg_hba.conf file:
I have also set the password for the user 'postgres' using the psql command #\password.
Here is what is shown in thingboard.log when I run the command:
cat /var/log/thingsboard/thingsboard.log | grep ERROR
Partial screenshot of /var/log/postgresql/postgresql-12-main.log shows the following:
I constantly have to use #ALTER USER postgres PASSWORD ‘<password>’; to be able to overcome this error but the error tends to return when I restart my local Windows machine.
That must be done by some software other than PostgreSQL.
Configure logging by setting log_statement = 'ddl' in postgresql.conf and restarting the database. Then you can more easily figure out when and by which software your password gets changed.
Additionally, configure pg_hba.conf to not allow passwordless connections from anywhere, then change the password. You may see some component start to complain - that component may be at fault.

pgbouncer: user,password per pool

I'm trying to setup a pgbouncer pool that connects to the database using a pool definition that includes a user and password.
Subsequently each client application should connect using a different user and password. The idea is that one pool is shared by multiple client users.
Is that possible?
Here's my setup:
pgbouncer.ini
[databases]
testpool = host=testpool.mycompany.com dbname=db1 port=544 user=company_dbo password=company123 max_db_connections=20
[pgbouncer]
auth_type = plain
auth_file = /etc/pgbouncer/users.txt
users.txt
"test_user" "test123"
When I try to connect I get below error
$ export PGPASSWORD='test123';psql -h localhost -U test_user -d db1 -p 5442
psql: ERROR: password authentication failed for user "test_user"
And the logs say
2019-03-03 16:04:02.668 1 LOG C-0x2022000: db1/test_user#172.17.0.1:33204 login attempt: db=db1 user=test_user tls=no
2019-03-03 16:04:02.719 1 LOG S-0x2026fd0: db1/test_user#10.1.0.118:5442 new connection to server (from 172.17.0.2:58920)
2019-03-03 16:04:02.762 1 WARNING server login failed: FATAL password authentication failed for user "test_user"
It appears that pgbouncer tries to login to the database using the client user and password, rather than the user and password specified in the [databases] section.
auth_file is used to authenticate the user with pgBouncer, not to provide a different password for use with the database. pgBouncer will use the password it received from the client to log into PostgreSQL.
I don't know what problem you are trying to solve this way, but perhaps you can use trust authentication between pgBouncer and PostgreSQL and leave the burden of authentication entirely with pgBouncer.
There is no way to “change identity” in pgBouncer.

Connecting to Google Cloud SQL PostgreSQL using Cloud Shell with SSL?

I've set up a PostgreSQL instance on Google Cloud SQL and have set it up now to only allow SSL connections. I'm able to connect from my workstation via psql and from some apps like R Studio.
However I'm trying to connect via the GCloud Shell and don't seem to see any options to connect with SSL. There are options to manage certifications and I've created another client key and downloaded the files for it in my cloud shell account, I just don't see options for using them to make a connection. Without it just tells me there isn't an HBA for a "No SSL" connection.
Here is what I see (some things obfuscated):
don#cloudshell:~ (xxx)$ gcloud sql connect foo --user=postgres
Whitelisting your IP for incoming connection for 5 minutes...done.
Connecting to database with SQL user [postgres].Password for user postgres:
psql: FATAL: connection requires a valid client certificate
FATAL: pg_hba.conf rejects connection for host "a.b.c.d", user "postgres", database "postgres", SSL off
As per Cloud SQL GCP docs:
Cloud Shell connections do not support SSL. Connections from Cloud
Shell fail if the instance is configured to accept only SSL
connections.

Heroku PostgreSQL / NodeJS connection permission denied?

So I would like to import a local dump to my heroku postgresql db, however, any command I run I just get ...
psql: could not connect to server: Permission denied (0x0000271D/10013)
Is the server running on host "ec2-23-23-192-242.compute-1.amazonaws.com" (23.23.192.242) and accepting
TCP/IP connections on port 5432?
This is using the credentials set by the heroku pg add-on, and I have triple checked them to ensure they are correct. Does anyone know why the hell it keeps giving me Permission denied? I can reset the db from the heroku CLI but I can't perform any other action... weird.
you are behind some strict firewall or just isolated from internet, I assume. Look what I get:
-bash-4.2$ psql -h ec2-23-23-192-242.compute-1.amazonaws.com
Password:
psql: FATAL: password authentication failed for user "postgres"
FATAL: no pg_hba.conf entry for host "xx.xx.xx.xx", user "postgres", database "postgres", SSL off