As far as I can understand the problem is the lookup of DN , the user record does not contain any member attribute equal to ${username}. Currently i try to compare sAMAccontName attribute with ${username} - in this case its "MyUser" and "MyDomain\MyUser" .
/bo.
##########################################
=====> Output from open ldap search: <=======
=====> GROUP <=========
PS C:\openldap\ClientTools> .\ldapsearch -D MyDomain\MyUser -w MyPassord -b "ou=Access, ou=Groups,ou=MyDepartment,dc=MyDomain,dc=acme,dc=net" -h "MyLdapServer" "CN=MyAdminGroup" member
ldap_connect_to_host: TCP MyLdapServer:389
ldap_new_socket: 412
ldap_prepare_socket: 412
ldap_pvt_connect: fd: 412 tm: -1 async: 0
attempting to connect:
connect success
# extended LDIF
#
# LDAPv3
# base <ou=Access, ou=Groups,ou=MyDepartment,dc=MyDomain,dc=acme,dc=net> with scope subtree
# filter: CN=RabbitMqAdmin
# requesting: member
#
dn: CN=RabbitMqAdmin,OU=Access,OU=Groups,OU=Mydepartment,DC=MyDomain,DC=acme,DC=net
member: CN=Olsen\, Ole,OU=Users,OU=MyDepartment,DC=MyDomain,DC=acme,DC=net sREM9Tk8sREM9TVlBVEVBLERDPU5FVA==
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1
=======> USER <=============
PS C:\openldap\ClientTools> .\ldapsearch -D MyDomain\MyUser -w MyPassord -b "dc=MyDomain,dc=acme,dc=net" -h "MyLdapServer" "sAMAccountName=MyUser" name cn memberOf sAMAccountName
ldap_connect_to_host: TCP MyLdapServer:389
ldap_new_socket: 784
ldap_prepare_socket: 784
ldap_pvt_connect: fd: 784 tm: -1 async: 0
attempting to connect:
connect success
# extended LDIF
#
# LDAPv3
# base <dc=MyDomain,dc=acme,dc=net> with scope subtree
# filter: sAMAccountName=MyUser
# requesting: name
#
dn: CN=Olsen\, Ole,OU=Users,OU=MyDepartment,DC=MyDomain,DC=acme,DC=net
cn: Olsen, Ole
memberOf: CN=RabbitMqAdmin,OU=Access,OU=Groups,OU=MyDepartment,DC=MyDomain,DC=acme,DC=net
memberOf: CN=MailUser, OU= ....
name: Olsen, Ole
sAMAccountName: MyUser
# search result
search: 2
result: 0 Success
###########################################
=======> RabbitMQ log - try to create a new queue <===============
2018-10-25 11:17:14.659 [info] <0.766.0> LDAP CHECK: login for MyDomain\MyUser
2018-10-25 11:17:14.659 [info] <0.766.0> LDAP filling template "${username}" with [{username,<<"MyDomain\\MyUser">>}]
2018-10-25 11:17:14.660 [info] <0.766.0> LDAP template result: "MyDomain\MyUser"
2018-10-25 11:17:14.660 [info] <0.766.0> LDAP connecting to servers: ["MyLdapServer"]
2018-10-25 11:17:14.683 [info] <0.767.0> LDAP network traffic: bind request = {'BindRequest',3,"MyDomain\\MyUser",{simple,<<"MyPassword">>}}
2018-10-25 11:17:14.691 [info] <0.767.0> LDAP network traffic: bind reply = {ok,{'LDAPMessage',1,{bindResponse,{'BindResponse',success,[],[],asn1_NOVALUE,asn1_NOVALUE}},asn1_NOVALUE}}
2018-10-25 11:17:14.691 [info] <0.295.0> LDAP bind succeeded: MyDomain\MyUser
2018-10-25 11:17:14.691 [info] <0.295.0> LDAP filling template "${username}" with [{username,<<"MyDomain\\MyUser">>}]
2018-10-25 11:17:14.691 [info] <0.295.0> LDAP template result: "MyDomain\MyUser"
2018-10-25 11:17:14.691 [info] <0.767.0> LDAP network traffic: search request = {'SearchRequest',"dc=MyDomain,dc=acme,dc=net",wholeSubtree,derefAlways,0,0,false,{equalityMatch,{'AttributeValueAssertion',"sAMAccountName","MyDomain\\MyUser"}},["distinguishedName"]}
2018-10-25 11:17:14.698 [info] <0.767.0> LDAP network traffic: search reply = {ok,{'LDAPMessage',2,{searchResDone,{'LDAPResult',success,[],[],asn1_NOVALUE}},asn1_NOVALUE}}
2018-10-25 11:17:14.698 [info] <0.767.0> LDAP network traffic: search reply = searchResDone
2018-10-25 11:17:14.698 [warning] <0.295.0> Searching for DN for MyDomain\MyUser, got back []
....
2018-10-25 11:26:45.482 [info] <0.791.0> LDAP CHECK: configure permission for queue "test" in "MyVhost" for "MyDomain\MyUser"
2018-10-25 11:26:45.482 [info] <0.791.0> LDAP connecting to servers: ["MyLdapServer"]
2018-10-25 11:26:45.482 [info] <0.767.0> LDAP network traffic: bind request = {'BindRequest',3,"MyDomain\\MyUser",{simple,<<"MyPassword">>}}
2018-10-25 11:26:45.490 [info] <0.767.0> LDAP network traffic: bind reply = {ok,{'LDAPMessage',29,{bindResponse,{'BindResponse',success,[],[],asn1_NOVALUE,asn1_NOVALUE}},asn1_NOVALUE}}
2018-10-25 11:26:45.490 [info] <0.295.0> LDAP bind succeeded: MyDomain\MyUser
2018-10-25 11:26:45.490 [info] <0.295.0> LDAP evaluating query: {for,[{permission,configure,{in_group,"cn=RabbitMqAdmin"}},{permission,write,{constant,true}},{permission,read,{constant,true}}]}
2018-10-25 11:26:45.490 [info] <0.295.0> LDAP selecting subquery permission = configure
2018-10-25 11:26:45.490 [info] <0.295.0> LDAP evaluating query: {in_group,"cn=RabbitMqAdmin"}
2018-10-25 11:26:45.490 [info] <0.295.0> LDAP evaluating query: {in_group,"cn=RabbitMqAdmin","member"}
2018-10-25 11:26:45.490 [info] <0.295.0> LDAP filling template "cn=RabbitMqAdmin" with [{username,<<"MyDomain\\MyUser">>},{user_dn,"MyDomain\\MyUser"},{vhost,<<"MyVhost">>},{resource,queue},{name,<<"test">>},{permission,configure}]
2018-10-25 11:26:45.490 [info] <0.295.0> LDAP template result: "cn=RabbitMqAdmin"
2018-10-25 11:26:45.490 [info] <0.767.0> LDAP network traffic: search request = {'SearchRequest',"cn=RabbitMqAdmin",baseObject,derefAlways,0,0,false,{equalityMatch,{'AttributeValueAssertion',"member","MyDomain\\MyUser"}},["objectClass"]}
2018-10-25 11:26:45.497 [info] <0.767.0> LDAP network traffic: search reply = {ok,{'LDAPMessage',30,{searchResDone,{'LDAPResult',operationsError,[],[48,48,48,48,50,48,68,54,58,32,83,118,99,69,114,114,58,32,68,83,73,68,45,48,51,49,48,48,56,49,66,44,32,112,114,111,98,108,101,109,32,53,48,49,50,32,40,68,73,82,95,69,82,82,79,82,41,44,32,100,97,116,97,32,48,10,0],asn1_NOVALUE}},asn1_NOVALUE}}
2018-10-25 11:26:45.497 [info] <0.295.0> LDAP evaluated in_group for "cn=RabbitMqAdmin": {error,operationsError}
2018-10-25 11:26:45.497 [info] <0.295.0> LDAP evaluate error: MyDomain\MyUser operationsError
2018-10-25 11:26:45.497 [info] <0.791.0> LDAP DECISION: configure permission for queue "test" in "MyVhost" for "MyDomain\MyUser": {error,ldap_evaluate_error}
2018-10-25 11:26:45.497 [error] <0.791.0> access to queue 'test' in vhost 'MyVhost' refused for user 'MyDomain\MyUser', backend rabbit_auth_backend_ldap returned an error: ldap_evaluate_error
2018-10-25 11:26:45.497 [warning] <0.791.0> Declare queue error: access to queue 'test' in vhost 'MyVhost' refused for user 'MyDomain\MyUser', backend rabbit_auth_backend_ldap returned an error: ldap_evaluate_error
##############################################
=======> Rabbit MQ advanced.config <===============
...
{rabbitmq_auth_backend_ldap, [
{log, network_unsafe},
{servers, ["MyLdapServer"] },
{dn_lookup_attribute,"sAMAccountName"},
{dn_lookup_base,"dc=MyDomain,dc=acme,dc=net"},
{group_lookup_base,"ou=Access,ou=Groups,ou=MyDepartment,dc=MyDomain,dc=acme,dc=net"},
{tag_queries,
[ { administrator, {constant, false}},
{ management, {constant, true}},
{ monitoring, {constant, false}}
]
},
{vhost_access_query,
{ 'not',
{equals,{string,"${vhost}"},
{string,"/"}
}
}
},
{resource_access_query,
{for, [ {permission, configure, {in_group,"cn=RabbitMqAdmin"}},
{permission, write, {constant, true }},
{permission, read, {constant, true }}
]
}
}
]
}
...