Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNa7q-0004Za-SN for pgsql-performance@arkaria.postgresql.org; Wed, 30 Sep 2020 11:18:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNa7K-0005LA-Fm for pgsql-performance@arkaria.postgresql.org; Wed, 30 Sep 2020 11:17:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNa7K-0005L3-7e for pgsql-performance@lists.postgresql.org; Wed, 30 Sep 2020 11:17:50 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kNa7D-0004w9-KA for pgsql-performance@lists.postgresql.org; Wed, 30 Sep 2020 11:17:49 +0000 Received: by mail-pf1-x441.google.com with SMTP id b124so939903pfg.13 for ; Wed, 30 Sep 2020 04:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=4dRJQACDhi3UAOlY4IG0V/r0joHzAEd8YuLxw22GhCM=; b=TV9+CU1x18cJvz9rORhj0tCpURE/rBxP9AGGc0daxJvn1HyRhe7NS4JSPkBwa5VtM6 t5hkWBw9LJwQ0IdKUDYA0ZSsDOXdTE7F33291Ef3V7FMgL376eczIveQ1/S//jZkle4S YxkvW0PJqTH4CgiRWrF1XiYUcROsOHfELnuIatZhqid3cUfApAVgVU48DR/dSfuwvt9+ m/ihNWXbIhg3RKxVAKDjodG8vd6miy+0LevC9jbweTkxa3VHBJSegGnVDGskqOXs9yT1 K8tOA6nGl518lAze/BRP1ckJ+1wL2u2svowRaxPGPEcln9UFSPYKD+D6G8nstN0BEAlp MRww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=4dRJQACDhi3UAOlY4IG0V/r0joHzAEd8YuLxw22GhCM=; b=TS2NFItZlu1o6vJQ+1fwLpkgXysdCyqSEUzg0URaCTG+s4FfzCPode8UcBknUDUOab X7A14wWfnfskHWGffooqKWs1SvITxVASBGQMKC8vsHtWvqjOEedR6qgZEdr67T2lcZMQ WETSJBIvQQ4XtXpPTdiDYyomJTqnKR4MHjR/HRyREaxxNfN9JVDuSTUzGKz09mJFEDnm xCwvyxP1JoB5zDpEWvqevJjzvLRzFj1rmfPlpd/CFiibYXLxouB9Te2sHDQUxLXCq01u hPAy7zMKNNI2nTwmkRiq/YDWpCyXlIUhIECNozF4AAsiKFiQeGlI4ERnaYJ7uGYGkc+p dMqg== X-Gm-Message-State: AOAM530mEC4w1SKjSfKQmdMNBOd5lCRy6sChq0KTb+MZyIPzWaUu5sa6 VsqvTneBI/NVeCDA3GqAIKQ= X-Google-Smtp-Source: ABdhPJwMmoOcvSgcXxAIU/tPkR4bABf4mY6X05uSKMlBp0x4U9QIzBOAAijIQZbatnlHGyHz/U7XCg== X-Received: by 2002:a63:fa45:: with SMTP id g5mr1725176pgk.448.1601464661691; Wed, 30 Sep 2020 04:17:41 -0700 (PDT) Received: from 192-168-1-114.tpgi.com.au ([203.63.94.51]) by smtp.gmail.com with ESMTPSA id u71sm2237355pfc.43.2020.09.30.04.17.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2020 04:17:41 -0700 (PDT) From: Hannah Huang Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_C07D0528-4466-4F90-9828-F6B956B4E757" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: SSL connection getting rejected on AWS RDS Date: Wed, 30 Sep 2020 21:17:37 +1000 In-Reply-To: Cc: pgsql-performance@lists.postgresql.org To: aditya desai References: X-Mailer: Apple Mail (2.3608.120.23.2.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_C07D0528-4466-4F90-9828-F6B956B4E757 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 30 Sep 2020, at 5:19 pm, aditya desai wrote: >=20 > Hi, > We have AWS RDS and we are trying to connect to DB remotely from EC2 = instance.as client connection using psql. We are = trying to set up IAM roles. We did all the necessary settings but got = below error. Could you please advise? >=20 > Password for user lmp_cloud_dev: > psql: FATAL: PAM authentication failed for user "testuser" > FATAL: pg_hba.conf rejects connection for host "192.168.1.xxx", user = "testuser", database "testdb", SSL off >=20 > Regards, > Aditya. >=20 Hi Aditya, See the below example of me connecting to RDS from an EC2 instance: You need to change the $RDSHOST value you need to replace my =E2=80=9Capp_user=E2=80=9D to your =E2=80=9Ctestuse= r=E2=80=9D and database =E2=80=9Cpostgres=E2=80=9D to your =E2=80=9Ctestdb= =E2=80=9D [ec2-user@ip-172-31-13-121 ~]$ export = RDSHOST=3D"mypg.cfvvs1nh3f7i.ap-southeast-2.rds.amazonaws.com" [ec2-user@ip-172-31-13-121 ~]$ export PGPASSWORD=3D"$(aws rds = generate-db-auth-token \ --hostname $RDSHOST \ --port 5432 \ --username app_user)=E2=80=9D [ec2-user@ip-172-31-13-121 ~]$ psql "host=3D$RDSHOST port=3D5432 = sslmode=3Drequire dbname=3Dpostgres user=3D app_user" psql (11.5, server 12.3) WARNING: psql major version 11, server major version 12. Some psql features might not work. SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, = bits: 256, compression: off) Type "help" for help. postgres=3D> Thanks, Hannah= --Apple-Mail=_C07D0528-4466-4F90-9828-F6B956B4E757 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 30 Sep 2020, at 5:19 pm, aditya desai <admad123@gmail.com> = wrote:

Hi,
We have AWS RDS and we are trying to connect to DB remotely = from EC2 instance.as = client connection using psql. We are trying to set up IAM roles. We did = all the necessary settings but got below error. Could you please = advise?

Password for user lmp_cloud_dev:

psql: FATAL:  PAM authentication failed for = user "testuser"

FATAL:  pg_hba.conf rejects connection for = host "192.168.1.xxx", user "testuser", database "testdb", SSL off


Regards,

Aditya.



Hi Aditya,

See the below example of me connecting to RDS from an = EC2 instance:

You = need to change the $RDSHOST value
you need to = replace my =E2=80=9Capp_user=E2=80=9D to your =E2=80=9Ctestuser=E2=80=9D = and database =E2=80=9Cpostgres=E2=80=9D to your =E2=80=9Ctestdb=E2=80=9D
[ec2-user@ip-172-31-13-121 ~]$ export = RDSHOST=3D"mypg.cfvvs1nh3f7i.ap-southeast-2.rds.amazonaws.com"

[ec2-user@ip-172-31-13-121 ~]$ export = PGPASSWORD=3D"$(aws rds generate-db-auth-token \
--hostname $RDSHOST \
--port 5432 = \
--username app_user)=E2=80=9D

[ec2-user@ip-172-31-13-121 ~]$ psql "host=3D$RDSHOST = port=3D5432 sslmode=3Drequire dbname=3Dpostgres user=3D = app_user"

psql = (11.5, server 12.3)
WARNING: psql major version 11, = server major version 12.
Some psql features might = not work.
SSL connection (protocol: TLSv1.2, = cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: = off)
Type "help" for help.
postgres=3D>

Thanks,
Hannah
= --Apple-Mail=_C07D0528-4466-4F90-9828-F6B956B4E757--