Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into deangularize/…
Browse files Browse the repository at this point in the history
…dashboard
  • Loading branch information
ThomThomson committed Dec 8, 2020
2 parents 4e6bafe + 11470ac commit b7d90f6
Show file tree
Hide file tree
Showing 135 changed files with 13,361 additions and 65,946 deletions.
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
],
"maps_legacy": "src/plugins/maps_legacy",
"monaco": "packages/kbn-monaco/src",
"presentationUtil": "src/plugins/presentation_util",
"indexPatternManagement": "src/plugins/index_pattern_management",
"advancedSettings": "src/plugins/advanced_settings",
"kibana_legacy": "src/plugins/kibana_legacy",
Expand Down
6 changes: 5 additions & 1 deletion docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ as uiSettings within the code.
- Adds a dashboard embeddable that can be used in other applications.
|{kib-repo}blob/{branch}/src/plugins/data/README.md[data]
|{kib-repo}blob/{branch}/src/plugins/data/README.mdx[data]
|The data plugin provides common data access services, such as search and query, for solutions and application developers.
Expand Down Expand Up @@ -160,6 +160,10 @@ It also provides a stateful version of it on the start contract.
Content is fetched from the remote (https://feeds.elastic.co and https://feeds-staging.elastic.co in dev mode) once a day, with periodic checks if the content needs to be refreshed. All newsfeed content is hosted remotely.
|{kib-repo}blob/{branch}/src/plugins/presentation_util/README.md[presentationUtil]
|Utilities and components used by the presentation-related plugins
|{kib-repo}blob/{branch}/src/plugins/region_map/README.md[regionMap]
|Create choropleth maps. Display the results of a term-aggregation as e.g. countries, zip-codes, states.
Expand Down
45 changes: 45 additions & 0 deletions docs/settings/security-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,51 @@ In addition to <<authentication-provider-settings,the settings that are valid fo

|===

[float]
[[anonymous-authentication-provider-settings]]
===== Anonymous authentication provider settings

In addition to <<authentication-provider-settings,the settings that are valid for all providers>>, you can specify the following settings:

[NOTE]
============
You can configure only one anonymous provider per {kib} instance.
============

[cols="2*<"]
|===
| `xpack.security.authc.providers.`
`anonymous.<provider-name>.credentials` {ess-icon}
| Credentials that {kib} should use internally to authenticate anonymous requests to {es}. Possible values are: username and password, API key, or the constant `elasticsearch_anonymous_user` if you want to leverage {ref}/anonymous-access.html[{es} anonymous access].

2+a| For example:

[source,yaml]
----------------------------------------
# Username and password credentials
xpack.security.authc.providers.anonymous.anonymous1:
credentials:
username: "anonymous_service_account"
password: "anonymous_service_account_password"
# API key (concatenated and base64-encoded)
xpack.security.authc.providers.anonymous.anonymous1:
credentials:
apiKey: "VnVhQ2ZHY0JDZGJrUW0tZTVhT3g6dWkybHAyYXhUTm1zeWFrdzl0dk5udw=="
# API key (as returned from Elasticsearch API)
xpack.security.authc.providers.anonymous.anonymous1:
credentials:
apiKey.id: "VuaCfGcBCdbkQm-e5aOx"
apiKey.key: "ui2lp2axTNmsyakw9tvNnw"
# Elasticsearch anonymous access
xpack.security.authc.providers.anonymous.anonymous1:
credentials: "elasticsearch_anonymous_user"
----------------------------------------

|===

[float]
[[http-authentication-settings]]
===== HTTP authentication settings
Expand Down
106 changes: 106 additions & 0 deletions docs/user/security/authentication/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- <<saml>>
- <<oidc>>
- <<kerberos>>
- <<anonymous-authentication>>
- <<http-authentication>>

Enable multiple authentication mechanisms at the same time specifying a prioritized list of the authentication _providers_ (typically of various types) in the configuration. Providers are consulted in ascending order. Make sure each configured provider has a unique name (e.g. `basic1` or `saml1` in the configuration example) and `order` setting. In the event that two or more providers have the same name or `order`, {kib} will fail to start.
Expand Down Expand Up @@ -293,6 +294,111 @@ xpack.security.authc.providers:

Kibana uses SPNEGO, which wraps the Kerberos protocol for use with HTTP, extending it to web applications. At the end of the Kerberos handshake, Kibana will forward the service ticket to Elasticsearch. Elasticsearch will unpack it and it will respond with an access and refresh token which are then used for subsequent authentication.

[[anonymous-authentication]]
==== Anonymous authentication

[IMPORTANT]
============================================================================
Anyone with access to the network {kib} is exposed to will be able to access {kib}. Make sure that you've properly restricted the capabilities of the anonymous service account so that anonymous users can't perform destructive actions or escalate their own privileges.
============================================================================

Anonymous authentication gives users access to {kib} without requiring them to provide credentials. This can be useful if you want your users to skip the login step when you embed dashboards in another application or set up a demo {kib} instance in your internal network, while still keeping other security features intact.

To enable anonymous authentication in {kib}, you must decide what credentials the anonymous service account {kib} should use internally to authenticate anonymous requests.

NOTE: You can configure only one anonymous authentication provider per {kib} instance.

There are three ways to specify these credentials:

If you have a user who can authenticate to {es} using username and password, for instance from the Native or LDAP security realms, you can also use these credentials to impersonate the anonymous users. Here is how your `kibana.yml` might look if you use username and password credentials:

[source,yaml]
-----------------------------------------------
xpack.security.authc.providers:
anonymous.anonymous1:
order: 0
credentials:
username: "anonymous_service_account"
password: "anonymous_service_account_password"
-----------------------------------------------

If using username and password credentials isn't desired or feasible, then you can create a dedicated <<api-keys, API key>> for the anonymous service account. In this case, your `kibana.yml` might look like this:

[source,yaml]
-----------------------------------------------
xpack.security.authc.providers:
anonymous.anonymous1:
order: 0
credentials:
apiKey: "VnVhQ2ZHY0JDZGJrUW0tZTVhT3g6dWkybHAyYXhUTm1zeWFrdzl0dk5udw=="
-----------------------------------------------

The previous configuration snippet uses an API key string that is the result of base64-encoding of the `id` and `api_key` fields returned from the {es} API, joined by a colon. You can also specify these fields separately, and {kib} will do the concatenation and base64-encoding for you:

[source,yaml]
-----------------------------------------------
xpack.security.authc.providers:
anonymous.anonymous1:
order: 0
credentials:
apiKey.id: "VuaCfGcBCdbkQm-e5aOx"
apiKey.key: "ui2lp2axTNmsyakw9tvNnw"
-----------------------------------------------

It's also possible to use {kib} anonymous access in conjunction with the {es} anonymous access.

Prior to configuring {kib}, ensure that anonymous access is enabled and properly configured in {es}. See {ref}/anonymous-access.html[Enabling anonymous access] for more information.

Here is how your `kibana.yml` might look like if you want to use {es} anonymous access to impersonate anonymous users in {kib}:

[source,yaml]
-----------------------------------------------
xpack.security.authc.providers:
anonymous.anonymous1:
order: 0
credentials: "elasticsearch_anonymous_user" <1>
-----------------------------------------------

<1> The `elasticsearch_anonymous_user` is a special constant that indicates you want to use the {es} anonymous user.

[float]
===== Anonymous access and other types of authentication

You can configure more authentication providers in addition to anonymous access in {kib}. In this case, the Login Selector presents a configurable *Continue as Guest* option for anonymous access:

[source,yaml]
--------------------------------------------------------------------------------
xpack.security.authc.providers:
basic.basic1:
order: 0
anonymous.anonymous1:
order: 1
credentials:
username: "anonymous_service_account"
password: "anonymous_service_account_password"
--------------------------------------------------------------------------------

[float]
===== Anonymous access and embedding

One of the most popular use cases for anonymous access is when you embed {kib} into other applications and don't want to force your users to log in to view it. If you configured {kib} to use anonymous access as the sole authentication mechanism, you don't need to do anything special while embedding {kib}.

If you have multiple authentication providers enabled, and you want to automatically log in anonymous users when embedding, then you will need to add the `auth_provider_hint=<anonymous-provider-name>` query string parameter to the {kib} URL that you're embedding.

For example, if you generate the iframe code to embed {kib}, it will look like this:

```html
<iframe src="https://localhost:5601/app/dashboards#/view/722b74f0-b882-11e8-a6d9-e546fe2bba5f?embed=true&_g=(....)" height="600" width="800"></iframe>
```

To make this iframe leverage anonymous access automatically, you will need to modify a link to {kib} in the `src` iframe attribute to look like this:

```html
<iframe src="https://localhost:5601/app/dashboards?auth_provider_hint=anonymous1#/view/722b74f0-b882-11e8-a6d9-e546fe2bba5f?embed=true&_g=(....)" height="600" width="800"></iframe>
```

Note that `auth_provider_hint` query string parameter goes *before* the hash URL fragment.

[[http-authentication]]
==== HTTP authentication

Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-dev-utils/src/plugin_list/discover_plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export interface Plugin {
export type Plugins = Plugin[];

const getReadmeName = (directory: string) =>
Fs.readdirSync(directory).find((name) => name.toLowerCase() === 'readme.md');
Fs.readdirSync(directory).find(
(name) => name.toLowerCase() === 'readme.md' || name.toLowerCase() === 'readme.mdx'
);

const getReadmeAsciidocName = (directory: string) =>
Fs.readdirSync(directory).find((name) => name.toLowerCase() === 'readme.asciidoc');
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ pageLoadAssetSize:
watcher: 43598
runtimeFields: 41752
stackAlerts: 29684
presentationUtil: 28545
1 change: 1 addition & 0 deletions src/dev/precommit_hook/casing_check_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const IGNORE_FILE_GLOBS = [
'docs/**/*',
'**/bin/**/*',
'**/+([A-Z_]).md',
'**/+([A-Z_]).mdx',
'**/+([A-Z_]).asciidoc',
'**/LICENSE',
'**/*.txt',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const useDashboardContainer = (
(incomingEmbeddable.embeddableId &&
!newContainer.getInput().panels[incomingEmbeddable.embeddableId]))
) {
dashboardStateManager.switchViewMode(ViewMode.EDIT);
newContainer.addNewEmbeddable<EmbeddableInput>(
incomingEmbeddable.type,
incomingEmbeddable.input
Expand Down
10 changes: 10 additions & 0 deletions src/plugins/data/README.md → src/plugins/data/README.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
---
id: kibDataPlugin
slug: /kibana-dev-guide/services/data-plugin
title: Data services
image: https://source.unsplash.com/400x175/?Search
summary: The data plugin contains services for searching, querying and filtering.
date: 2020-12-02
tags: ['kibana','dev', 'contributor', 'api docs']
---

# data

The data plugin provides common data access services, such as `search` and `query`, for solutions and application developers.
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/presentation_util/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# presentationUtil

Utilities and components used by the presentation-related plugins
21 changes: 21 additions & 0 deletions src/plugins/presentation_util/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export const PLUGIN_ID = 'presentationUtil';
export const PLUGIN_NAME = 'presentationUtil';
9 changes: 9 additions & 0 deletions src/plugins/presentation_util/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id": "presentationUtil",
"version": "1.0.0",
"kibanaVersion": "kibana",
"server": false,
"ui": true,
"requiredPlugins": ["dashboard", "savedObjects"],
"optionalPlugins": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React, { useState, useEffect, useCallback } from 'react';

import { i18n } from '@kbn/i18n';

import { EuiComboBox } from '@elastic/eui';
import { SavedObjectsClientContract } from '../../../../core/public';
import { SavedObjectDashboard } from '../../../../plugins/dashboard/public';

export interface DashboardPickerProps {
onChange: (dashboard: { name: string; id: string } | null) => void;
isDisabled: boolean;
savedObjectsClient: SavedObjectsClientContract;
}

interface DashboardOption {
label: string;
value: string;
}

export function DashboardPicker(props: DashboardPickerProps) {
const [dashboards, setDashboards] = useState<DashboardOption[]>([]);
const [isLoadingDashboards, setIsLoadingDashboards] = useState(true);
const [selectedDashboard, setSelectedDashboard] = useState<DashboardOption | null>(null);

const { savedObjectsClient, isDisabled, onChange } = props;

const fetchDashboards = useCallback(
async (query) => {
setIsLoadingDashboards(true);
setDashboards([]);

const { savedObjects } = await savedObjectsClient.find<SavedObjectDashboard>({
type: 'dashboard',
search: query ? `${query}*` : '',
searchFields: ['title'],
});
if (savedObjects) {
setDashboards(savedObjects.map((d) => ({ value: d.id, label: d.attributes.title })));
}
setIsLoadingDashboards(false);
},
[savedObjectsClient]
);

// Initial dashboard load
useEffect(() => {
fetchDashboards('');
}, [fetchDashboards]);

return (
<EuiComboBox
placeholder={i18n.translate('presentationUtil.dashboardPicker.searchDashboardPlaceholder', {
defaultMessage: 'Search dashboards...',
})}
singleSelection={{ asPlainText: true }}
options={dashboards || []}
selectedOptions={!!selectedDashboard ? [selectedDashboard] : undefined}
onChange={(e) => {
if (e.length) {
setSelectedDashboard({ value: e[0].value || '', label: e[0].label });
onChange({ name: e[0].label, id: e[0].value || '' });
} else {
setSelectedDashboard(null);
onChange(null);
}
}}
onSearchChange={fetchDashboards}
isDisabled={isDisabled}
isLoading={isLoadingDashboards}
compressed={true}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.savAddDashboard__searchDashboards {
margin-left: $euiSizeL;
margin-top: $euiSizeXS;
width: 300px;
}
Loading

0 comments on commit b7d90f6

Please sign in to comment.