I have a Shield-protected Kibana 4.5 dashboard that I'm embedding via iframe. Is there any way to programmatically provide the user/password so that the user automatically auths and the dashboard is displayed?
I've attempted the following with no luck: <iframe src="https://username:password@myKibanaHost....> <iframe src="https://myKibanaHost?embed=true&username=myuser&password=mypass>
I know this isn't best idea to embed credentials in the iframe, but this is an internal system and we don't want users to have to authenticate twice (once to our site, once to Kibana).
If you are using Shield 2.3, and you have the front-end plugin installed in Kibana, then yes, this is possible. It doesn't work as you've put in your example.
Instead, pass a valid Basic Authorization header with the request will cause Shield will validate the session, creating and using an authorization cookie in the background.
Note that prior to 2.3, I don't believe this was possible at all.
When you use Kibana hosted in Cloud normally, you are talking to a proxy, and that proxy has headers that it sets, including one for the cluster_id. I don't know enough about this to know if your proxy might be preventing the Cloud proxy's header from persisting.
It should be possible to route to the Elastic Cloud using nginx, there's just an extra header you need to supply, eg:
proxy_set_header X-Found-Cluster <cluster-id>;
(note that's the full cluster ID, not just the first 6 digits)
There may be other issues, it's not something I've tried; but based on the error you're currently getting, this extra header should at least get you one step closer!
#Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects
# the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests
# to Kibana. This setting cannot end in a slash.
server.basePath: "/kibana"
Ok, but how do I set up server.basePath in the Kibana Cloud? I can't access the kibana .yml file
Ah sorry - you cannot currently set server.basePath in the Elastic Cloud Kibana; so you'd need to configure the proxy to translate the Kibana URLs in the replies (I don't know if that's possible, I have done it for Splunk in the past though using apache)
The alternative that we see people do a fair bit in these sorts of scenarios is to run their Kibana outside of Elastic Cloud pointing at an Elasticsearch instance in the cloud Obviously that's a bit of a pain, but Kibana is generally easier to run and maintain than Elasticsearch anyway.
Thank you @tsullivan for your recommendations and sample nginx configuration.I know it is a work around and it will not solve all issues. @thomasneirynck shared a ticket asking for a enhancement to basically provide public facing visualizations and dashboard like many other modern platforms offer. Please upvote or comment if you find it helpful: https://github.com/elastic/kibana/issues/18331
Hi, @tsullivan my ELK is version 6.2.2.
I want to let users can auto authenticate to x-pack security.
Do I need to install shield into Kibana?
How can I connect nginx with x-pack?
Hi,
If you install X-Pack in Elasticsearch, you should also install it into Kibana. X-Pack is the commercial suite of products that includes Security (formerly called Shield).
To auto authenticate, set up a reverse proxy that passes through to the Kibana server. The proxy can add an authentication header to make all the requests authenticated as whatever user you want them to be.
Hello,
So I can use nginx to access Kibana dashboards with different users? I tried to use a variable for the user in the nginx, but my problem is when I do the GET request of Kibana Dashboard.
My nginx is like this:
$proxy_host takes host value from proxy_pass directive, while $host will contain your server_name. And apparently, Kibana from Elastic Cloud requires an original host to determine target cluster ID.
Works for me without proxifying any additional X-Found-Cluster headers.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.