Hi,
I want to configure auto login when users hit kibana url. So i created a anonymous user with basic read privileges through API. I checked if the user got created by logging in. it works. but when i add authorization header through nginx i get 401 in browser:
{"statusCode":401,"error":"Unauthorized","message":"[security_exception] unable to authenticate user [kibana_anonymous] for REST request [/_security/_authenticate], with { header={ WWW-Authenticate={ 0=\"Bearer realm=\\\"security\\\"\" & 1=\"ApiKey\" & 2=\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\" } } }"}
Part of my nginx conf where header is added:
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
location / {
proxy_set_header Authorization "Basic a2liYW5hX2Fub255bW91czphbm9ueW1vdXM=";
proxy_pass https://<KIBANA_URL>:5601;
}
This is what i get in elasticsearch log:
[id: 0x63c1aefd, L:/172.17.0.2:9200 - R:/172.17.0.1:55216] HANDSHAKEN: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
Authentication to realm default_native failed - Password authentication failed for kibana_anonymous
path: /_security/_authenticate, params: {}
org.elasticsearch.ElasticsearchSecurityException: unable to authenticate user [kibana_anonymous] for REST request [/_security/_authenticate]
at org.elasticsearch.xpack.core.security.support.Exceptions.authenticationError(Exceptions.java:18) ~[x-pack-core-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.core.security.authc.DefaultAuthenticationFailureHandler.createAuthenticationError(DefaultAuthenticationFailureHandler.java:154) ~[x-pack-core-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.core.security.authc.DefaultAuthenticationFailureHandler.failedAuthentication(DefaultAuthenticationFailureHandler.java:82) ~[x-pack-core-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.security.authc.AuthenticationService$AuditableRestRequest.authenticationFailed(AuthenticationService.java:716) ~[x-pack-security-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.consumeUser(AuthenticationService.java:495) [x-pack-security-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$consumeToken$16(AuthenticationService.java:403) [x-pack-security-7.3.1.jar:7.3.1]
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:62) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.core.common.IteratingActionListener.onResponse(IteratingActionListener.java:115) [x-pack-core-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$consumeToken$13(AuthenticationService.java:387) [x-pack-security-7.3.1.jar:7.3.1]
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:62) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.security.authc.support.CachingUsernamePasswordRealm.lambda$authenticateWithCache$3(CachingUsernamePasswordRealm.java:175) [x-pack-security-7.3.1.jar:7.3.1]
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:62) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.security.authc.esnative.NativeUsersStore.lambda$verifyPassword$16(NativeUsersStore.java:515) [x-pack-security-7.3.1.jar:7.3.1]
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:62) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.xpack.security.authc.esnative.NativeUsersStore$2.onResponse(NativeUsersStore.java:212) [x-pack-security-7.3.1.jar:7.3.1]
at org.elasticsearch.action.support.ContextPreservingActionListener.onResponse(ContextPreservingActionListener.java:43) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:68) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:64) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.action.support.ContextPreservingActionListener.onResponse(ContextPreservingActionListener.java:43) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$2.handleResponse(TransportSingleShardAction.java:265) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$2.handleResponse(TransportSingleShardAction.java:251) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleResponse(TransportService.java:1101) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.transport.TransportService$DirectResponseChannel.processResponse(TransportService.java:1182) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1162) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:54) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.action.support.ChannelActionListener.onResponse(ChannelActionListener.java:47) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.action.support.ChannelActionListener.onResponse(ChannelActionListener.java:30) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$1.doRun(TransportSingleShardAction.java:112) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:758) [elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.3.1.jar:7.3.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:835) [?:?]
In logs it says 'Authentication to realm default_native failed - Password authentication failed for kibana_anonymous' I rechecked multiple times to make sure password is correct but still i'm getting this error. (Manual login through same credentials work)
I generated that base64 with following command:
echo -n username:password | base64