From: | Alejandro Carrillo <fasterzip(at)yahoo(dot)es> |
---|---|
To: | Lista Postgres ES <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | MFA o 2FA con Google Authenticator y pgAdmin en cluster postgreSQL |
Date: | 2025-03-06 22:01:11 |
Message-ID: | 1225589373.1680111.1741298471201@mail.yahoo.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Horacio Miranda | 2025-03-06 23:56:40 | Re: MFA o 2FA con Google Authenticator y pgAdmin en cluster postgreSQL |
Previous Message | Romero, Fernando | 2025-03-06 15:52:40 | RE: Crear un trigger en alter table. |