0

I have a local psql server configured to use ldap for all but postgres accounts. But ldap isn't used on local where psql has no problem with the role, and fails to find the role using host, where ldap is used.

Is the role not found because of a pg_hba.conf problem or an issue with granting extra permissions? Something else?

socket

psql lncddb useraccnt 
# psql (11.2 (Debian 11.2-2), server 10.4 (Debian 10.4-2))
# login without password prompt, 'useraccnt' is also system account (in /etc/passwd)

local

psql -h localhost lncddb useraccnt 
# Password for user useraccnt: fake

remote

psql -h 10.145.64.121 lncddb useraccnt -p 5433
# Password for user useraccnt: ldappass

psql: FATAL: role "useraccnt" does not exist

or if wrong password is given

psql: FATAL: LDAP authentication failed for user "useraccnt"

FATAL: LDAP authentication failed for user "useraccnt"


pg_hba

# postgres is special
local   all             postgres                           peer
host    all             postgres   0.0.0.0/0               md5
# everyone else should go through ldap
local   all             all                                     ldap ldapserver=a.b.net ldapsuffix="@place.edu"  ldapport=389
host    all             all             0.0.0.0/0               ldap ldapserver=a.b.net ldapsuffix="@place.edu"  ldapport=389
host    all             all             ::1/128                 ldap ldapserver=a.b.net ldapsuffix="@place.edu"  ldapport=389

foranw created like

create role useraccnt with LOGIN REPLICATION password 'fake';
GRANT ALL PRIVILEGES ON DATABASE lncddb TO useraccnt;

the roles for lncddb are

 psql lncddb postgres -c '\l lncddb'
                                List of databases
  Name  |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
--------+----------+----------+-------------+-------------+-----------------------
 lncddb | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres         +
        |          |          |             |             | postgres=CTc/postgres+
        |          |          |             |             | useraccnt=CTc/postgres
(1 row)
0

specify ports and the psql header (psql (11.2 (Debian 11.2-2), server 10.4 (Debian 10.4-2))) should have tipped me off. I'm was configuring the wrong server.

systemctl |grep postgres
  postgresql.service            loaded active     exited    PostgreSQL RDBMS                                                                                   
  postgresql@10-main.service    loaded active     running   PostgreSQL Cluster 10-main                                                                         
  postgresql@11-main.service    loaded active     running   PostgreSQL Cluster 11-main                                                                         
  system-postgresql.slice       loaded active     active    system-postgresql.slice
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.