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] Allow Kibana system user to read and write to Fleet server indices #67726

Conversation

nchaulet
Copy link
Member

@nchaulet nchaulet commented Jan 19, 2021

Description

To allow to migrate from Kibana saved object to new indices for Fleet server we need to add read and write permissions to the following indices:

  • .fleet-agents
  • .fleet-actions
  • .fleet-actions-results
  • .fleet-enrollment-api-keys
  • .fleet-policies
  • .fleet-servers

The indices will be created via an integration package with the current user permissions.

Related to elastic/kibana#87372

@nchaulet nchaulet self-assigned this Jan 19, 2021
@nchaulet nchaulet added the :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC label Jan 19, 2021
@elasticmachine elasticmachine added the Team:Security Meta label for security team label Jan 19, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@nchaulet nchaulet force-pushed the feature-allow-kibana-system-user-read-write-fleet-server-indices branch from ddda8b7 to 7719096 Compare January 19, 2021 19:13
Copy link
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Lets make sure we specify the minimal permissions needed.

@scunningham Would be good to get your eyes on this one too.

// Fleet Server indices Kibana read and write to these indices to manage Elastic Agents
RoleDescriptor.IndicesPrivileges.builder()
.indices(".fleet-agents")
.privileges("read", "write").build(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Does Kibana need write permissions for the agents?

Copy link
Member Author

@nchaulet nchaulet Jan 20, 2021

Choose a reason for hiding this comment

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

Yes right now if we want to reassign an agent to a new policy, force unenroll, we do it by writing to .fleet-agents

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to use the doc line 158 to also mention why a specific access is needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was hoping for a bit more details and have comments on all the lines. For example that write permissions are need to force unenroll etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just updated with more a per indice comment 👍

@nchaulet nchaulet force-pushed the feature-allow-kibana-system-user-read-write-fleet-server-indices branch from 094d3ed to a9e1003 Compare January 20, 2021 13:51
Copy link
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Would be good to get a check on this also from @blakerouse @aleksmaus @scunningham as this is pretty fundamental to all we do.

Are these all indices or do we also have data streams?

Copy link

@scunningham scunningham left a comment

Choose a reason for hiding this comment

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

This looks correct. Is there a way to specify append only for .fleet-actions? Or is "write" the only option we have?

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

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

Permission levels look correct, I think this is the lowest permissions that will be needed.

.privileges("read", "write").build(),
// Kibana write to this indice new enrollment api key
RoleDescriptor.IndicesPrivileges.builder()
.indices(".fleet-enrollment-api-keys")
Copy link
Contributor

Choose a reason for hiding this comment

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

TLDR: If there are Kibana authz checks that can be bypassed by directly reading the enrollment api keys index, I suggest we make it a restricted index. This might be the case for the other fleet indices as well.


Users that have read access to all indices, eg:

POST /_security/role/read_all_indices
{
  "indices": [
    {
      "names": [ "*" ],
      "privileges": ["all"]
    }
  ]
}

can access dot-named indices (which are implicitly hidden) using the index name or, in the case of wildcards, with a request option.

For indices that contain sensitive data (more than just configuration data or raw-metrics, which is a nuisance to expose but is not equivalent to bypassing any other checks we have in place) we have an extra protection level, named restricted indices. The restricted indices concept is most likely to become superseded by system indices, but this is what we have and use currently.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was not aware of restricted indices @ruflin @blakerouse @aleksmaus do you think this will work for us. The mapping of this indices will be created with a regular user using an integration package.

Copy link
Contributor

Choose a reason for hiding this comment

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

Was also not aware of restricted indices concept. @scunningham @jaymode One more option ... ?

Copy link
Contributor

Choose a reason for hiding this comment

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

To maybe make it more clear what I mean, restricted indices confer addition protection by requiring explicit toggling of a flag when defining index permissions in a role, and relies on the expectation that roles in general don't have this flag toggled. Importantly, .kibana* is not a restricted index (but .security* is) which means that roles don't require the "hidden" flag toggled to grant access to it. Besides kibana there are other indices (think ML) that maybe should deserve more protection.

The fact that this is a new index and that it contains credentials prompted my suggestion.

But restricted indices is no silver bullet, we can just simply document non-fleet-admin users should not be granted privileges over these indices.

Copy link
Member

Choose a reason for hiding this comment

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

@ruflin sorry I have not had a chance to communicate this, but restricted indices will be used for external system indices. @tvernum and I discussed this on the external system indices doc and then again last week. I'll begin working on implementing external system indices soon :)

Copy link
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

LGTM from my end. Getting this in should unblock us on the Kibana side. But we should continue the conversation if there are alternative options we should look at.

Copy link
Contributor

@albertzaharovits albertzaharovits left a comment

Choose a reason for hiding this comment

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

LGTM Irrespective of the decision on restricted indices.

@nchaulet nchaulet merged commit 833b910 into elastic:master Jan 21, 2021
@nchaulet nchaulet deleted the feature-allow-kibana-system-user-read-write-fleet-server-indices branch January 21, 2021 18:15
nchaulet added a commit that referenced this pull request Jan 21, 2021
…dices (#67726) (#67838)

To allow to migrate from Kibana saved object to new indices for Fleet server we need to add `read` and `write` permissions to the following indices:
* `.fleet-agents`
* `.fleet-actions`
* `.fleet-actions-results`
* `.fleet-enrollment-api-keys`
* `.fleet-policies`
* `.fleet-servers`

The indices will be created via an integration package with the current user permissions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Security Meta label for security team v7.12.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants