Add "maintenance" permission to the fleet-server service account#82125
Conversation
|
Pinging @elastic/es-security (Team:Security) |
c9b4488 to
b67de4b
Compare
💚 Backport successful
|
…stic#82125) * Add "maintenance" permission to the fleet-server service account * Fix tests
) (#82138) * Add "maintenance" permission to the fleet-server service account * Fix tests
|
@aleksmaus Is this an issue that potentially also exists in 7.x when the service account is used? |
this would affect the migration with update by query call https://github.com/elastic/fleet-server/blob/130056a170a3ca0b3b8ce4df12741ac40ae70c91/internal/pkg/dl/migration.go#L77 for the rest of the code the |
|
As this is a migration from 7.14 to 7.*, I assume it would also affect users going from 7.14 to 7.16/7.17. @scunningham Do you know what the side effect is if this migration doesn't go through for users? |
|
It could break a very small number of customers that use the security solution starting with 7.14. The migration added the agent_id field to the document in a way that accommodated the transform. The bigger issue is whether the change confers the privilege retroactively. If we add the perms with this PR to the service-account, and then depend on it later, will the perms be applied to a fleet service account that was created in 7.14. If not, then we have to regenerate the fleet service account somehow or basically 1) break all customers before this PR, 2) not depend on it and remove it. @ruflin any idea? |
|
I tested the upgrade from 7.14.2 to 7.16.2, @henningandersen @ywangd Is there any way we can update the existing token permissions under the hood and keep the same token value? what is the best place to implement the migration in case of permissions change? |
|
By "token", I assume it means service account token? If so, the token's permission is updated automatically based on the node's version. I'd be surprised if the service token didn't get the latest permission after node is upgraded. Could you please provide more details on how to reproduce? |
|
@scunningham Based on the comment from @ywangd it sounds like the Elasticsearch version / internal definition of the fleet-server service account defines the permissions so any token always has the "current" permissions. @aleksmaus For the migration, it is not great especially that fleet-server exit. But as soon as it is started again, it is solved. This might actually explain some past user issue we have seen where fleet-server stopped but I had no explanation for it. Is it correct that for any user past 7.14 this will never happen? |
@ywangd I made a mistake in my testing,while going between upgrades from 7.14.2 -> 7.16.2 and 7.14.2 -> 8.1.0. Here are the steps I used to verify that it works:
Response:
Response:
Request: Response: You would get this error with 7.16.2 instead right now, for example:
Request: Response: |
What is the problem this PR solves?
Elimination of the username/password authentication from the fleet server and replacement with the fleet service account token exposed an issue that the code that relies on performing queries with
refreshis no longer works.Surprisingly enough the
_bulkAPI calls with refresh still succeed, which could be a possible issue that allows to circumvent therefreshpermissions with _bulk requests.Fleet server need to be able to perform some API calls with
refreshflag enabled.This would be a prerequisite for PR elastic/fleet-server#1039
How does this PR solve the problem?
Adds "maintenance" permission to the fleet-server service account in order to allow the fleet service perm operations with refresh.
Related issues