From: | Alejandro Carrillo <fasterzip(at)yahoo(dot)es> |
---|---|
To: | Horacio Miranda <hmiranda(at)gmail(dot)com> |
Cc: | Lista Postgres ES <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Re: MFA o 2FA con Google Authenticator y pgAdmin en cluster postgreSQL |
Date: | 2025-03-07 01:33:54 |
Message-ID: | 970675595.1716621.1741311234109@mail.yahoo.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Hola compañero.
Desafortunadamente no encuentro esas extensiones o como instalarlas, que menciona el artículo.
Agradezco me puedan apoyar.
En jueves, 6 de marzo de 2025, 18:57:04 GMT-5, Horacio Miranda <hmiranda(at)gmail(dot)com> escribió:
Google me dice esto. Puede que tengas que Implementar un plug-in.
To implement OTP (One-Time Password) for Google Cloud SQL PostgreSQL instances, you can use built-in authentication with username and password or IAM database authentication, and potentially integrate a 2FA solution like pg_otp or pg_ident with OTP
|
| OTP google postgresql google.com | |
|
On 7 Mar 2025, at 11:01 AM, Alejandro Carrillo <fasterzip(at)yahoo(dot)es> wrote:
Cordial saludo compañeros.
Por favor alguien sabe si ha logrado usar Google Authenticator para generar OTP (One Time Password), y que esa clave de un solo uso se pueda utilizar en PgAdmin?
He logrado conectarme con ella usando PAM en psql, activando en el pg_hba.conf así:
# Permitir conexiones remotas usando PAM (OTP)host all all 0.0.0.0/0 pamhost all all ::/0 pam
Así me conecto exitosamente:
psql -h 192.168.1.100 -p 5432 -U postgres -d postgres
Cuando me conecto desde PgAdmin, me pide el código de Google Authenticator y me deja conectar exitosamente. Pero cuando abro una ventana de SQL, me genera error de PAM:
connection failed: connection to server at "11.0.0.13", port 5432 failed: FATAL: la autentificación PAM falló para el usuario «postgres»connection to server at "11.0.0.13", port 5432 failed: FATAL: la autentificación PAM falló para el usuario «postgres»
Si miro los logs de /var/log/auth.log me encuentro con que reintenta utilizar el mismo código para volverse a loguear, lo cual demuestra que está tratando de reconectarse:
Mar 6 16:54:46 MiPC postgresql(pam_google_authenticator)[5743]: Accepted google_authenticator for postgresMar 6 16:54:53 MiPC postgresql(pam_google_authenticator)[5769]: Trying to reuse a previously used time-based code. ("/var/lib/postgresql/.google_authenticator")Retry again in 30 seconds. Warning! This might mean, you are currently subject to a man-in-the-middle attack.Mar 6 16:54:53 MiPC postgresql(pam_google_authenticator)[5769]: Invalid verification code for postgresMar 6 16:54:53 MiPC postgresql(pam_google_authenticator)[5770]: Trying to reuse a previously used time-based code. ("/var/lib/postgresql/.google_authenticator")Retry again in 30 seconds. Warning! This might mean, you are currently subject to a man-in-the-middle attack.Mar 6 16:54:53 MiPC postgresql(pam_google_authenticator)[5770]: Invalid verification code for postgres
Por consiguiente, me gustaría que solo se conectara una vez desde pgAdmin y reutilizase la conexión para todo lo que necesita.
Intenté con pgBouncer pero no funcionó.
Agradezco su colaboración con este tema.
Attachment | Content-Type | Size |
---|---|---|
![]() |
image/png | 4.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Enrique Herrera Noya | 2025-03-10 16:27:54 | Re: Autenticación TSL |
Previous Message | Horacio Miranda | 2025-03-06 23:56:40 | Re: MFA o 2FA con Google Authenticator y pgAdmin en cluster postgreSQL |