Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Alerts][Actions] Removed isESOUsingEphemeralEncryptionKey determination. Set ESO plugin as a required dependency for Actions and Alerts plugins. Changed UI to show the proper info for disabled ESO plugin. #87936

Conversation

YulNaumenko
Copy link
Contributor

@YulNaumenko YulNaumenko commented Jan 11, 2021

Removed usingEphemeralEncryptionKey check for alerts and actions plugins.
This is needed due to the upcoming changes in the ESO plugin, where the plugin won't be enabled if encryptionKey was not set: 'enabled cannot be set to true until encryptionKey is specified.'

  1. If ESO is disabled, alerts and actions plugins are disabled too with the proper Kibana start log messages:

Screen Shot 2021-01-20 at 10 24 50 PM

  1. Extended triggers_actions_ui plugin to have an own health api, which return the current state based on the different factors like availability of the related plugins.
    Used this health API to replace the obsolete alerting framework health option hasPermanentEncryptionKey.

  2. Modified UI warning message from:

Screen Shot 2021-01-12 at 10 26 07 AM

to:

Screen Shot 2021-01-12 at 1 01 21 PM

Resolves #80678

…ion. Set ESO plugin as an optional dependancy for actions and alerts plugins.
@YulNaumenko YulNaumenko added Feature:Alerting v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Actions Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.12.0 labels Jan 11, 2021
@YulNaumenko YulNaumenko self-assigned this Jan 11, 2021
@YulNaumenko YulNaumenko marked this pull request as ready for review January 12, 2021 19:53
@YulNaumenko YulNaumenko requested a review from a team as a code owner January 12, 2021 19:53
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@gchaps
Copy link
Contributor

gchaps commented Jan 12, 2021

Suggested text:

Encrypted saved objects are not available

Set a value for xpack.encryptionSavedObjects.encryptionKey in your kibana.yml file and ensure the Encrypted Saved Objects plugin is enabled. Learn how.

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

"requiredPlugins": ["licensing", "taskManager", "encryptedSavedObjects", "eventLog", "features"],
"optionalPlugins": ["usageCollection", "spaces", "security"],
"requiredPlugins": ["licensing", "taskManager", "eventLog", "features"],
"optionalPlugins": ["usageCollection", "spaces", "security", "encryptedSavedObjects"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the expected behaviour when ESO is disabled?
Should Actions and Alerts still works without encryption?
If not, seems like this should still be in requiredPlugins.
If so, then seems like we're missing a whole test suite of e2e tests where Alerting & Actions run without ESOs

Copy link
Contributor Author

@YulNaumenko YulNaumenko Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the expected behaviour when ESO is disabled?

In the alerting management and in the API responses we show the message that the user should configure ESO (like it was done for ephemeral encryption key). So I kept the same behavior.

Copy link
Contributor Author

@YulNaumenko YulNaumenko Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should Actions and Alerts still works without encryption?

Actions and Alerts won't normally work without the encryption. For the existing alerts and actions executions user will get the error messages, where we are proposing to the user to enable the ESO plugin by the link Learn how in the UI message and configuration link in the API message.

Copy link
Contributor Author

@YulNaumenko YulNaumenko Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, then seems like we're missing a whole test suite of e2e tests where Alerting & Actions run without ESOs

Alerts and actions cannot run without ESO.
ESO is in the optional plugins list, because the users should be able to get the info about possible missing configuration, I think..
Do you think we should disable it at all?
To clarify: this PR changes is needed because there won't be support for ephemeral encryption key any more. But currently, with this key our framework is also not working properly for create and execute and we are not disabling plugins and just saying to the user that he should be able to change the configuration to make it works normal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that if we leave it as a required plugin, we'll end up with no alert/action UI at all, and the only diagnostic would be the list of plugins listed at Kibana startup, where alerts/actions wouldn't be listed. Perhaps some messaging that the plugins were disabled because a required plugin wasn't available? Or would Kibana just not start up at that point?

So seems odd, but the only reason to keep the alerts/actions plugins loadable is to display the message. Which is probably important enough that we'd want to make this optional instead of required. Presumably some read-only activities could still work (maybe not now, but could be made to work?)? Eg, listing alerts, alert instances?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elastic/apm-ui, @elastic/siem, @elastic/uptime please let us know here if you have any objections about disabling alerts and actions plugins if encrypted_saved_objects is disabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this impact if/when we move the alerting UI code to the alerts plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Yes, it will be disabled as well..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how we have much of a choice here, this is required for things to be secure right? Is there any action we need to take on Uptime? If not, of course I support keeping things secure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewvc just want to let you know that if we decide to make ESO as a required dependency for alerts and actions and uptime app will keep the alerts as required plugin it will be disabled as well on Kibana start.

@YulNaumenko YulNaumenko requested a review from gmmorris January 13, 2021 18:29
@pmuellr
Copy link
Member

pmuellr commented Jan 13, 2021

I'm a little concerned on the timing of #81511 - which is the PR which changes the ESO plugin behavior. I believe that all the plugins depending on ESO will need to switch within the same Kibana release, so we should double check that all the other plugins are ready for 7.12, before merging. Even when we do switch, there will be some span between when the ESO-using plugins land and #81511 lands, in which the encryptionKey check won't be made, as the ESO-using plugins will always think it's available, but you'll get a different key on each run and so see decryption errors. That seems ok-ish, it would only be a problem for elasticians I think, and only a short while.

@YulNaumenko
Copy link
Contributor Author

I'm a little concerned on the timing of #81511 - which is the PR which changes the ESO plugin behavior. I believe that all the plugins depending on ESO will need to switch within the same Kibana release, so we should double check that all the other plugins are ready for 7.12, before merging.

There are only our plugins and fleet plugin which is relying onto the ESO.

@YulNaumenko YulNaumenko changed the title [Alerts][Actions] Changed isESOUsingEphemeralEncryptionKey determination. Set ESO plugin as an optional dependency for Actions and Alerts plugins. [Alerts][Actions] Removed isESOUsingEphemeralEncryptionKey determination. Set ESO plugin as a required dependency for Actions and Alerts plugins. Changed UI to show the proper info for disabled ESO plugin. Jan 21, 2021
@YulNaumenko YulNaumenko requested a review from pmuellr January 21, 2021 05:43
Copy link
Contributor

@gmmorris gmmorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much better than the original approach!
Looks like we still have some leftover from that though? Looks like we now have some places where values are nullable though they don't need to be? 🤔 I've added notes in all of them :)

describe('routeHandlerContext.getActionsClient()', () => {
it('should not throw error when ESO plugin not using a generated key', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that actions is dependent on ESO I think we can remove this all together, no?
It should never be possible for getActionsClient to be available when ESO is not... right? 🤔

@@ -227,34 +191,19 @@ describe('Actions Plugin', () => {
expect(pluginStart.isActionExecutable('preconfiguredServerLog', '.server-log')).toBe(true);
});

it('should not throw error when ESO plugin not using a generated key', async () => {
it('should not throw error when ESO plugin is available', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this test... I think we can remove it altogether now, no?

Comment on lines 332 to 335
const encryptedSavedObjectsClient = plugins.encryptedSavedObjects.getClient({
includedHiddenTypes,
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code used to reside outside of getActionsClientWithRequest to prevent us from creating a new encryptedSavedObjectsClient every time an ActionsClient is created.
Is there a reason why this has been moved in now? 🤔

Comment on lines 128 to 132
if (!encryptedSavedObjects) {
throw new Error(
`Unable to run task because the Encrypted Saved Objects plugin is not available. Please set xpack.encryptedSavedObjects.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command.`
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't happen, right? Now that it's a required plugin it should always be there, so this is redundant code (unless I'm missing something)

Comment on lines 27 to 33
if (!internalSavedObjectsRepository) {
healthStatuses.decryptionHealth = {
status: HealthStatus.Warning,
timestamp: new Date().toISOString(),
};
return healthStatuses;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have we made internalSavedObjectsRepository optional here? Am I missing something?
It doesn't look like we've changed the call to getHealth so this looks like it might be leftovers from the original approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching this leftovers!

@YulNaumenko YulNaumenko requested a review from gmmorris January 21, 2021 20:04
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
triggersActionsUi 333 334 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
triggersActionsUi 1.6MB 1.6MB -3.5KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@YulNaumenko
Copy link
Contributor Author

Closed in favor of the PR #81511 and a follow up issue

@YulNaumenko YulNaumenko closed this Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Actions Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[alerting][actions] change isESOUsingEphemeralEncryptionKey determination
10 participants