{"action":"created","issue":{"url":"https://api.github.com/repos/dpgaspar/Flask-AppBuilder/issues/189","labels_url":"https://api.github.com/repos/dpgaspar/Flask-AppBuilder/issues/189/labels{/name}","comments_url":"https://api.github.com/repos/dpgaspar/Flask-AppBuilder/issues/189/comments","events_url":"https://api.github.com/repos/dpgaspar/Flask-AppBuilder/issues/189/events","html_url":"https://github.com/dpgaspar/Flask-AppBuilder/issues/189","id":95131374,"number":189,"title":"LDAP configuration - Invalid DN syntax","user":{"login":"vfrans","id":12429639,"avatar_url":"https://avatars.githubusercontent.com/u/12429639?v=3","gravatar_id":"","url":"https://api.github.com/users/vfrans","html_url":"https://github.com/vfrans","followers_url":"https://api.github.com/users/vfrans/followers","following_url":"https://api.github.com/users/vfrans/following{/other_user}","gists_url":"https://api.github.com/users/vfrans/gists{/gist_id}","starred_url":"https://api.github.com/users/vfrans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vfrans/subscriptions","organizations_url":"https://api.github.com/users/vfrans/orgs","repos_url":"https://api.github.com/users/vfrans/repos","events_url":"https://api.github.com/users/vfrans/events{/privacy}","received_events_url":"https://api.github.com/users/vfrans/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-15T08:09:56Z","updated_at":"2015-07-15T12:38:21Z","closed_at":null,"body":"Hello everyone,\r\n\r\nI have a problem configuring FAB for LDAP.\r\n\r\nThe problem looks related to binding to LDAP.\r\n\r\n### Quick explanation:\r\n\r\n#### 1. LDAP Setup\r\nI've created a user in ldap called testfab here is the ldapsearch:\r\n> ldapsearch -x -H ldaps://ldap.test.com -b \"cn=testfab,ou=people,dc=test,dc=com\" -D \"cn=testfab,ou=people,dc=test,dc=com\" -w\\<password\\>\r\n\r\n##### Returns:\r\n> dn: cn=testfab,ou=people,dc=test,dc=com\r\n> mail: testfab@test.com\r\n> userPassword:: \\<hashed password\\>\r\n> displayName: Test Fab\r\n> uid: testfab\r\n> givenName: Test\r\n> objectClass: inetOrgPerson\r\n> sn: Fab\r\n> cn: testfab\r\n\r\n#### 2. FAB Setup\r\n#####  config.py:\r\n> AUTH_LDAP_SERVER = \"ldap://ldap.test.com\"\r\n> AUTH_LDAP_SEARCH = \"ou=people,dc=test,dc=com\"\r\n> AUTH_LDAP_UID_FIELD = \"cn\"\r\n> AUTH_LDAP_FIRSTNAME_FIELD = \"givenName\"\r\n> AUTH_LDAP_LASTNAME_FIELD = \"sn\"\r\n> AUTH_LDAP_EMAIL_FIELD = \"mail\"\r\n\r\n#### 3. Tests\r\nAfter configuring ldap, entering a user/pass (login=testfab) present in ldap in the login box does:\r\n##### slapd output:\r\n> conn=45143 fd=21 ACCEPT from IP=XX.XX.XX.XX:52781 (IP=0.0.0.0:389)\r\n> conn=45143 op=0 do_bind: invalid dn (testfab)\r\n> conn=45143 op=0 RESULT tag=97 err=34 text=invalid DN\r\n> conn=45143 op=1 UNBIND\r\n> conn=45143 fd=21 closed\r\n\r\n##### FAB debug output:\r\n> 2015-07-15 09:37:05,888:DEBUG:flask_appbuilder.security.manager:LDAP bind with: testfab\r\n> 2015-07-15 09:37:05,974:ERROR:flask_appbuilder.security.manager:LDAP Error Invalid DN syntax\r\n\r\n\r\n#### 4. More tests!\r\nTo me it looks like FAB is trying to bind using as DN the text i typed in the login filed. I then tried to put my DN (cn=testfab,ou=people,dc=test,dc=com) as login to see what happens:\r\n##### slapd output:\r\n> conn=45155 fd=21 ACCEPT from IP=XX.XX.XX.XX:52808 (IP=0.0.0.0:389)\r\n> conn=45155 op=0 BIND dn=\"cn=testfab,ou=people,dc=test,dc=com\" method=128\r\n> conn=45155 op=0 BIND dn=\"cn=testfab,ou=people,dc=test,dc=com\" mech=SIMPLE ssf=0\r\n> conn=45155 op=0 RESULT tag=97 err=0 text=\r\n> conn=45155 op=1 UNBIND\r\n> conn=45155 fd=21 closed\r\n\r\n##### FAB debug output:\r\n> 2015-07-15 09:46:14,959:DEBUG:flask_appbuilder.security.manager:LDAP bind with: cn=testfab,ou=people,dc=test,dc=com\r\n\r\nNo more invalid DN! But still FAB doesn't let me in and act like if the user/password was wrong probably because it's looking for a user called cn=testfab,ou=people,dc=test,dc=com when he should be looking for user called testfab (inside a CN field).\r\n> Invalid login. Please try again.\r\n\r\n\r\nI don't know if i am using FAB correctly, if not feel free to tell me :)\r\n"},"comment":{"url":"https://api.github.com/repos/dpgaspar/Flask-AppBuilder/issues/comments/121603441","html_url":"https://github.com/dpgaspar/Flask-AppBuilder/issues/189#issuecomment-121603441","issue_url":"https://api.github.com/repos/dpgaspar/Flask-AppBuilder/issues/189","id":121603441,"user":{"login":"dpgaspar","id":4025227,"avatar_url":"https://avatars.githubusercontent.com/u/4025227?v=3","gravatar_id":"","url":"https://api.github.com/users/dpgaspar","html_url":"https://github.com/dpgaspar","followers_url":"https://api.github.com/users/dpgaspar/followers","following_url":"https://api.github.com/users/dpgaspar/following{/other_user}","gists_url":"https://api.github.com/users/dpgaspar/gists{/gist_id}","starred_url":"https://api.github.com/users/dpgaspar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpgaspar/subscriptions","organizations_url":"https://api.github.com/users/dpgaspar/orgs","repos_url":"https://api.github.com/users/dpgaspar/repos","events_url":"https://api.github.com/users/dpgaspar/events{/privacy}","received_events_url":"https://api.github.com/users/dpgaspar/received_events","type":"User","site_admin":false},"created_at":"2015-07-15T12:38:21Z","updated_at":"2015-07-15T12:38:21Z","body":"Let run some tests on this. I'll give you an answer ASAP"}}