Authentication Exception

Hi!
I´ve installed read only rest free version. My situation is that i want to make the authentication via proxy (keycloack) and the authorization with read only rest. When i try to run kibana it shows this error:

{“type”:“log”,“@timestamp”:“2018-07-18T10:40:05Z”,“tags”:[“status”,“plugin:kibana@6.2.0”,“info”],“pid”:9136,“state”:“green”,“message”:“Status changed from uninitialized to green - Ready”,“prevState”:“uninitialized”,“prevMsg”:“uninitialized”}
{“type”:“log”,“@timestamp”:“2018-07-18T10:40:05Z”,“tags”:[“status”,“plugin:elasticsearch@6.2.0”,“info”],“pid”:9136,“state”:“yellow”,“message”:“Status changed from uninitialized to yellow - Waiting for Elasticsearch”,“prevState”:“uninitialized”,“prevMsg”:“uninitialized”}
{“type”:“log”,“@timestamp”:“2018-07-18T10:40:06Z”,“tags”:[“status”,“plugin:timelion@6.2.0”,“info”],“pid”:9136,“state”:“green”,“message”:“Status changed from uninitialized to green - Ready”,“prevState”:“uninitialized”,“prevMsg”:“uninitialized”}
{“type”:“log”,“@timestamp”:“2018-07-18T10:40:06Z”,“tags”:[“status”,“plugin:console@6.2.0”,“info”],“pid”:9136,“state”:“green”,“message”:“Status changed from uninitialized to green - Ready”,“prevState”:“uninitialized”,“prevMsg”:“uninitialized”}
{“type”:“log”,“@timestamp”:“2018-07-18T10:40:06Z”,“tags”:[“status”,“plugin:metrics@6.2.0”,“info”],“pid”:9136,“state”:“green”,“message”:“Status changed from uninitialized to green - Ready”,“prevState”:“uninitialized”,“prevMsg”:“uninitialized”}
{“type”:“log”,“@timestamp”:“2018-07-18T10:40:06Z”,“tags”:[“listening”,“info”],“pid”:9136,“message”:“Server running at http://localhost:5601”}
{“type”:“log”,“@timestamp”:“2018-07-18T10:40:06Z”,“tags”:[“status”,“plugin:elasticsearch@6.2.0”,“error”],“pid”:9136,“state”:“red”,“message”:“Status changed from yellow to red - Authentication Exception”,“prevState”:“yellow”,“prevMsg”:“Waiting for Elasticsearch”}

when i access to kibana i see this

here are my readonlyrest.yml and kibana .yml

readonlyrest:
response_if_req_forbidden: Sorry, your request is forbidden

access_control_rules:
- name: "user1_kibana"
  proxy_auth: "*"
  type: allow
  kibana_access: rw

kibana:

elasticsearch.requestHeadersWhitelist: [ authorization, x-forwarded-user ]
elasticsearch.username: “user1”
elasticsearch.password: “user1”

Thank you in advance. I’m waiting for a solution.

Is there anything on the Elasticsearch logs?

here is the elastic log

[2018-07-19T09:04:29,324][INFO ][o.e.n.Node ] initializing …
[2018-07-19T09:04:30,607][INFO ][o.e.e.NodeEnvironment ] [cKMurFp] using [1] data paths, mounts [[/ (/dev/sda1)
]], net usable_space [403.2gb], net total_space [454.5gb], types [ext4]
[2018-07-19T09:04:30,607][INFO ][o.e.e.NodeEnvironment ] [cKMurFp] heap size [990.7mb], compressed ordinary obj
ect pointers [true]
[2018-07-19T09:04:31,967][INFO ][o.e.n.Node ] [cKMurFp] node name derived from node ID [cKMurFpESsWc
6vpbaqtkaw]; set [node.name] to override
[2018-07-19T09:04:31,968][INFO ][o.e.n.Node ] [cKMurFp] version[6.3.0], pid[3980], build[default/tar
/424e937/2018-06-11T23:38:03.357887Z], OS[Linux/4.13.0-45-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Se
rver VM/1.8.0_171/25.171-b11]
[2018-07-19T09:04:31,968][INFO ][o.e.n.Node ] [cKMurFp] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcM
arkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m
, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.no
Unsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHoo
kEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.dI2p7SqF, -XX:+HeapDumpOnOutOfMemor
yError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -
XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation,
-XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/home/rrevuelta/elasticsearch-6.3.0, -Des.path.c
onf=/home/rrevuelta/elasticsearch-6.3.0/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2018-07-19T09:04:47,570][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [aggs-matrix-stats]
[2018-07-19T09:04:47,570][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [analysis-common]
[2018-07-19T09:04:47,570][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [ingest-common]
[2018-07-19T09:04:47,570][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [lang-expression]
[2018-07-19T09:04:47,570][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [lang-mustache]
[2018-07-19T09:04:47,571][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [lang-painless]
[2018-07-19T09:04:47,571][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [mapper-extras]
[2018-07-19T09:04:47,571][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [parent-join]
[2018-07-19T09:04:47,571][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [percolator]
[2018-07-19T09:04:47,571][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [rank-eval]
[2018-07-19T09:04:47,572][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [reindex]
[2018-07-19T09:04:47,572][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [repository-url]
[2018-07-19T09:04:47,572][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [transport-netty4]
[2018-07-19T09:04:47,572][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [tribe]
[2018-07-19T09:04:47,572][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-core]
[2018-07-19T09:04:47,573][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-deprecation]
[2018-07-19T09:04:47,573][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-graph]
[2018-07-19T09:04:47,573][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-logstash]
[2018-07-19T09:04:47,573][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-ml]
[2018-07-19T09:04:47,573][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-monitoring]
[2018-07-19T09:04:47,573][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-rollup]
[2018-07-19T09:04:47,574][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-security]
[2018-07-19T09:04:47,574][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-sql]
[2018-07-19T09:04:47,574][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-upgrade]
[2018-07-19T09:04:47,574][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded module [x-pack-watcher]
[2018-07-19T09:04:47,575][INFO ][o.e.p.PluginsService ] [cKMurFp] loaded plugin [readonlyrest]
[2018-07-19T09:05:10,896][INFO ][t.b.r.e.IndexLevelActionFilter] [cKMurFp] Settings observer refreshing…
[2018-07-19T09:05:11,549][INFO ][t.b.r.a.ACL ] ADDING BLOCK: { name: ‘user1_kibana’, policy: AL
LOW}
[2018-07-19T09:05:11,680][INFO ][t.b.r.e.IndexLevelActionFilter] [cKMurFp] Configuration reloaded - ReadonlyREST e
nabled
[2018-07-19T09:05:11,680][INFO ][t.b.r.e.IndexLevelActionFilter] [cKMurFp] Readonly REST plugin was loaded…
[2018-07-19T09:05:12,843][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:12,916][DEBUG][o.e.a.ActionModule ] Using REST wrapper from plugin tech.beshu.ror.es.Reado
nlyRestPlugin
[2018-07-19T09:05:13,845][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:14,846][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:15,327][INFO ][o.e.d.DiscoveryModule ] [cKMurFp] using discovery type [zen]
[2018-07-19T09:05:15,847][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:16,847][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:17,856][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:17,876][INFO ][o.e.n.Node ] [cKMurFp] initialized
[2018-07-19T09:05:17,876][INFO ][o.e.n.Node ] [cKMurFp] starting …
[2018-07-19T09:05:18,857][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:19,858][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:20,278][INFO ][o.e.t.TransportService ] [cKMurFp] publish_address {127.0.0.1:9300}, bound_addr
esses {[::1]:9300}, {127.0.0.1:9300}
[2018-07-19T09:05:20,331][WARN ][o.e.b.BootstrapChecks ] [cKMurFp] max virtual memory areas vm.max_map_count [6
5530] is too low, increase to at least [262144]
[2018-07-19T09:05:20,861][DEBUG][o.e.a.a.c.h.TransportClusterHealthAction] [cKMurFp] no known master node, schedul
ing a retry
[2018-07-19T09:05:23,465][INFO ][o.e.c.s.MasterService ] [cKMurFp] zen-disco-elected-as-master ([0] nodes joine
d)[, ], reason: new_master {cKMurFp}{cKMurFpESsWc6vpbaqtkaw}{0hqeByDfRxC55KT-S0P8Vw}{127.0.0.1}{127.0.0.1:9300}{xp
ack.installed=true}
[2018-07-19T09:05:23,476][INFO ][o.e.c.s.ClusterApplierService] [cKMurFp] new_master {cKMurFp}{cKMurFpESsWc6vpbaqt
kaw}{0hqeByDfRxC55KT-S0P8Vw}{127.0.0.1}{127.0.0.1:9300}{xpack.installed=true}, reason: apply cluster state (from m
aster [master {cKMurFp}{cKMurFpESsWc6vpbaqtkaw}{0hqeByDfRxC55KT-S0P8Vw}{127.0.0.1}{127.0.0.1:9300}{xpack.installed
=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)[, ]]])
[2018-07-19T09:05:23,501][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:24,407][INFO ][o.e.h.n.Netty4HttpServerTransport] [cKMurFp] publish_address {127.0.0.1:9200}, bo
und_addresses {[::1]:9200}, {127.0.0.1:9200}
[2018-07-19T09:05:24,408][INFO ][o.e.n.Node ] [cKMurFp] started
[2018-07-19T09:05:24,502][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:25,506][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:26,507][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:27,509][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:27,713][INFO ][o.e.l.LicenseService ] [cKMurFp] license [d66c23ae-58ce-421c-88f9-e40176aa7b2
0] mode [basic] - valid
[2018-07-19T09:05:27,715][INFO ][o.e.g.GatewayService ] [cKMurFp] recovered [5] indices into cluster_state
[2018-07-19T09:05:28,511][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:29,512][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:30,514][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:31,515][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:32,516][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:33,518][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:34,519][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:35,601][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:36,603][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:37,605][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:38,606][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:39,608][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:40,609][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:41,610][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:42,611][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:43,613][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:44,615][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:45,616][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:46,617][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:47,619][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:48,620][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:49,621][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:50,649][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:51,651][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:52,652][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:53,653][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:54,654][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:55,655][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:56,703][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:57,705][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:58,706][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:05:59,707][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:06:00,708][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:06:01,709][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:06:02,711][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:06:03,712][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:06:04,713][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:06:05,715][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:06:06,716][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:06:07,718][INFO ][t.b.r.c.s.SettingsPoller ] [CLUSTERWIDE SETTINGS] Cluster not ready…
[2018-07-19T09:06:08,196][INFO ][o.e.c.r.a.AllocationService] [cKMurFp] Cluster health status changed from [RED] t
o [YELLOW] (reason: [shards started [[.kibana][0]] …]).
[2018-07-19T09:06:08,726][INFO ][t.b.r.e.SettingsObservableImpl] [CLUSTERWIDE SETTINGS] index settings not found.
Will keep on using the local YAML file. Learn more about clusterwide settings at Pro - ReadonlyREST

[2018-07-19T09:09:44,066][INFO ][t.b.r.a.ACL ] FORBIDDEN by default req={ ID:2129191011-137381164
1#242, TYP:MainRequest, CGR:N/A, USR:[no basic auth header], BRS:false, KDX:null, ACT:cluster:monitor/main, OA:127
.0.0.1, DA:127.0.0.1, IDX:<N/A>, MET:HEAD, PTH:/, CNT:<N/A>, HDR:{Connection=keep-alive, Content-Length=0, Host=lo
calhost:9200}, HIS:[user1_kibana->[proxy_auth->false]] }
[2018-07-19T09:09:46,440][INFO ][t.b.r.a.ACL ] FORBIDDEN by default req={ ID:415937765-74795357#2
45, TYP:MainRequest, CGR:N/A, USR:[no basic auth header], BRS:false, KDX:null, ACT:cluster:monitor/main, OA:127.0.
0.1, DA:127.0.0.1, IDX:<N/A>, MET:HEAD, PTH:/, CNT:<N/A>, HDR:{Connection=keep-alive, Content-Length=0, Host=local
host:9200}, HIS:[user1_kibana->[proxy_auth->false]] }

While elastic is running only make one allowed peticion when i log in with the proxy

[2018-07-19T09:10:39,714][INFO ][t.b.r.a.ACL ] ALLOWED by { name: ‘user1_kibana’, policy: ALLOW}
req={ ID:901424758-466686325#305, TYP:GetRequest, CGR:N/A, USR:user1, BRS:false, KDX:null, ACT:indices:data/read/g
et, OA:127.0.0.1, DA:127.0.0.1, IDX:.kibana, MET:GET, PTH:/.kibana/doc/config%3A6.2.0, CNT:<N/A>, HDR:{Connection=
keep-alive, Content-Length=0, Host=localhost:9200, x-forwarded-user=user1}, HIS:[user1_kibana->[proxy_auth->true]]
}

, then all the time it shows a message like this

[2018-07-19T09:09:46,440][INFO ][t.b.r.a.ACL ] FORBIDDEN by default req={ ID:415937765-74795357#2
45, TYP:MainRequest, CGR:N/A, USR:[no basic auth header], BRS:false, KDX:null, ACT:cluster:monitor/main, OA:127.0.
0.1, DA:127.0.0.1, IDX:<N/A>, MET:HEAD, PTH:/, CNT:<N/A>, HDR:{Connection=keep-alive, Content-Length=0, Host=local
host:9200}, HIS:[user1_kibana->[proxy_auth->false]] }

you are missing the Kibana server ACL block. The regular poll for ES availability made by the Kibana server, uses the elasticsearch.username and elasticsearch.password credentials in regular basic auth (not x-forwarded-user!).

Therefore, if you add the following block, it will work.

- name: "kibana_server"
  type: allow
  auth_key: user1:user1

Thanks a lot it solve my trouble.

But my question now is:
if a want to have for example 200 users, i must have in kibana.yml the lines for the elastic user and password and the block you told me in the readonlyrest.yml?

I set user1:user1 in the given solution just because you had those as credentials in kibana.yml.

Just pick a user and pass and write those in kibana.yml and readonlyrest.yml, Kibana uses those credentials anonymously independently from the user session.

1 Like

Thank you very much, I understand