Add access monitoring rules cache and tctl interactions#40218
Add access monitoring rules cache and tctl interactions#40218EdwardDowling merged 21 commits intomasterfrom
Conversation
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
marcoandredinis
left a comment
There was a problem hiding this comment.
Can we also please add tests to tctl?
It seems we don't support tctl create -f operation (aka upsert)
Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>
Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com>
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
1 similar comment
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
|
i was trying to test this out in my web UI i'm currently working on, and noticed something odd. when i |
The cache must not be set up properly, will fix this now and add some more tests. |
@kimlisa |
|
@rosstimothy Can't seem to figure out the issue mentioned above. It doesn't happen when creating and listing via tctl or when creating via tctl and listing from the ui changes mentioned. Only when both creating and listing from the ui. Can you take a look so we know if these changes are safe to merge or if that bug is due to these? |
|
i have a update: in the web UI, if i create this is the resource that gets returned when i create through the web UI yaml editor, note that this is the resource that is not created with yaml and that does not get registered in the cache (unless you restart), note that i can create a resource without a sure I can put these validation in the client, but shouldn't we be checking them in the auth layer (as like a central place to check for errors)? (we have other clients like teleterm that may have to repeat the validation otherwise) while we are on topic of validation, we also need to do the following:
i propose to merge this PR as is, and create a separate PR to address backend validation? also, i noticed the |
That sounds good to me. |
|
@EdwardDowling The problem lies in the following lines in the storage layer. https://github.com/gravitational/teleport/blob/master/lib/services/local/access_monitoring_rules.go#L77 The access monitoring rule object does not implement CheckAndSetDefaults which results in that line being a noop. Let's follow the mechanism that the notifications resource use to set server side generated and static fields and validate user provided fields: https://github.com/gravitational/teleport/blob/master/lib/services/local/notifications.go#L127-L155. |
|
@EdwardDowling See the table below for backport results.
|
* Add access monitoring rules cache and tctl interactions * Swap access monitoring rules collections to use upsert * Update accessmonitoringrules cache test * Readd missing err check * Update lib/auth/grpcserver.go Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com> * Update lib/auth/grpcserver.go Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com> * Update tool/tctl/common/resource_command.go Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com> * Add tctl isForced behaviour for access monitoring rules * Add missing methods to cache interface for access monitoring rules * Add info messages to tctl commands for accessmonitoring rule edits * Add missing user message for forced rule creation * Appease linter --------- Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com> Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
* Add access monitoring rules cache and tctl interactions (#40218) * Add access monitoring rules cache and tctl interactions * Swap access monitoring rules collections to use upsert * Update accessmonitoringrules cache test * Readd missing err check * Update lib/auth/grpcserver.go Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com> * Update lib/auth/grpcserver.go Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com> * Update tool/tctl/common/resource_command.go Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com> * Add tctl isForced behaviour for access monitoring rules * Add missing methods to cache interface for access monitoring rules * Add info messages to tctl commands for accessmonitoring rule edits * Add missing user message for forced rule creation * Appease linter --------- Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com> Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com> * Fix issues with rebase * Remove unused import --------- Co-authored-by: Marco André Dinis <marco.dinis@goteleport.com> Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
This Pr registers the access monitoring rules service, adds it to the cache, and adds the tctl resource commands for the new resource.
part of 3123
changelog: Add ability to manage access monitoring rules via tctl