Skip to content

Commit

Permalink
Merge branch '7.x' into backport/7.x/pr-64292
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed May 5, 2020
2 parents e3b9131 + 375c3bf commit d0993e8
Show file tree
Hide file tree
Showing 97 changed files with 1,232 additions and 1,322 deletions.
73 changes: 39 additions & 34 deletions .ci/es-snapshots/Jenkinsfile_verify_es
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,46 @@ def SNAPSHOT_MANIFEST = "https://storage.googleapis.com/kibana-ci-es-snapshots-d

kibanaPipeline(timeoutMinutes: 135) {
catchErrors {
retryable.enable(2)
withEnv(["ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}"]) {
parallel([
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
'x-pack-intake-agent': workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh'),
'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
'oss-ciGroup3': kibanaPipeline.ossCiGroupProcess(3),
'oss-ciGroup4': kibanaPipeline.ossCiGroupProcess(4),
'oss-ciGroup5': kibanaPipeline.ossCiGroupProcess(5),
'oss-ciGroup6': kibanaPipeline.ossCiGroupProcess(6),
'oss-ciGroup7': kibanaPipeline.ossCiGroupProcess(7),
'oss-ciGroup8': kibanaPipeline.ossCiGroupProcess(8),
'oss-ciGroup9': kibanaPipeline.ossCiGroupProcess(9),
'oss-ciGroup10': kibanaPipeline.ossCiGroupProcess(10),
'oss-ciGroup11': kibanaPipeline.ossCiGroupProcess(11),
'oss-ciGroup12': kibanaPipeline.ossCiGroupProcess(12),
]),
'kibana-xpack-agent': workers.functional('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
'xpack-ciGroup1': kibanaPipeline.xpackCiGroupProcess(1),
'xpack-ciGroup2': kibanaPipeline.xpackCiGroupProcess(2),
'xpack-ciGroup3': kibanaPipeline.xpackCiGroupProcess(3),
'xpack-ciGroup4': kibanaPipeline.xpackCiGroupProcess(4),
'xpack-ciGroup5': kibanaPipeline.xpackCiGroupProcess(5),
'xpack-ciGroup6': kibanaPipeline.xpackCiGroupProcess(6),
'xpack-ciGroup7': kibanaPipeline.xpackCiGroupProcess(7),
'xpack-ciGroup8': kibanaPipeline.xpackCiGroupProcess(8),
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
]),
])
}
slackNotifications.onFailure(
title: ":broken_heart: *<${env.BUILD_URL}|[${SNAPSHOT_VERSION}] ES Snapshot Verification Failure>*",
message: ":broken_heart: [${SNAPSHOT_VERSION}] ES Snapshot Verification Failure",
) {
retryable.enable(2)
withEnv(["ES_SNAPSHOT_MANIFEST=${SNAPSHOT_MANIFEST}"]) {
parallel([
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
'x-pack-intake-agent': workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh'),
'kibana-oss-agent': workers.functional('kibana-oss-tests', { kibanaPipeline.buildOss() }, [
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
'oss-ciGroup3': kibanaPipeline.ossCiGroupProcess(3),
'oss-ciGroup4': kibanaPipeline.ossCiGroupProcess(4),
'oss-ciGroup5': kibanaPipeline.ossCiGroupProcess(5),
'oss-ciGroup6': kibanaPipeline.ossCiGroupProcess(6),
'oss-ciGroup7': kibanaPipeline.ossCiGroupProcess(7),
'oss-ciGroup8': kibanaPipeline.ossCiGroupProcess(8),
'oss-ciGroup9': kibanaPipeline.ossCiGroupProcess(9),
'oss-ciGroup10': kibanaPipeline.ossCiGroupProcess(10),
'oss-ciGroup11': kibanaPipeline.ossCiGroupProcess(11),
'oss-ciGroup12': kibanaPipeline.ossCiGroupProcess(12),
]),
'kibana-xpack-agent': workers.functional('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
'xpack-ciGroup1': kibanaPipeline.xpackCiGroupProcess(1),
'xpack-ciGroup2': kibanaPipeline.xpackCiGroupProcess(2),
'xpack-ciGroup3': kibanaPipeline.xpackCiGroupProcess(3),
'xpack-ciGroup4': kibanaPipeline.xpackCiGroupProcess(4),
'xpack-ciGroup5': kibanaPipeline.xpackCiGroupProcess(5),
'xpack-ciGroup6': kibanaPipeline.xpackCiGroupProcess(6),
'xpack-ciGroup7': kibanaPipeline.xpackCiGroupProcess(7),
'xpack-ciGroup8': kibanaPipeline.xpackCiGroupProcess(8),
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
]),
])
}

promoteSnapshot(SNAPSHOT_VERSION, SNAPSHOT_ID)
promoteSnapshot(SNAPSHOT_VERSION, SNAPSHOT_ID)
}
}

kibanaPipeline.sendMail()
Expand Down
2 changes: 1 addition & 1 deletion config/kibana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# the username and password that the Kibana server uses to perform maintenance on the Kibana
# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
# is proxied through the Kibana server.
#elasticsearch.username: "kibana"
#elasticsearch.username: "kibana_system"
#elasticsearch.password: "pass"

# Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively.
Expand Down
4 changes: 2 additions & 2 deletions docs/user/security/securing-kibana.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ file:

[source,yaml]
-----------------------------------------------
elasticsearch.username: "kibana"
elasticsearch.username: "kibana_system"
elasticsearch.password: "kibanapassword"
-----------------------------------------------

The {kib} server submits requests as this user to access the cluster monitoring
APIs and the `.kibana` index. The server does _not_ need access to user indices.

The password for the built-in `kibana` user is typically set as part of the
The password for the built-in `kibana_system` user is typically set as part of the
{security} configuration process on {es}. For more information, see
{ref}/built-in-users.html[Built-in users].
--
Expand Down
16 changes: 8 additions & 8 deletions packages/kbn-es/src/utils/native_realm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('setPasswords', () => {

mockClient.security.getUser.mockImplementation(() => ({
body: {
kibana: {
kibana_system: {
metadata: {
_reserved: true,
},
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('setPasswords', () => {
}));

await nativeRealm.setPasswords({
'password.kibana': 'bar',
'password.kibana_system': 'bar',
});

expect(mockClient.security.changePassword.mock.calls).toMatchInlineSnapshot(`
Expand All @@ -149,7 +149,7 @@ Array [
"password": "bar",
},
"refresh": "wait_for",
"username": "kibana",
"username": "kibana_system",
},
],
Array [
Expand Down Expand Up @@ -188,7 +188,7 @@ describe('getReservedUsers', () => {
it('returns array of reserved usernames', async () => {
mockClient.security.getUser.mockImplementation(() => ({
body: {
kibana: {
kibana_system: {
metadata: {
_reserved: true,
},
Expand All @@ -206,17 +206,17 @@ describe('getReservedUsers', () => {
},
}));

expect(await nativeRealm.getReservedUsers()).toEqual(['kibana', 'logstash_system']);
expect(await nativeRealm.getReservedUsers()).toEqual(['kibana_system', 'logstash_system']);
});
});

describe('setPassword', () => {
it('sets password for provided user', async () => {
await nativeRealm.setPassword('kibana', 'foo');
await nativeRealm.setPassword('kibana_system', 'foo');
expect(mockClient.security.changePassword).toHaveBeenCalledWith({
body: { password: 'foo' },
refresh: 'wait_for',
username: 'kibana',
username: 'kibana_system',
});
});

Expand All @@ -226,7 +226,7 @@ describe('setPassword', () => {
});

await expect(
nativeRealm.setPassword('kibana', 'foo')
nativeRealm.setPassword('kibana_system', 'foo')
).rejects.toThrowErrorMatchingInlineSnapshot(`"SomeError"`);
});
});
2 changes: 1 addition & 1 deletion src/cli/serve/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
set('optimize.watch', true);

if (!has('elasticsearch.username')) {
set('elasticsearch.username', 'kibana');
set('elasticsearch.username', 'kibana_system');
}

if (!has('elasticsearch.password')) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions src/core/server/elasticsearch/elasticsearch_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,21 @@ describe('deprecations', () => {
const { messages } = applyElasticsearchDeprecations({ username: 'elastic' });
expect(messages).toMatchInlineSnapshot(`
Array [
"Setting [${CONFIG_PATH}.username] to \\"elastic\\" is deprecated. You should use the \\"kibana\\" user instead.",
"Setting [${CONFIG_PATH}.username] to \\"elastic\\" is deprecated. You should use the \\"kibana_system\\" user instead.",
]
`);
});

it('does not log a warning if elasticsearch.username is set to something besides "elastic"', () => {
it('logs a warning if elasticsearch.username is set to "kibana"', () => {
const { messages } = applyElasticsearchDeprecations({ username: 'kibana' });
expect(messages).toMatchInlineSnapshot(`
Array [
"Setting [${CONFIG_PATH}.username] to \\"kibana\\" is deprecated. You should use the \\"kibana_system\\" user instead.",
]
`);
});

it('does not log a warning if elasticsearch.username is set to something besides "elastic" or "kibana"', () => {
const { messages } = applyElasticsearchDeprecations({ username: 'otheruser' });
expect(messages).toHaveLength(0);
});
Expand Down
8 changes: 6 additions & 2 deletions src/core/server/elasticsearch/elasticsearch_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const configSchema = schema.object({
if (rawConfig === 'elastic') {
return (
'value of "elastic" is forbidden. This is a superuser account that can obfuscate ' +
'privilege-related issues. You should use the "kibana" user instead.'
'privilege-related issues. You should use the "kibana_system" user instead.'
);
}
},
Expand Down Expand Up @@ -131,7 +131,11 @@ const deprecations: ConfigDeprecationProvider = () => [
}
if (es.username === 'elastic') {
log(
`Setting [${fromPath}.username] to "elastic" is deprecated. You should use the "kibana" user instead.`
`Setting [${fromPath}.username] to "elastic" is deprecated. You should use the "kibana_system" user instead.`
);
} else if (es.username === 'kibana') {
log(
`Setting [${fromPath}.username] to "kibana" is deprecated. You should use the "kibana_system" user instead.`
);
}
if (es.ssl?.key !== undefined && es.ssl?.certificate === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const rules = {
shard_size: 10,
order: {
__template: {
_term: 'asc',
_key: 'asc',
},
_term: { __one_of: ['asc', 'desc'] },
_count: { __one_of: ['asc', 'desc'] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export class DashboardContainer extends Container<InheritedChildInput, Dashboard
};
this.updateInput({
panels: finalPanels,
lastReloadRequestTime: new Date().getTime(),
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export class VisEditor extends Component {

handleUiState = (field, value) => {
this.props.vis.uiState.set(field, value);
// reload visualization because data might need to be re-fetched
this.props.vis.uiState.emit('reload');
};

updateVisState = debounce(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export interface VisualizeInput extends EmbeddableInput {
vis?: {
colors?: { [key: string]: string };
};
table?: unknown;
}

export interface VisualizeOutput extends EmbeddableOutput {
Expand All @@ -77,7 +78,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
private query?: Query;
private title?: string;
private filters?: Filter[];
private visCustomizations: VisualizeInput['vis'];
private visCustomizations?: Pick<VisualizeInput, 'vis' | 'table'>;
private subscriptions: Subscription[] = [];
private expression: string = '';
private vis: Vis;
Expand Down Expand Up @@ -108,6 +109,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
this.timefilter = timefilter;
this.vis = vis;
this.vis.uiState.on('change', this.uiStateChangeHandler);
this.vis.uiState.on('reload', this.reload);

this.autoRefreshFetchSubscription = timefilter
.getAutoRefreshFetch$()
Expand Down Expand Up @@ -149,17 +151,22 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
// Check for changes that need to be forwarded to the uiState
// Since the vis has an own listener on the uiState we don't need to
// pass anything from here to the handler.update method
const visCustomizations = this.input.vis;
if (visCustomizations) {
const visCustomizations = { vis: this.input.vis, table: this.input.table };
if (visCustomizations.vis || visCustomizations.table) {
if (!_.isEqual(visCustomizations, this.visCustomizations)) {
this.visCustomizations = visCustomizations;
// Turn this off or the uiStateChangeHandler will fire for every modification.
this.vis.uiState.off('change', this.uiStateChangeHandler);
this.vis.uiState.clearAllKeys();
this.vis.uiState.set('vis', visCustomizations);
getKeys(visCustomizations).forEach(key => {
this.vis.uiState.set(key, visCustomizations[key]);
});
if (visCustomizations.vis) {
this.vis.uiState.set('vis', visCustomizations.vis);
getKeys(visCustomizations).forEach(key => {
this.vis.uiState.set(key, visCustomizations[key]);
});
}
if (visCustomizations.table) {
this.vis.uiState.set('table', visCustomizations.table);
}
this.vis.uiState.on('change', this.uiStateChangeHandler);
}
} else if (this.parent) {
Expand Down Expand Up @@ -307,6 +314,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
super.destroy();
this.subscriptions.forEach(s => s.unsubscribe());
this.vis.uiState.off('change', this.uiStateChangeHandler);
this.vis.uiState.off('reload', this.reload);

if (this.handler) {
this.handler.destroy();
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/visualize/public/application/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState
stateContainer
);
vis.uiState = persistedState;
vis.uiState.on('reload', embeddableHandler.reload);
$scope.uiState = persistedState;
$scope.savedVis = savedVis;
$scope.query = initialState.query;
Expand Down Expand Up @@ -534,6 +535,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState
$scope.eventEmitter.off('apply', _applyVis);

unsubscribePersisted();
vis.uiState.off('reload', embeddableHandler.reload);
unsubscribeStateUpdates();

stopAllSyncing();
Expand Down
Loading

0 comments on commit d0993e8

Please sign in to comment.