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

[Fleet] Remove superuser requirement to access Fleet #108252

Closed
29 tasks done
mostlyjason opened this issue Aug 11, 2021 · 14 comments · Fixed by #122347
Closed
29 tasks done

[Fleet] Remove superuser requirement to access Fleet #108252

mostlyjason opened this issue Aug 11, 2021 · 14 comments · Fixed by #122347
Assignees
Labels
Team:Fleet Team label for Observability Data Collection Fleet team v8.1.0

Comments

@mostlyjason
Copy link
Contributor

mostlyjason commented Aug 11, 2021

One blocker for many users using Fleet and Integrations is the requirement for the superuser role. This requires users to have broad permissions in order to use Fleet and Integrations which is a security problem. We should remove this requirement and rely on users having the Kibana privilege to access "Fleet and Integrations" (potentially with a built-in role).

Blockers:

Implementation scope

UX changes

For all disabled buttons, a tooltip should also be added that indicates the user needs additional permissions. An example:
image

  • Make UI adjustments for when user has "All" Fleet but "None" for integrations

    • Add blocking UI in Fleet app: image
  • Make UI adjustments for when user has "All" Fleet but only "Read" for integrations

    • Prevent users from adding integrations
    • Disable "Add integration" button on agent policy detail view
      image
    • Disable "Add " button CTA on integration detail view
      image
    • Prevent users from updating integrations
      • Hide settings tab of integration detail view
      • Disable "Upgrade" button on integration policy table on "Policies" tab of integration detail view
        image
      • Disable "Upgrade" button on integration policy table on agent policy detail view
        image
      • Action buttons on agent policies table allow the user to add, remove and upgrade integrations, so all the options in them should be disabled. It was decided to completely hide these actions.
    • Prevent users from removing integration policies
      • Disable "Delete integration" item on integration policy table of "Policies" tab of integration detail view
        image
      • Disable "Delete integration" item on integration policy table on agent policy detail view
        image
    • Prevent users from reading or writing global integration settings
      • Hide the "advanced" tab from integration detail view
        image
  • When end users and kibana_system try to set up fleet server and they don't already have a fleet server set up:
    - [x] app/fleet/agents should show this callout:
    Screenshot 2022-02-02 at 16 00 39
    - [x] In the Add agents fly out, under Enroll Fleet tab, the same message should be displayed
    - [x] if these users have already a fleet server these two areas should stay the same

Notes

Preserving BWC with users granted access to Integrations app in 7.16

This is required to avoid breaking read access to Integrations since we allowed users with "read" to this privilege
to be able to view the integrations app even if they did not have superuser, starting in 7.16. Since there is no
existing mechanism to update the privileges stored in existing user roles, we should be careful change the privilege id
field in a way that won't break these existing roles:

  • We should rename (change the name property) the existing combined privilege with the id: 'fleet' to
    Integrations and use this privilege to drive access to Integrations going forward. The id should not change.
  • The privilege we add for Fleet should have the id: 'fleetv2'.
  • In the future we can migrate the above, but no such ability exists today. We'll consider this technical debt for now
    and hide this detail behind the FleetAuthz abstraction.
@mostlyjason mostlyjason added the Team:Fleet Team label for Observability Data Collection Fleet team label Aug 11, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@joshdover
Copy link
Contributor

joshdover commented Jan 6, 2022

@mostlyjason @dborodyansky I've updated the issue description to note all of the small UI elements that need to be adjusted when the user does not have access to appropriate actions. Currently I'm proposing that we simply disable each element, but I do wonder if we should do something more to explain why the button is disabled.

For the buttons, I think we can do the same thing that we're doing on the "Add " integration CTA:

image

However for the dropdown menus, I wonder if a tooltip is even possible or could be confusing. Any suggestions here? For example, we need to prevent the user from clicking "Delete integration" here:

image

@dborodyansky
Copy link
Contributor

@joshdover Does the privilege limitation apply only to "delete", not "edit". If both, then hiding the [...] menu entirely would be expected.

@joshdover
Copy link
Contributor

joshdover commented Jan 6, 2022

@joshdover Does the privilege limitation apply only to "delete", not "edit". If both, then hiding the [...] menu entirely would be expected.

Good point on that one, agreed we should hide the entire list, bad example on my part. How about this one where the "Add Agent" option will be available? Note that when there are already agents enrolled, the other "Add Agent" CTA button is not visible.

image

@dborodyansky
Copy link
Contributor

How about this one where the "Add Agent" option will be available?

Hiding unavailable actions within the menu seems appropriate in this case. There are some guidelines in the works which recommend hiding controls within tables for which a user may not have privileges.

@dikshachauhan-qasource
Copy link

Hi @jen-huang @joshdover

We have performed testing today around this feature and found two below bugs.

Further, we are in progress of test content creation for this ticket at TestRail and will share links for test cases created by tomorrow.

Thanks
QAS

@dikshachauhan-qasource
Copy link

dikshachauhan-qasource commented Feb 23, 2022

Hi @mostlyjason

We have created below 17 test cases for this feature ticket at Testrail:

Further, I have one query for last UI change:

When end users and kibana_system try to set up fleet server and they don't already have a fleet server set up:
- [x] app/fleet/agents should show this callout:
  • How this will work at Cloud for non-super user when Integration server section is excluded while creating deployments.
    Currently it shows "Edit deployment page" to both users: Non-super user & Super user. Is it expected.

Thanks
QAS

@joshdover
Copy link
Contributor

  • Currently it shows "Edit deployment page" to both users: Non-super user & Super user. Is it expected.

We should probably hide this as non-superusers may not have access to the Cloud console, but I also know that is changing recently with the addition of more user roles on Cloud. @mostlyjason we could probably use your input here.

@mostlyjason
Copy link
Contributor Author

mostlyjason commented Feb 23, 2022

I think we should show it to both since we don't know whether the signed in user in kibana has access to the cloud console or not. It doesn't matter if they are a superuser in Kibana since Elastic Cloud has separate privileges. If they sign into Elasticsearch directly using user/pass or SSO, they may not be signed into Elastic Cloud. After the link they can sign in with Elastic Cloud if needed or ask a cloud admin for help.

@dikshachauhan-qasource
Copy link

Hi All

We have executed below feature run, on this PR at testrail for created testcases:

We will retest the failed testcases on BC4 and add the results once, reported issues are fixed.

Thanks
QAS

@zez3
Copy link

zez3 commented Mar 11, 2022

This does not seem to work in 8.1 on my deployment.

I get wrong permissions
image
and
do I really need to give all spaces to my limited users?
image

@joshdover
Copy link
Contributor

@zez3 Fleet does not currently support Spaces so to make this explicit, we require that when you grant access to Fleet, you do so across all Spaces. This does not mean that you need to give access to all features across all Spaces, only for Fleet.

In the screenshot above, you have not granted access to Fleet, it's still checked as None on the right. You will also need to grant access to Integrations. It should look like this:

image

@zez3
Copy link

zez3 commented Mar 15, 2022

@joshdover

@zez3 Fleet does not currently support Spaces so to make this explicit, we require that when you grant access to Fleet, you do so across all Spaces. This does not mean that you need to give access to all features across all Spaces, only for Fleet.

I understand this and would accept this workaround but...

In the screenshot above, you have not granted access to Fleet, it's still checked as None on the right.

the None(ViewOnly) is read only("feature_fleet.read"), I saw(#125836) an open issue for renaming this to Read.

I don't need nor want to allow write (All) permission to my users. I need for them to see that the agent that they just installed is alive and it has a policy assigned.
Ideally only the ones that belong to them. I am currently using the namespaces in index name in roles to enforce that.
image

here are my current permisions
{
  "MYSPACE" : {
    "cluster" : [ ],
    "indices" : [
      {
        "names" : [
          "logs-mylogs*"
        ],
        "privileges" : [
          "read",
          "read_cross_cluster",
          "view_index_metadata",
          "index"
        ],
        "field_security" : {
          "grant" : [
            "*"
          ],
          "except" : [ ]
        },
        "query" : """ {"match_phrase": {"match_my_phrase"}}""",
        "allow_restricted_indices" : false
      }
    ],
    "applications" : [
      {
        "application" : "kibana-.kibana",
        "privileges" : [
          "feature_canvas.all",
          "feature_maps.all",
          "feature_ml.read",
          "feature_graph.all",
          "feature_visualize.all",
          "feature_dashboard.minimal_all",
          "feature_dashboard.url_create",
          "feature_dashboard.store_search_session",
          "feature_discover.minimal_all",
          "feature_discover.url_create",
          "feature_discover.store_search_session",
          "feature_logs.read",
          "feature_infrastructure.read",
          "feature_apm.read",
          "feature_uptime.read",
          "feature_observabilityCases.read",
          "feature_fleet.read",
          "feature_stackAlerts.all",
          "feature_actions.all",
          "feature_siem.read",
          "feature_advancedSettings.read",
          "feature_indexPatterns.read",
          "feature_savedObjectsTagging.read",
          "feature_savedObjectsManagement.all"
        ],
        "resources" : [
          "space:*"
        ]
      }
    ],
    "run_as" : [ ],
    "metadata" : { },
    "transient_metadata" : {
      "enabled" : true
    }
  }
}

The Integrations looks good as read-only.

@joshdover
Copy link
Contributor

the None is read only("feature_fleet.read"), I saw(cannot find it now) an open issue for renaming this to Read.

I don't need nor want to allow write (All) permission to my users. I need for them to see that the agent that they just installed is alive and it has a policy assigned.

Got it, thanks for explaining what you're looking for. We do not yet support a read-only mode for Fleet, that is a separate feature that we are prioritizing (we don't have a public tracking issue for this right now).

You are right that the privilege name shows up as feature_fleet.read when you select "Read" for the Integrations privilege. This is less than ideal, but a shortcut we had to take to avoid a breaking change for now. So privileges named as "Integrations" in the UI are actually stored in the role on the API as "fleet" while privileges named as "Fleet" in the UI are stored as "fleetv2". This is working as expected for now and is something we'll clean up in the future.

So to summarize:

  • You can grant a user "Read" or "All" access to Integrations in 8.1+ and this will show up in the API as feature_fleet.read or feature_fleet.all but it actually is used for Integrations and not for Fleet
  • You can grant a user "All" access to Fleet in 8.1+ and this will show up in the API as feature_fleetv2.all. We do not yet support read-only access to Fleet, but we plan to in a future release.
  • In 8.1, users no longer have to have the superuser role in order to access the Fleet app, and instead can access the app if they are granted the "All" privilege for Fleet (feature_fleetv2.all). This is an improvement over prior releases where granting access to the "Fleet & Integrations" privilege was not sufficient to use the Fleet app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Team label for Observability Data Collection Fleet team v8.1.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants