-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Import / export of rules and connectors as Kibana saved object Export/Import #50266
Comments
Pinging @elastic/kibana-stack-services (Team:Stack Services) |
There is an issue open to allow end-users to access encrypted properties #56013. This would allow a few options for actions:
|
Some additional challenges mentioned here: #60053 (comment).
|
I have some ideas how some of the concerns above could be handled. ConnectorsHere we could rely on something like exposing connector secrets which could be included in the export. This will be a breaking change as users wouldn't expect such a change in a minor. An alternative option could be to add a feature to connectors that allows users to disable them. This could behave the same as when connectors are disabled by the license where they don't run. We could then omit secrets and disable the connector in the export data. We could then prompt the user after import that further steps are necessary to enable the connector. AlertsI think a lot of the workflows could be solved by exporting / importing the alerts as disabled. It won't require an API key or a task to be scheduled, it won't rely on the importing user's privileges to make the alert work. Here as well we could prompt the user after import that further steps are necessary to enable the alerts and their related connectors. |
I'm not a fan of exporting the secrets. It's basically a back-door to exfiltrate them. Convince an admin to export the actions, the admin not realizing they contain secrets. Kinda thing. I wonder how hard it would be to allow connectors with required secrets to be imported WITHOUT them. I think we'd need to change all the secret fields to |
The How do you envision showing users that they need to fix a connector before it can be used? I was thinking the enable / disable connector feature could work for this where the fields would have to be entered before enabling the connector somehow and the connectors list could filter on these. Or maybe that logic is handled when enabling the alert? |
One option would to use Using Also remember, we can disable action types via config (and I think some other ways?), so that "is an action enabled" gets a little more complicated / confusing to the customer. But at least it's still a "single concept", vs having a separate, kinda weird thing about "this action was imported so not usable yet". Next question, can we hook the export to set this field to I also wonder how discoverable this will be. It's really the connector, so I think you wouldn't want to be able to add a new action to an alert with a disabled connector - we can add some badge to the connector indicating it's disabled. But what about editing alerts with existing actions whose connectors are disabled? Is the action editable? Maybe just a banner in the action edit form indicating the connector is disabled, with a link to go right to it's editor? |
100% in agreement regarding this. We have disabled via config and disabled via license, there's some UX in the alerts view for this already and it could be "free" for the new disabled feature (I don't recall exactly how the UX goes, some may prevent saving the alert with disabled by license connectors).
If we are looking at building our own import / export API due to RBAC limitations, we'll have full control over this flow :)
Good questions, I think these will be good discussions. These seem answerable if this becomes the overall import / export approach. And I think it would work for a minor release (pre 8.0). |
Below is a summary of what I believe is needed to achieve import / export in a 7.x release based on the conversations above. The following is based on integrating and leveraging saved objects management UIs and APIs for import / export (#82027). NOTE: Saved objects management displays all the saved objects in the system regardless of user feature privileges. 1. Ability to specify custom id for alerts and actions #50210Since the encrypted saved objects (ESO) plugin doesn't allow specifying custom IDs (see here) and the saved objects management allows overwriting on import, we'll need to support such scenario. We should verify that this step is needed and coordinate with the Kibana Security team to revive #42762. The work specific to the alerting APIs to support this could be split into a follow up issue or done at the same time. 2. Ability to enable / disable connectorsA new feature that could be useful to users who want to stop all executions of a connector. This is similar to using The usage of this for import / export would be to export all the connectors as disabled and without 3. Integrate alerts and connectors to saved objects management #82027This would be an effort shared with the platform team to have alerts and connectors available in the saved objects management UIs. In the future, we can leverage copy to space and share across spaces feature (and/or integrate within our UIs). For import / export to work, we will need custom logic to export alerts and connectors. Both would "disable" the alert / connector on export. The removal of secrets should already be done by the find API ESO wrapper. |
@ymao1 keep me honest 🙂 @jasonrhodes in this scenario, I think the user will be made aware the rules already exist and ask if they wish to overwrite them or create duplicates. There may be the option for the user to ask for new IDs on import, at that point we wouldn't be able to detect if there are duplicates afterwards.
@smith at this time no, we've been cautious about breaking the saying that "once secrets are stored in Kibana, we don't expose them to users afterwards". We've been thinking about breaking that saying here but have not found a valid reason to break the behaviour, especially not in a minor release.
@jasonrhodes is it right to assume the work in those issues will be completed in 7.14 / 7.15? I'm asking to ensure we have a way for users to move their customized stack monitoring rules from one environment to another by 7.16. |
@mikecote Unfortunately, this is not the case. Since stack monitoring rules are autocreated without specifying a static _id, it is very likely (pretty much guaranteed) that the auto-created stack monitoring rules in Kibana A have different _ids than the auto-created stack monitoring rules in Kibana B, so importing from A -> B will not provide that "overwrite or create duplicates" popup. What could happen is if stack monitoring rules are imported from A -> B before the stack monitoring rules are autocreated in Kibana B. Then the first time user visits stack monitoring in Kibana B, the auto-creation should be skipped because there are already (imported) rules of the stack monitoring types in B. |
Ohh that makes total sense, I didn't think about that. I withdraw that comment 🙈 |
@mikecote 7.14, no. 7.15, very hard to say. @ravikesarwani this is another thing driving the need to align SM alerts. This one is tricky because we probably have to solve most of the tickets in this meta ticket/epic before this will work without causing problems. cc: @sgrodzicki / @paulb-elastic |
FYI @mukeshelastic for awareness. |
@jasonrhodes if it's not 7.15, is it 7.16 or 8.x? We are trying to decide what to do with the import/export for edge cases and have two options that require time:
@spong we have planned to work on supporting customization of |
Yup! Supporting references (#87992) is the only dependency we're tracking at the moment. With that change we'll be able to update rules to reference any related exception lists and better manage the import/export flow (along with perf enhancements around the Exceptions Table and bulk export (#85173)). That said, and as I see was discussed a bit above, we still need to determine how we're going to support the export/import of actions. If a user has 500 rules in their cluster, each with their own exception list/value list, and custom action, we have the means of restoring the rules, will work a solution for bulk import of exceptions, but don't currently have a method for backing up/restoring actions (or the ability to bulk assign actions, which could be a suitable substitution). Are actions still planned as part of this effort, or just focusing on rules/connectors for the time being? |
@mikecote totally understand, I'll leave my opinion here and let @mukeshelastic and @ravikesarwani weigh in as well. I think your option (2) is the right option, and that I don't see us having bandwidth to build a custom import/export system for SM rules anyway. That said, I don't think we need to push our timeline problems onto you, either. There may need to be a way to exclude certain rules from the import/export flow temporarily, and the result would be "Stack Monitoring rules are not importable/exportable at this time, please visit the UI in your new cluster to recreate your rules". None of them have that much customizability options, so I don't think this would be a massive problem. I do think we have a chance of getting our alerts aligned by the time you make this live in 7.x, but I definitely can't guarantee it, and weighed against the other things we are trying to deliver, making sure we avoid the slightly unfortunate problem I describe above sounds like a very low priority, relatively, from the Stack Monitoring perspective. |
@spong rule actions are currently stored as SO references (referencing the connector that is backing the action) within the rule saved object, so when a rule is exported through the SO management UI with |
Perfect, that's exactly what I was curious about. So users will be able to backup all their actions via connectors, so on the security side we'll just need to ensure the security rules maintain this reference as well so they can be re-associated on import. Thank you @ymao1! 🙂 |
@spong Just to make sure we're on the same page: Also, please note that connectors will be exported without their |
My apologies, meant |
@spong Gotcha. Thanks for the clarification! |
Awesome, this is good to know!
With this part, I believe @ymao1 covered this but wanted to make sure. I believe you mentioned that your actions are stored as separate saved-objects? If so, you'd just need to add the reference to them in the rule (just like exceptions and value list). @ymao1 is there a change needed on downstream/referenced saved-object types to include themselves in the export? or are they included automatically without that saved-object type marking itself exportable?
I've seen a lot of user requests to be able to modify these SM rules and we've shown where to go for this. Users can modify things like rule actions? If so, they can customize anything they want there and wouldn't have an easy way to transfer that (they would have to go through each rule and re-write their customizations and templates for each rule action).
Based on this, I'll assume you are ok with the user experience risk that I stated above and we'll go ahead and talk to @elastic/kibana-core team to explore options of excluding SM rules from export (cc @ymao1). |
Let's continue the discussion about this in #99680 then. There are a lot of implications that need to be discussed. |
@mikecote @spong Any downstream saved object types will need to be marked as importable and exportable to be exported through the SO management UI. This has been done for connectors, so rules that contain a connector ( |
Yeah, I don't think we have any other option, unfortunately. As I said, we hope we get this sorted before then, but if not, this will have to be the fallback. cc: @ravikesarwani / @mukeshelastic / @sgrodzicki / @paulb-elastic for visibility. |
As we are carrying this Epic over from 7.14 to 7.15 I have updated the candidate labels. This is in order to enable the work needed for the two remaining issues that enable Import/Export in Security Solution and Stack Management. |
This issue summarizes the steps required to implement the import and export of rules and connectors in order to support the impending removal of legacy multi-tenancy. Import and export will occur from the saved object management page, so for this issue, we will not be enforcing RBAC restrictions on the rules and connectors. This will not preclude us from moving this functionality to the rule management page in the future and adding RBAC restrictions.
The proposed workflow will be to export and import rules and connectors in a disabled state, with any api key or secrets information nullified. After import, it will be up to the user to re-enable rules and connectors, with UX to prompt them to enter any required secrets for connectors.
Implementation steps
1. Add concept of disabled connectors
2. Import/export of rules from saved objects management page
2021/05/13 Update
There is currently a bug with the SO export process that prevents connectors from being exported correctly when they are exported as part of a rule reference:
2021/07/01 Update
Import/export of rules and connectors has been merged into 7.14, with the caveat that security and stack monitoring rules are excluded from the export. We have the following issues to track the progress of aligning security and stack monitoring rule export with the framework export:
The text was updated successfully, but these errors were encountered: