Setup Active Direcoty with Opendistro or Opensearch

This current Authz

authz:

  mycompany_local_ad:
    description: "MyCompany AD Authorization Sources"
    http_enabled: true
    transport_enabled: true
    authorization_backend:
      # LDAP authorization backend (gather roles from a LDAP or Active Directory, you have to configure the above LDAP authentication backend settings too)
      type: "ldap"
      config:
        # enable ldaps
        enable_ssl: false
        # enable start tls, enable_ssl should be false
        enable_start_tls: false
        # send client certificate
        enable_ssl_client_auth: false
        # verify ldap hostname
        verify_hostnames: false
        hosts:
        - x.x.x.x:389
        bind_dn: 'cn=dharmin fadia,cn=Users,dc=dharmin,dc=com'
        password: password
        #Disable use of custom_attribute_names
        custom_attr_maxval_len: 1
        userbase: dc=dharmin,dc=com
        # Filter to search for users (currently in the whole subtree beneath userbase)
        # {0} is substituted with the username
        #usersearch: '(uid={0})'
        usersearch: "(mail={0})"
        username_attribute: "mail"
        # Filter to search for roles (currently in the whole subtree beneath rolebase)
        # {0} is substituted with the DN of the user
        # {1} is substituted with the username
        # {2} is substituted with an attribute value from user's directory entry, of the authenticated user. Use userroleattribute to specify the name of the attribute
        rolebase: 'OU=Users and Groups,DC=dharmin,DC=com'
        rolesearch: "(member={0})"
        # Specify the name of the attribute which value should be substituted with {2} above
        userroleattribute: null
        # Roles as an attribute of the user entry
        #userrolename: disabled
        userrolename: memberOf
        # The attribute in a role entry containing the name of that role, Default is "name".
        # Can also be "dn" to use the full DN as rolename.
        rolename: "cn"
        #rolename: name
        # Resolve nested roles transitive (roles which are members of other roles and so on ...)
        resolve_nested_roles: true
        # Skip users matching a user name, a wildcard or a regex pattern
        skip_users:
        - kibanaserver
        #- "cn=Michael Jackson,ou*people,o=TEST"
        #- "/\S*/"

Do you have the Organizational Unit (OU) “Users and Groups” in your AD ?
Is it really there where your accounts are stored, where you want to search acc?

In your bind_dn, it looks more like “CN=Users”
So this

rolebase: 'OU=Users and Groups,DC=dharmin,DC=com'

should be

rolebase: 'CN=Users,DC=dharmin,DC=com'

No ?

usersearch: "(mail={0})"
username_attribute: "mail"

Do you have the “mail” attribute ?

And why do you use this parameter ?

userrolename: memberOf

Maybe try to disable it, comment it

Can you send the Kibana/OpenDashboards login screen error ?
Did you set up the role/role mapping ?

yes I setup roles and rolse mapin but it was without AD config I need to setup for role and role mapping for AD somthing like thar ?

How do you think OpenSearch maps his role with AD?
You have to define it somewhere, it’s not automatic.
How can you link OpenSearch ACL/roles with AD without defining it ?

I want to do Automate when i will create user in AD it can be login from kibana
and if i am disable it from AD should be disable and as per the index I want assigne read permission to all and admin can do everything

image

@dharminfadia Could you run the below command and share the output?

curl --insecure -u "<ldap_username>" -XGET https://<OpenSearch_node>:9200/_plugins/_security/authinfo?pretty

I tried with AD user name and password Getting Unauthorized.

Try admin admin, or with the certificates kirk.

Getting This error

Are you using OpenSearch?
Which version?

As of now I am testing on Opendistro 1.13.2 ES verison is 7.10

@dharminfadia Try this instead for Opendistro.

curl --insecure -u admin:admin -XGET https://<elasticsearch_node>:9200/_opendistro/_security/authinfo?pretty

@dharminfadia Try to use username instead of UPN.

curl --insecure -u dharmin -XGET https://<es_node>:9200/_opendistro/_security/authinfo?pretty

with admin:admin

with dharmin

@dharminfadia Sorry, I’ve missed -u

curl --insecure -u dharmin -XGET https://<es_node>:9200/_opendistro/_security/authinfo?pretty

@dharminfadia Thanks for checking that. I’ve noticed you’re using SSL to connect with AD.
Does your AD use a TLS certificate signed by Enterprise CA or it’s self-signed?

When you got an Unauthorized response on all the tries, did you get any errors in ES logs?