Hi,
I am trying to setup AD user authentication with Elasticsearch 6.0 installed on Windows Server 2016. Any ideas how to solve this issue?
The configuration in elasticsearch.yml file is
xpack:
security:
authc:
realms:
active_directory:
type: active_directory
bind_dn: binduser@company.com
bind_password: PASSWORD
order: 0
domain_name: corp.company.com
follow_referrals: false
url: "ldaps://corp.company.com:3269"
ssl:
certificate: certs/new/certificate.pem
key: certs/new/secret.key
certificate_authorities: certs/new/CA.pem
verification_mode: certificate
user_search:
base_dn: "OU=UserAccounts,DC=subdomain,DC=corp,DC=company,DC=com"
group_search:
base_dn: "DC=subdomain,DC=corp,DC=company,DC=com"
files:
role_mapping: "C:/elasticsearch/config/x-pack/role_mapping.yml"
unmapped_groups_as_roles: false
I have also enabled xpack ssl for the elasticsearch node itself. That when I browse https://elasticnode:9200 with elastic user I see successful ES default response with a secure symbol.
But AD authentication fails for domain user when a request is sent from Postman tool with type: "security_exception", status:401, reason: unable to authenticate user [domain/aduser] for REST request [/]"
LDP.exe can successfully authenticate this user and shows response
Authenticated as dn: ‘binduser’.
SSL cert has been imported to the server's keystore cacerts
Exception detail in log file is
2018-02-10T02:54:46,908][DEBUG][o.e.x.s.a.l.LdapRealm ] [ES-node1-dev] Exception occurred during authenticate for active_directory/active_directory
com.unboundid.ldap.sdk.LDAPBindException: An error occurred while attempting to send the LDAP message to server corp.company.com:3269: SSLHandshakeException(message='sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target', trace='getSSLException(Alerts.java:192) / fatal(SSLSocketImpl.java:1959) / fatalSE(Handshaker.java:328) / fatalSE(Handshaker.java:322) / serverCertificate(ClientHandshaker.java:1614) / processMessage(ClientHandshaker.java:216) / processLoop(Handshaker.java:1052) / process_record(Handshaker.java:987) / readRecord(SSLSocketImpl.java:1072) / performInitialHandshake(SSLSocketImpl.java:1385) / writeRecord(SSLSocketImpl.java:757) / write(AppOutputStream.java:123) / flushBuffer(BufferedOutputStream.java:82) / flush(BufferedOutputStream.java:140) / sendMessage(LDAPConnectionInternals.java:543) / sendMessage(LDAPConnection.java:4249) / process(SimpleBindRequest.java:551) / bind(LDAPConnection.java:2143) / createConnection(LDAPConnectionPool.java:1268) / createConnection(LDAPConnectionPool.java:1178) / getConnection(LDAPConnectionPool.java:1706) / bindAndRevertAuthentication(LDAPConnectionPool.java:1531) / lambda$doRun$0(LdapUtils.java:135) / doPrivileged(AccessController.java:native) / privilegedConnect(LdapUtils.java:86) / doRun(LdapUtils.java:135) / run(AbstractRunnable.java:37) / maybeForkThenBind(LdapUtils.java:160) / authenticate(ActiveDirectorySessionFactory.java:318) / getSessionWithPool(ActiveDirectorySessionFactory.java:136) / session(PoolingSessionFactory.java:104) / lambda$doAuthenticate$1(LdapRealm.java:164) / doRun(LdapRealm.java:320) / doRun(ThreadContext.java:638) / run(AbstractRunnable.java:37) / runWorker(ThreadPoolExecutor.java:1149) / run(ThreadPoolExecutor.java:624) / run(Thread.java:748)', cause=ValidatorException(message='PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target', trace='doBuild(PKIXValidator.java:397) / engineValidate(PKIXValidator.java:302) / validate(Validator.java:260) / validate(X509TrustManagerImpl.java:324) / checkTrusted(X509TrustManagerImpl.java:229) / checkServerTrusted(X509TrustManagerImpl.java:124) / checkServerTrusted(SSLService.java:568) / serverCertificate(ClientHandshaker.java:1596) / processMessage(ClientHandshaker.java:216) / processLoop(Handshaker.java:1052) / process_record(Handshaker.java:987) / readRecord(SSLSocketImpl.java:1072) / performInitialHandshake(SSLSocketImpl.java:1385) / writeRecord(SSLSocketImpl.java:757) / write(AppOutputStream.java:123) / flushBuffer(BufferedOutputStream.java:82) / flush(BufferedOutputStream.java:140) / sendMessage(LDAPConnectionInternals.java:543) / sendMessage(LDAPConnection.java:4249) / process(SimpleBindRequest.java:551) / bind(LDAPConnection.java:2143) / createConnection(LDAPConnectionPool.java:1268) / createConnection(LDAPConnectionPool.java:1178) / getConnection(LDAPConnectionPool.java:1706) / bindAndRevertAuthentication(LDAPConnectionPool.java:1531) / lambda$doRun$0(LdapUtils.java:135) / doPrivileged(AccessController.java:native) / privilegedConnect(LdapUtils.java:86) / doRun(LdapUtils.java:135) / run(AbstractRunnable.java:37) / maybeForkThenBind(LdapUtils.java:160) / authenticate(ActiveDirectorySessionFactory.java:318) / getSessionWithPool(ActiveDirectorySessionFactory.java:136) / session(PoolingSessionFactory.java:104) / lambda$doAuthenticate$1(LdapRealm.java:164) / doRun(LdapRealm.java:320) / doRun(ThreadContext.java:638) / run(AbstractRunnable.java:37) / runWorker(ThreadPoolExecutor.java:1149) / run(ThreadPoolExecutor.java:624) / run(Thread.java:748)', cause=SunCertPathBuilderException(message='unable to find valid certification path to requested target', trace='build(SunCertPathBuilder.java:141) / engineBuild(SunCertPathBuilder.java:126) / build(CertPathBuilder.java:280) / doBuild(PKIXValidator.java:392) / engineValidate(PKIXValidator.java:302) / validate(Validator.java:260) / validate(X509TrustManagerImpl.java:324) /
...
at com.unboundid.ldap.sdk.LDAPConnectionPool.createConnection(LDAPConnectionPool.java:1289) ~[?:?]
at com.unboundid.ldap.sdk.LDAPConnectionPool.createConnection(LDAPConnectionPool.java:1178) ~[?:?]
at com.unboundid.ldap.sdk.LDAPConnectionPool.getConnection(LDAPConnectionPool.java:1706) ~[?:?]
at com.unboundid.ldap.sdk.LDAPConnectionPool.bindAndRevertAuthentication(LDAPConnectionPool.java:1531) ~[?:?]
at org.elasticsearch.xpack.security.authc.ldap.support.LdapUtils$1.lambda$doRun$0(LdapUtils.java:135) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_161]
at
...