-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Beats: Proposals For More Restrictive Privileges #10241
Comments
+1 for changing For reference here's a link to the relevant docs: https://www.elastic.co/guide/en/beats/filebeat/current/beats-basic-auth.html# |
Something else I was worrying about =>Only Filebeat actually needs 'manage_ingest pipelines' cluster privilege correct? But that privileges could possible allow an insider threats to update any ingest pipeline resulting in all kinds of unwanted situations. Thoughts? Is there a way to avoid the need to assign the 'manage_ingest pipelines' to all Filebeat users? Could we, like Morris suggest, create 1 setup Filebeat on a trusted server with 'manage_ingest pipelines' and assign a Filebeat user without 'manage_ingest pipelines' to all other servers? |
You can already do that by using the We will also need to think the privileges in the context of ILM because to create them require to use a |
I wonder if we're being too prescriptive in our docs by providing step-by-step instructions to create specific users and roles for Beats. Maybe we just need to list the features or actions that require specific privileges, and leave it up to whoever is setting up security for their org to decide which users/roles to create. Our docs make it very easy to set up security quickly, but it sounds like the roles we tell users to create might not be restrictive enough. I'd like to get this fixed in the docs. I've been kicking this can down the road for quite awhile. |
Can we distill this conversation into a list of roles that we want to recommend to users and the privileges that each role should have? I'd like to clean up the docs, but want to make sure we have agreement here. Do we need to meet to discuss? |
The following comments were offered by @urso during a discussion about a related pull request: https://github.com/elastic/beats/pull/10449/files#r255850589. Since that PR has already been merged, I want to make sure his comments get preserved and addressed. Full text of the comment: Well, in the end it is up to the user to see if they want separate roles or users. ES has a builtin beats_system role and user, but this one is used for monitoring only. Users are not advised to reuse beats_system for more than monitoring. I'd prefer not to document actual roles in the first place, but the different means how (and when) Beats interact with the Elastic Stack. Interactions roughly encompass:
At optimum these roles are separated and setup is executed only once and fully independent from actually running a Beat. If setup is not executed in isolation we need privileges for "publish events" and "setup" to be owned by the same user. Depending on the Beat, setup can actually entail different tasks (well, to date only filebeat is the exception).
TBH. I'm not sure Writer requires:
In the end this indeed calls for |
Based on the comments submitted by @ urso ^^, I propose the following changes to the existing content:
The information should be in reference format--easy to scan--and point to the Stack security docs for more information about setting up security. The goal here is to give users just the info they need to implement a security strategy that works for their org. If that sounds good with everyone, I will start working on the docs. I think I'll need help getting the full list of the most restrictive privileges for each task. |
Why is it again suggested to give write permissions, while index should be sufficient? That was actually the main reason I created the original case... |
@karenzone (note to self): Good stuff here! Consider a similar approach for Logstash per DeDe's suggestion. |
@willemdh I was just pasting in the response from a related PR to make sure the comments aren't lost. Rest assured that I will make sure the docs reflect the most restrictive privileges required. |
I am reopening this proposal on behalf of the customer for whom I initially opened it 6 months ago. Customer has now migrated his clusters to 7.2.0, and he is horrified at the required privileges now required for Beats users. Basically the entire result of this exercise has been that more privilges are required of Beats users in 7.2.0, not less, and the resulting implications for security are exactly the opposite of what customer was hoping for. Example comments:
And frankly, I believe customer has a point. And most of the additional privileges are required only for ILM. Perhaps we can rethink this? |
I was very happy to see that Elastic were now providing SIEM capabilities – out of the box – but for the reasons above, we will not be able to proceed. Endpoints should not be able to read/modify any data server side, only submit it. |
@MorrieAtElastic I think you meant to re-open this issue, no? I've pinged @urso for a response from the development team. I think I've resolved the doc-related problem (the docs now show the privileges required for specific user tasks), but in the process I've exposed some areas where we need to improve our security strategy. |
The documentation splits up the privileges into multiple needs:
When using Beats I like to split the process into 2 phases. First the setup phase, then the data collection phase. Each requires a different set of credentials. The initial setup privileges are only required for the first phase. Thereafter never again. Hence I'd recommend to have 2 users. One admin user preparing the stack and one beats user for publishing events. Actually one could add another user for publishing monitoring data only. Having multiple users will allow us to grant the least required privileges per user/scenario. The admin user will be used for the setup phase only. Assuming we have installed filebeat via a debian package, want to reuse the configuration file, but overwrite user settings without having to change the configuration file for setup only we can run: Once the stack is prepared, we can run Beats with a reduced set of privileges. Without ILM Beats will need to create indices daily. Which means we need the
With ILM we use a write alias. In presence of ILM, it is Elasticsearch creating new indices. The privileges for the rollover process in Elasticsearch should be based on the user/role that used to prepare ILM. Here again we have the 3 options:
Without ILM I'm in favor of option 2 ( |
Chatting with @tvernum we should not use |
Exactly what I'm trying to say since 22/01... Also Please do not require 'manage' privilege on *beat indices... Also for Filebeat requiring "manage_pipeline" on cluster level is not really optimal... Imho pipelines should be managed from Kibana and never from agent / client side. A simple gui with a way to import 'official ingest pipelines' would be so much better (Same for dashboard management)? But if I read @urso 's post correctly, it should be already possible to make ilm work without manage privilege? (Actually tried this and didn't immediately got it to work, but I had too many other upgrade issues to dedicate enough time to investigate properly, so for now I disabled ilm for all beats indices) |
@urso Not sure if there is an underlying bug at play here, but when I I try the setup you describe--an admin user with all required privileges that sets up the beat (index template, dashboards, index management, etc) and a different user with
I also get the following error (even when
Can you try to reproduce this issue to see if it's a bug? |
@dedemorton Thanks for testing. I will run some more tests and share my configs if successfull. If it doesn't work with minimal privileges, then I'd consider this a bug. |
Sorry to jump in here, but I've done some testing since this has come up in discuss. @dedemorton You can make the first error go away by setting the more restrictive The second error seems more complicated. In the code, it looks like there are a number of places where we are loading pipelines but not guarding for To answer the question in the forum I've done testing on which privileges are required with the default Beats configuration (ILM enabled, etc.). I started with a user with no privileges, and slowly added more every time I ran into an error. The goal was to come up with what a Setup (beats_setup)
4 is a real shame, unfortunately, Run (beats_write)
There are no built-in roles at the moment that have these privilege combinations. I think it would be useful to add them. At least to document what is required. |
|
I did some more testing with filebeat and identified a few possible roles, which are to be used based on configs and the actual scenario. So other can play with it, I did prepare a gist with some configs, docker-compose file, and kibana console script to load the different roles and users. Dedicated role types I created are:
Note: beats_writer adds "read_ilm", and "manage_index_templates" to the beats_indexer role. Depending on organization and beats ownership, I would create per Beat roles in production, and then assign the correct roles to users. Introducing scripts to build those, would also make it easier to create a similar experience for community Beats throughout an organization. Based on these roles I did test a few scenarios: Scenario 1: Separate setup + indexing users. With ILM and mostly default settings
=> 2 users: a) admin user with beats_setup role, and b) writer user with beats_writer role Scenario 2: Separate setup + indexing users. With ILM, but 'trimmed down' beats configs. No template setup, and no ILM policy setup. The Beat still checks for the existance of the write alias. Beats settings:
=> 2 users: a) admin user with beats_setup role, and b) writer user with beats_indexer role Scenario 3: Separate setup + indexing, but with ILM disabled.
=> 2 users: a) admin user with beats_setup role, b) writer with beats_index_writer role Note: The writer has permissions to manage templates and create indices. Scenario 4: Self managed single user with ILM, potentially not running
=> 1 user with beats_setup and beats_indexer roles Scenario 5: Self managed single user without ILM, potentially not running
=> 1 user with beats_index_writer role Note: Scenario 5 is similar to 3, but without the setup call. The |
@urso I like the idea of automating this somehow. It's a lot to expect readers to parse the various combinations that you show above, and the naming doesn't seem very intuitive. Could we do some kind of online tool (like elasticsearch-setup-password, but with more functionality)? Instead of just setting passwords, the tool could walk users through a series of questions: Are you using index lifecycle management...central management...machine learning...index pattern...etc... After gathering the necessary info, the script could show some kind of confirmation of the users/roles being created, then create the users/roles and maybe allow the person running the tool to set the initial password. |
I think we should not force new users to learn what ILM, ML, templates, aliases, and the 30+ different privileges are before getting started with Beats securely. Being secure should be easy and as out of the box as possible. If we had two built-in users and/or roles - one for setup, one for writing/appending - the instructions would be very simple: Run setup once with this user/role, then run all Beats on all your machines with this other user/role. Looking at @urso's list, the two users/roles covering all scenarios would have these privileges:
These users/roles would not just be useful to Beats either, but to all tools ingesting data (e.g. Logstash), and so could have generic names, e.g. something like |
I totally agree! But if we do provide scripts in the interim, let's make them as easy to use as possible. |
I've updated the docs (see #12921), but there are some remaining issues that the docs cannot solve. Should I create separate tickets for these issues?
|
I'm not a fan of the idea about a predefined |
@urso if a user runs non-standard configurations would they be surprised to need to extra work here? Seems like a reasonable ask of the user. |
@elastic/es-security Maybe Elasticsearch security team can chime in as well? If we were to prepare an What makes me a little uneasy about that user is the |
They are identical. Two separate PRs added them at almost the same time during the addition on ingest node in the 5.0 release. We will deprecate one.
No, builtin roles cannot be modified by the user (they are defined in code, there is no update API for them). We have thrown around the idea of a templated role so that you could somehow (we've never gotten to the point of working out details) apply a "filebeat-ingest" role-template to a custom index. An alternative would be to define product specific privilege names. We haven't done so in the past, but it's open for discussion.
We're likely to be looking at tighter control over those sorts of cluster objects soon. We can push this use case up to the top priority. |
I think this is a general problem? Even if scoped to an index pattern, a Beat could disable indexing from all other Beats writing to the same index pattern. I wonder if we could do without this privilege for writing? However, we could use |
When I was working through using RBAC for Filebeat I ran with the recommended (from the docs) role for the setup user and setup ran fine. I then used the recommended writer role to run Filebeat to collect logs. Without the manage_index_template priv the Beat failed, so I added it in and created issue #13207 Is there a plan to remove the need for manage_index_template? Either way, could we get the docs updated to include manage_index_template until it is no longer needed? If the plan is to have users restrict the writer user with:
then could this be reworded from "you can ..." to "Add these lines to When I am reading the docs I ignore optional stuff until I get things working, and then I go back if I remember. In this case what I thought was optional stuff is not optional, right? |
And if you like, I am happy to write the PR to modify |
@DanRoscigno That's a good point. I'll make the info an actual step so that users don't overlook it. It's very tricky to document the list of required privileges when that list varies depending on which options users have set in the config. IMO it's not a great user experience. |
An update on this: After some small changes scheduled to be released in 7.5 (incl. #13847, #13848, #13936) it will be possible to send data from a Beat with only two privileges:
This assumes:
This should allow running Beats with minimal, read-only privileges in most situations. The master docs have been updated to reflect this. |
@tvernum |
@cwurm Absolutely. We won't be able to squeeze it into 7.5, but it's a small enough change that we should get it into a 7.x soon. This had been listed on our meta-issue for new privileges, but I've opened an explicit issue to track it. |
Hey, you peeps, while working on this, ever notice Elasticsearch stopping *beat with
|
Hi @joaociocca , what do you have for Here is the info on the proper role and user for writing data (for 7.7, change to the version of Metricbeat you are using as the role has changed recently). Open a discuss.elastic.co conversation and @ mention me if you need more help. |
I have the same issues as @dedemorton, we use a separate user for running
I tried several things, but for the life of can't get it to run without pipeline related permissions:
Though from what I understand in this issue, is that this is a known issue. |
I reverted to our previous configuration, but I noticed a big difference. I think when having certain(/any?) modules enabled, it will try to fiddle with pipelines. Our old (and now current) configuration is missing the modules section completely and filebeat no longer tries to query the existing pipelines. |
Hi @fholzer I just resolved with granting read_pipeline privileges (according to new documentation) |
The info in this issue is quite old. The Beats security docs have been updated several times over the past 3 years. I am going to close this issue now. If there are additional problems with these docs, please open a new issue. Thanks! |
I am getting quite old too @dedemorton :) Good to see your name pop up in my email. |
This request for a clarification of privileges needed to operate various Beats products arose out of a Support ticket and subsequent internal discussions with developers.
The essential question is what are the minimum set of privileges necessary to operate Beats products in various pipelines, and the motivation for the discussion as to do with whether the documented privileges really are necessary at all times. At least some of the issues to be discussed here have been touched on in #4826.
User has made the following proposal for the minimum set of privileges required for Beats users:
User's motivation for this restrictive set of privileges is based on the fact that he maintains a cluster being accessed by many hundreds of beat client machines with many hundreds of users with various levels of system privileges on those client machines. User is concerned about unauthorized access/deletion/corruption of data by external users.
Developer's initial response to this proposal was to add to it the suggestion that Beats privileges could be split into 2 different sets of privileges: those necessary for setting up the specific Beat environment and those required for daily operation of beat processes:
Obviously, this discussion has not touched on any changes in privileges which may be coming in 6.6 or 7.0, but the basic motivation is reasonable: shall we "officially" (as in endorsing and documenting the proposal) split Beats privileges into Setup and Operation privilege sets - possibly provided to different users), and can we identify the minimum set of privileges required for operations?
The text was updated successfully, but these errors were encountered: