What are alternatives for currently existing authentication scheme? #1781
-
I have users with LDAP accounts and Postgres is configured to auth. them with LDAP. Also I have usual authenticator user (for PostgREST) with md5 auth. method. LDAP users are included is some roles like "admin", "guest", etc... The frontend calls PostgREST as an authenticator user, that logs in to PostgREST with his password, then, as I understand, PostgREST does "set local role", to switch to some user "Joe". I wrote custom login stored function which logs into LDAP and returns JWT token (the function gets user name "joe" and his password), very similar to the PostgREST's documentation - But I see that if some a bad guy will steal the authenticator password, he can login under authenticator account then to do this "set local role" to "Joe", who is in "admin" group role. The problem with current authentication PostgREST scheme IMHO is that it does not log in as "joe" but as an authenticator and then it switch the role. The difference between passwords in both cases is: joe's password is in LDAP, not in my DB. But authenticator is in my DB with his password (as MD5 hash) and I should create him with his password... Is it possible to login in different way, for example, to login not as an "authenticator" but directly as "joe" ? And Postgres will authenticate "joe" via LDAP without custom function at all. Is it possible? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hey @bapcyk, Sorry, I haven't used postgrest with LDAP before. According to this so answer, couldn't you set up the |
Beta Was this translation helpful? Give feedback.
-
I think you should set up your |
Beta Was this translation helpful? Give feedback.
I think you should set up your
pg_hba.conf
, so that the authenticator user can only be logged in from the host that PostgREST is running on. So even if somebody steals the authenticator password in theory, they can't use it to login.