2020-01-22 18:08:54 +01:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
|
|
* 2.0.
|
2020-01-22 18:08:54 +01:00
|
|
|
*/
|
2021-08-13 03:34:05 +02:00
|
|
|
import { get } from 'lodash';
|
2020-10-28 11:03:04 +01:00
|
|
|
import type { PublicMethodsOf } from '@kbn/utility-types';
|
2020-08-31 23:39:12 +02:00
|
|
|
import { PluginInitializerContext, PluginConfigDescriptor } from '../../../../src/core/server';
|
2020-01-22 18:08:54 +01:00
|
|
|
import { ActionsPlugin } from './plugin';
|
2021-05-27 23:20:57 +02:00
|
|
|
import { configSchema, ActionsConfig, CustomHostSettings } from './config';
|
2020-02-12 19:49:16 +01:00
|
|
|
import { ActionsClient as ActionsClientClass } from './actions_client';
|
2020-07-22 15:45:57 +02:00
|
|
|
import { ActionsAuthorization as ActionsAuthorizationClass } from './authorization/actions_authorization';
|
2020-02-12 19:49:16 +01:00
|
|
|
|
|
|
|
export type ActionsClient = PublicMethodsOf<ActionsClientClass>;
|
2020-07-22 15:45:57 +02:00
|
|
|
export type ActionsAuthorization = PublicMethodsOf<ActionsAuthorizationClass>;
|
2020-01-22 18:08:54 +01:00
|
|
|
|
2021-01-21 15:20:22 +01:00
|
|
|
export type {
|
2020-04-08 18:54:42 +02:00
|
|
|
ActionsPlugin,
|
|
|
|
ActionResult,
|
|
|
|
ActionTypeExecutorOptions,
|
|
|
|
ActionType,
|
|
|
|
PreConfiguredAction,
|
2021-01-21 15:20:22 +01:00
|
|
|
ActionsApiRequestHandlerContext,
|
2020-04-08 18:54:42 +02:00
|
|
|
} from './types';
|
2021-01-06 18:18:57 +01:00
|
|
|
|
|
|
|
export type {
|
|
|
|
EmailActionTypeId,
|
|
|
|
EmailActionParams,
|
|
|
|
IndexActionTypeId,
|
|
|
|
IndexActionParams,
|
|
|
|
PagerDutyActionTypeId,
|
|
|
|
PagerDutyActionParams,
|
|
|
|
ServerLogActionTypeId,
|
|
|
|
ServerLogActionParams,
|
|
|
|
SlackActionTypeId,
|
|
|
|
SlackActionParams,
|
|
|
|
WebhookActionTypeId,
|
|
|
|
WebhookActionParams,
|
2021-02-02 10:29:42 +01:00
|
|
|
ServiceNowITSMActionTypeId,
|
|
|
|
ServiceNowSIRActionTypeId,
|
2021-01-06 18:18:57 +01:00
|
|
|
ServiceNowActionParams,
|
|
|
|
JiraActionTypeId,
|
|
|
|
JiraActionParams,
|
|
|
|
ResilientActionTypeId,
|
|
|
|
ResilientActionParams,
|
|
|
|
TeamsActionTypeId,
|
|
|
|
TeamsActionParams,
|
|
|
|
} from './builtin_action_types';
|
2021-01-21 15:20:22 +01:00
|
|
|
export type { PluginSetupContract, PluginStartContract } from './plugin';
|
2020-01-22 18:08:54 +01:00
|
|
|
|
2020-09-16 12:47:37 +02:00
|
|
|
export { asSavedObjectExecutionSource, asHttpRequestExecutionSource } from './lib';
|
2021-05-06 15:54:20 +02:00
|
|
|
export { ACTION_SAVED_OBJECT_TYPE } from './constants/saved_objects';
|
2020-09-16 12:47:37 +02:00
|
|
|
|
2020-01-22 18:08:54 +01:00
|
|
|
export const plugin = (initContext: PluginInitializerContext) => new ActionsPlugin(initContext);
|
|
|
|
|
2021-01-28 19:44:25 +01:00
|
|
|
export const config: PluginConfigDescriptor<ActionsConfig> = {
|
2020-01-22 18:08:54 +01:00
|
|
|
schema: configSchema,
|
2021-05-27 23:20:57 +02:00
|
|
|
deprecations: ({ renameFromRoot, unused }) => [
|
2021-10-21 21:44:06 +02:00
|
|
|
renameFromRoot('xpack.actions.whitelistedHosts', 'xpack.actions.allowedHosts', {
|
|
|
|
level: 'warning',
|
|
|
|
}),
|
2021-05-27 23:20:57 +02:00
|
|
|
(settings, fromPath, addDeprecation) => {
|
2021-08-13 03:34:05 +02:00
|
|
|
const actions = get(settings, fromPath);
|
|
|
|
const customHostSettings = actions?.customHostSettings ?? [];
|
2021-05-27 23:20:57 +02:00
|
|
|
if (
|
|
|
|
customHostSettings.find(
|
|
|
|
(customHostSchema: CustomHostSettings) =>
|
2021-10-06 18:09:35 +02:00
|
|
|
customHostSchema.hasOwnProperty('ssl') &&
|
|
|
|
customHostSchema.ssl?.hasOwnProperty('rejectUnauthorized')
|
2021-05-27 23:20:57 +02:00
|
|
|
)
|
|
|
|
) {
|
|
|
|
addDeprecation({
|
2021-10-21 21:44:06 +02:00
|
|
|
level: 'warning',
|
2021-10-15 12:11:21 +02:00
|
|
|
configPath: 'xpack.actions.customHostSettings.ssl.rejectUnauthorized',
|
2021-05-27 23:20:57 +02:00
|
|
|
message:
|
2021-06-23 20:37:31 +02:00
|
|
|
`"xpack.actions.customHostSettings[<index>].ssl.rejectUnauthorized" is deprecated.` +
|
|
|
|
`Use "xpack.actions.customHostSettings[<index>].ssl.verificationMode" instead, ` +
|
2021-06-02 14:52:14 +02:00
|
|
|
`with the setting "verificationMode:full" eql to "rejectUnauthorized:true", ` +
|
|
|
|
`and "verificationMode:none" eql to "rejectUnauthorized:false".`,
|
|
|
|
correctiveActions: {
|
|
|
|
manualSteps: [
|
2021-06-23 20:37:31 +02:00
|
|
|
`Remove "xpack.actions.customHostSettings[<index>].ssl.rejectUnauthorized" from your kibana configs.`,
|
|
|
|
`Use "xpack.actions.customHostSettings[<index>].ssl.verificationMode" ` +
|
2021-06-02 14:52:14 +02:00
|
|
|
`with the setting "verificationMode:full" eql to "rejectUnauthorized:true", ` +
|
|
|
|
`and "verificationMode:none" eql to "rejectUnauthorized:false".`,
|
|
|
|
],
|
|
|
|
},
|
2021-05-27 23:20:57 +02:00
|
|
|
});
|
2021-10-06 18:09:35 +02:00
|
|
|
return {
|
|
|
|
unset: [
|
|
|
|
{
|
|
|
|
path: `xpack.actions.customHostSettings.ssl.rejectUnauthorized`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
2021-05-27 23:20:57 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
(settings, fromPath, addDeprecation) => {
|
2021-08-13 03:34:05 +02:00
|
|
|
const actions = get(settings, fromPath);
|
2021-10-06 18:09:35 +02:00
|
|
|
if (actions?.hasOwnProperty('rejectUnauthorized')) {
|
2021-05-27 23:20:57 +02:00
|
|
|
addDeprecation({
|
2021-10-21 21:44:06 +02:00
|
|
|
level: 'warning',
|
2021-10-15 12:11:21 +02:00
|
|
|
configPath: `${fromPath}.rejectUnauthorized`,
|
2021-05-27 23:20:57 +02:00
|
|
|
message:
|
2021-06-02 14:52:14 +02:00
|
|
|
`"xpack.actions.rejectUnauthorized" is deprecated. Use "xpack.actions.verificationMode" instead, ` +
|
|
|
|
`with the setting "verificationMode:full" eql to "rejectUnauthorized:true", ` +
|
|
|
|
`and "verificationMode:none" eql to "rejectUnauthorized:false".`,
|
|
|
|
correctiveActions: {
|
|
|
|
manualSteps: [
|
|
|
|
`Remove "xpack.actions.rejectUnauthorized" from your kibana configs.`,
|
|
|
|
`Use "xpack.actions.verificationMode" ` +
|
|
|
|
`with the setting "verificationMode:full" eql to "rejectUnauthorized:true", ` +
|
|
|
|
`and "verificationMode:none" eql to "rejectUnauthorized:false".`,
|
|
|
|
],
|
|
|
|
},
|
2021-05-27 23:20:57 +02:00
|
|
|
});
|
2021-10-06 18:09:35 +02:00
|
|
|
return {
|
|
|
|
unset: [
|
|
|
|
{
|
|
|
|
path: `xpack.actions.rejectUnauthorized`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
2021-05-27 23:20:57 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
(settings, fromPath, addDeprecation) => {
|
2021-08-13 03:34:05 +02:00
|
|
|
const actions = get(settings, fromPath);
|
2021-10-06 18:09:35 +02:00
|
|
|
if (actions?.hasOwnProperty('proxyRejectUnauthorizedCertificates')) {
|
2021-05-27 23:20:57 +02:00
|
|
|
addDeprecation({
|
2021-10-21 21:44:06 +02:00
|
|
|
level: 'warning',
|
2021-10-15 12:11:21 +02:00
|
|
|
configPath: `${fromPath}.proxyRejectUnauthorizedCertificates`,
|
2021-05-27 23:20:57 +02:00
|
|
|
message:
|
2021-06-02 14:52:14 +02:00
|
|
|
`"xpack.actions.proxyRejectUnauthorizedCertificates" is deprecated. Use "xpack.actions.proxyVerificationMode" instead, ` +
|
|
|
|
`with the setting "proxyVerificationMode:full" eql to "rejectUnauthorized:true",` +
|
|
|
|
`and "proxyVerificationMode:none" eql to "rejectUnauthorized:false".`,
|
|
|
|
correctiveActions: {
|
|
|
|
manualSteps: [
|
|
|
|
`Remove "xpack.actions.proxyRejectUnauthorizedCertificates" from your kibana configs.`,
|
|
|
|
`Use "xpack.actions.proxyVerificationMode" ` +
|
|
|
|
`with the setting "proxyVerificationMode:full" eql to "rejectUnauthorized:true",` +
|
|
|
|
`and "proxyVerificationMode:none" eql to "rejectUnauthorized:false".`,
|
|
|
|
],
|
|
|
|
},
|
2021-05-27 23:20:57 +02:00
|
|
|
});
|
2021-10-06 18:09:35 +02:00
|
|
|
return {
|
|
|
|
unset: [
|
|
|
|
{
|
|
|
|
path: `xpack.actions.proxyRejectUnauthorizedCertificates`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
2021-05-27 23:20:57 +02:00
|
|
|
}
|
|
|
|
},
|
2020-08-31 23:39:12 +02:00
|
|
|
],
|
2020-01-22 18:08:54 +01:00
|
|
|
};
|