LDAP and Active Directory Athentication error
HI ,
We use Active Directory for centralized authentication of our servers..
We are trying to make saltstack master to authenticate via Active Directory ..
But whenever we run command salt -a ldap -S 10.X.X.X test.ping , i get the below error.
Failed to authenticate! This is most likely because this user is not permitted to execute commands, but there is a small possibility that a disk error occurred (check disk/inode usage).
But i am sure that my user has access for the server that i am accessing . i am able to access those servers individually..
Below are my configuration in /etc/salt/master
################
#LDAP Configuration
#
auth.ldap.server: ad.active.com
auth.ldap.port: 389
auth.ldap.scope: 2
auth.ldap.uri: 'ldap://ad.active.com:389'
auth.ldap.tls: False
auth.ldap.no_verify: False
auth.ldap.anonymous: False
auth.ldap.groupou: 'Groups'
auth.ldap.groupclass: 'posixGroup'
auth.ldap.accountattributename: 'memberUid'
# These are only for Active Directory
auth.ldap.activedirectory: True
auth.ldap.persontype: 'person'
auth.ldap.basedn: DC=ad,DC=active,DC=com
auth.ldap.binddn: CN=saltstack,CN=Users,DC=ad,DC=active,DC=com
auth.ldap.bindpw: password
auth.ldap.filter: uid={{ username }}
auth.ldap.filter: sAMAccountName={{username}}
auth.ldap.accountattributename: sAMAccountName
and
external_auth:
ldap:
user1:
- '*':
the below are the version details of my saltstack master
Salt: 2015.5.0
Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
Jinja2: 2.2.1
M2Crypto: 0.20.2
msgpack-python: 0.4.6
msgpack-pure: Not Installed
pycrypto: 2.0.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.3.1
RAET: Not Installed
ZMQ: 3.2.5
Mako: Not Installed
Thanks for the report @Lokeshs2290. I am not very familiar with our ldap support, but I bet @cro can offer some helpful pointers.
However, I am wondering and just to double check - sometimes I see that exact same error (Failed to Authenticate!...) when I try to run a command and my master isn't running. I realize that the error your seeing could be completely related and legitimate to your Active Directory set up, but it is worth testing just to be sure.
@Lokeshs2290 also, do you have python-ldap installed?
@cro I'm getting similar issues as explained above. I have python-ldap installed. Pretty much exact same setup as above, just with my domain instead :P
Here's a versions-report:
Salt: 2015.5.3
Python: 2.6.9 (unknown, Apr 1 2015, 18:16:00)
Jinja2: 2.7.2
M2Crypto: 0.21.1
msgpack-python: 0.4.6
msgpack-pure: Not Installed
pycrypto: 2.6.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.3.1
RAET: Not Installed
ZMQ: 3.2.5
Mako: Not Installed
Tornado: Not Installed
My server can definitely authenticate against the AD, and when I do a tcpdump while executing a salt -a ldap '*' test.ping It almost looks like the traffic never even goes out of the server to the AD.
Oh and here's a run example with all loglevel:
# salt -a ldap '*' test.ping -l all
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Including configuration from '/etc/salt/master.d/external_auth.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/external_auth.conf
[DEBUG ] Including configuration from '/etc/salt/master.d/ldap.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/ldap.conf
[DEBUG ] Missing configuration file: /root/.saltrc
[TRACE ] None of the required configuration sections, 'logstash_udp_handler' and 'logstash_zmq_handler', were found the in the configuration. Not loading the Logstash logging handlers module.
[DEBUG ] Configuration file path: /etc/salt/master
[DEBUG ] Reading configuration from /etc/salt/master
[DEBUG ] Including configuration from '/etc/salt/master.d/external_auth.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/external_auth.conf
[DEBUG ] Including configuration from '/etc/salt/master.d/ldap.conf'
[DEBUG ] Reading configuration from /etc/salt/master.d/ldap.conf
[DEBUG ] Missing configuration file: /root/.saltrc
[DEBUG ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG ] Sending event - data = {'_stamp': '2015-08-31T20:16:50.931142'}
[TRACE ] get_event() received = {'tag': 'salt/event/new_client', 'data': {'_stamp': '2015-08-31T20:16:50.931142'}}
[DEBUG ] LazyLoaded ldap.auth
username: myldapuser
password:
[DEBUG ] LazyLoaded nested.output
[TRACE ] data = Failed to authenticate! This is most likely because this user is not permitted to execute commands, but there is a small possibility that a disk error occurred (check disk/inode usage).
Failed to authenticate! This is most likely because this user is not permitted to execute commands, but there is a small possibility that a disk error occurred (check disk/inode usage).
@Lokeshs2290 I apologize, this ticket didn't even hit my radar until today when @Joeskyyy posted his comment. Let me look into this.
@cro After a bit of digging, it was related to a slight misconfiguration in my basedn, binddn, and bindpw and how it interacts with AD. I might suggest we update the documentation with some of these findings specific to AD.
My advice to @Lokeshs2290 is to ensure the binddn specifically is configured correctly if you're using AD. For me I had to use the format "[email protected]" rather than the standard LDAP CN=saltstack,CN=Users,DC=ad,DC=active,DC=com
You can test this using ldapsearch and just ensure you can run both of these:
ldapsearch -x -b 'DC=domain,DC=com' -D '[email protected]' -W -h domain.com "(&(sAMAccountName=user)(objectClass=person))"
ldapsearch -x -b 'DC=domain,DC=com' -D '[email protected]' -W -h domain.com "(&(member=<MEMBER_CN_FROM_ABOVE_RESULTS>)(objectClass=group))"
Closing this for now, please feel free to re-open or open a new one if you are still having issues.