[Fleet] Agent privilege level change UI#237790
Conversation
|
@sileschristian Could I please get a UX review from you? Notably the following questions: 1. Flyout texts ("root privilege" instead of "root access"?). 2. Action icon: I thought the wrench could make sense, but not sure 😄 3. Should we reorder the agent actions in the single agent action and bulk actions menus? There seem to be discrepancies between the two, and maybe it would make sense to review the order from a UX point of view (e.g. perhaps less common actions should be lower in the menu?). Screenshots: |
5546242 to
1fb2df5
Compare
…t --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/maintenance_window --include-path /api/agent_builder --update'
|
A note: currently neither the API or the UI reject handling an agent that is already unprivileged. @michalpristas let me know if it should be the case. |
Fleet rejects fast if the agent is on an unsupported (< 9.3.0) version or if needs root privilege (e.g. it's on an agent policy with the system integration). We could certainly return fast if it's already unprivileged. In this case, it would probably also make sense to hide the option in the UI, same as unsupported version and requires root privilege. Also, even though the endpoint is named |
Attempting to change the privilege level from unprivileged to privileged should return an error quickly, something equivalent to an HTTP 501 Not Implemented. A request to maintain the privilege level of an unprivileged agent should succeed quickly, equivalent to a 200 OK. This would let users retry bulk privilege level changes where only some of the agents have succeeded in the batch. |
In the UI for an individual agent that is already unprivileged we shouldn't show the privilege level change / remove root access as an option if we aren't already doing that. |
|
Thanks for your input @cmacknz
It's not even possible in the current implementation. Calling
Great point 👍 I added fast success for single agent. For bulk, I ran into a slight complication: currently, for a Fleet-created action, we expect
Added 👍 |
|
@sileschristian Thanks for your feedback! I pushed the following changes to this PR:
I opened #238091 for followup changes. Since we have that issue to discuss the redesign of these menus, I would rather keep the changes in this PR related to privilege level change only. I've also updated the screenshots in the PR description. Please let me know of any further feedback 🙏 |
|
Pinging @elastic/fleet (Team:Fleet) |
With the current logic we can already retry the bulk action and have it partially succeed for those agents that are not unprivileged. Isn't that the goal? |
florent-leborgne
left a comment
There was a problem hiding this comment.
LGTM, just a few super minor copy styling suggestions
...gent_list_page/components/change_agent_privilege_level_flyout.tsx/action_secret_form_row.tsx
Outdated
Show resolved
Hide resolved
...gent_list_page/components/change_agent_privilege_level_flyout.tsx/action_secret_form_row.tsx
Outdated
Show resolved
Hide resolved
...sections/agents/agent_list_page/components/change_agent_privilege_level_flyout.tsx/index.tsx
Outdated
Show resolved
Hide resolved
...sections/agents/agent_list_page/components/change_agent_privilege_level_flyout.tsx/index.tsx
Outdated
Show resolved
Hide resolved
...sections/agents/agent_list_page/components/change_agent_privilege_level_flyout.tsx/index.tsx
Outdated
Show resolved
Hide resolved
...sections/agents/agent_list_page/components/change_agent_privilege_level_flyout.tsx/index.tsx
Outdated
Show resolved
Hide resolved
...sections/agents/agent_list_page/components/change_agent_privilege_level_flyout.tsx/index.tsx
Outdated
Show resolved
Hide resolved
Yeah this would result in inconsistencies on the UI e.g. actioning 50 agents and then seeing 48 being actioned.
Sounds good to me. |
x-pack/platform/plugins/shared/fleet/common/constants/secrets.ts
Outdated
Show resolved
Hide resolved
|
@juliaElastic FYI I captured the discussion around potentially modifying bulk actions in #238220 |
...eet/sections/agents/agent_list_page/components/change_agent_privilege_level_flyout/index.tsx
Show resolved
Hide resolved
Good point! I'll add that, and also a mention of this menu in #238091. |
Agreed if there is significant work here it doesn't need to be tackled in this PR. Increasingly we need to be thinking of handling actions like this the same way we do for automatic upgrades. Users are declaring a target state for the agent (be a specific version, have a specific privilege level) and Fleet needs to automatically converge the agents to the state without users needing to button click through one off failures or agents that happen to be offline during the initial conversion. |
|
@elasticmachine merge upstream |
This comment was marked as outdated.
This comment was marked as outdated.
|
@elasticmachine merge upstream |
## Summary Closes elastic#221891 Closes elastic#221892 This PR implements the UI for the new agent privilege level change API (single agent and bulk). Key changes: * Add an agent version check: this had been missed in the API implementation; agents should be on 9.3.0 or higher, otherwise attempting to remove root privilege through the API will fail and the UI will not allow it. * Add a check if the agent is already unprivileged: * `POST /api/fleet/agent/{agent_id}/privilege_level_change`: return 200 with message "Agent {agentId} is already unprivileged", no action created * `POST /api/fleet/agents/bulk_privilege_level_change`: no change (confirmation pending) * UI: don't show the option for root privilege removal * Add `is_action_secrets_storage_enabled` to Fleet setup API (`GET kbn:api/fleet/agents/setup`). * Add "Remove root privilege" action for Fleet agents in Fleet UI (cf. screenshots). * Store optional user password as secret if action secrets storage is enabled (all Fleet servers on 9.3.0 or higher). ### Screenshots <details> <summary>Click to reveal</summary>⚠️ At the time of writing, Elastic Agent 9.3.0 is not available yet, so screenshots show 9.2.0 instead. Considering 4 agents: * Agent on version 9.3.0 on agent policy with an integration (System) that requires root privilege: root privilege removal denied. * Agent on version 9.3.0 on agent policy with no integrations: root privilege removal permitted. * Agent on version 9.1.0 on agent policy with no integrations: root privilege removal unsupported. * Agent on version 9.3.0 already unprivileged: root privilege removal permitted but not offered in the UI. <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 23" src="https://github.com/user-attachments/assets/54cf5bda-3b46-409f-9d53-37bcfb1c7151" /> The single agent actions in the table rows only show "Remove root privilege" if the agent is eligible: <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 31" src="https://github.com/user-attachments/assets/ac2fc903-efae-4054-bbe9-0467a3884b0e" /> Clicking on "Remove root privilege" opens a flyout for the agent, allowing the user to specify options (here, action secrets are enabled and the password field would be stored as a secret if specified): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 43" src="https://github.com/user-attachments/assets/127008ec-2abb-4f93-9de3-57e35e753c57" /> If action secrets are not enabled, the user password is stored as plain text: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 17 07 42" src="https://github.com/user-attachments/assets/196c2664-72bb-4e63-b69a-994240b0a7a5" /> If the action is successfully created, a notification is shown: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 57" src="https://github.com/user-attachments/assets/f329ccaf-611e-47ab-bd31-9e62798b4be3" /> The bulk agent actions show "Remove root privilege for N agents" when agents are selected: <img width="1919" height="805" alt="Screenshot 2025-10-09 at 16 39 14" src="https://github.com/user-attachments/assets/6ed795d3-1bd7-4498-9e0a-9cb5bba5dcdd" /> In this case, the flyout will report which agents are not eligible if any and only create the action for eligible agents: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 39 28" src="https://github.com/user-attachments/assets/cdca55f7-52da-411c-a9bd-c90c76e2373b" /> The agent details page also offers the action (as well as migration): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 05" src="https://github.com/user-attachments/assets/602ae6cd-ba2f-4b17-9eac-a8bb0f09a99a" /> With the flyout: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 20" src="https://github.com/user-attachments/assets/4c9ce2ea-2eab-490d-9d5b-e2c82ba8ffc1" /> </details> ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks These changes only impact the new Fleet agent privilege level change API. ## Release note Adds a functionality for removing root privilege from Fleet managed agents if applicable. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary Closes elastic#221891 Closes elastic#221892 This PR implements the UI for the new agent privilege level change API (single agent and bulk). Key changes: * Add an agent version check: this had been missed in the API implementation; agents should be on 9.3.0 or higher, otherwise attempting to remove root privilege through the API will fail and the UI will not allow it. * Add a check if the agent is already unprivileged: * `POST /api/fleet/agent/{agent_id}/privilege_level_change`: return 200 with message "Agent {agentId} is already unprivileged", no action created * `POST /api/fleet/agents/bulk_privilege_level_change`: no change (confirmation pending) * UI: don't show the option for root privilege removal * Add `is_action_secrets_storage_enabled` to Fleet setup API (`GET kbn:api/fleet/agents/setup`). * Add "Remove root privilege" action for Fleet agents in Fleet UI (cf. screenshots). * Store optional user password as secret if action secrets storage is enabled (all Fleet servers on 9.3.0 or higher). ### Screenshots <details> <summary>Click to reveal</summary>⚠️ At the time of writing, Elastic Agent 9.3.0 is not available yet, so screenshots show 9.2.0 instead. Considering 4 agents: * Agent on version 9.3.0 on agent policy with an integration (System) that requires root privilege: root privilege removal denied. * Agent on version 9.3.0 on agent policy with no integrations: root privilege removal permitted. * Agent on version 9.1.0 on agent policy with no integrations: root privilege removal unsupported. * Agent on version 9.3.0 already unprivileged: root privilege removal permitted but not offered in the UI. <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 23" src="https://github.com/user-attachments/assets/54cf5bda-3b46-409f-9d53-37bcfb1c7151" /> The single agent actions in the table rows only show "Remove root privilege" if the agent is eligible: <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 31" src="https://github.com/user-attachments/assets/ac2fc903-efae-4054-bbe9-0467a3884b0e" /> Clicking on "Remove root privilege" opens a flyout for the agent, allowing the user to specify options (here, action secrets are enabled and the password field would be stored as a secret if specified): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 43" src="https://github.com/user-attachments/assets/127008ec-2abb-4f93-9de3-57e35e753c57" /> If action secrets are not enabled, the user password is stored as plain text: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 17 07 42" src="https://github.com/user-attachments/assets/196c2664-72bb-4e63-b69a-994240b0a7a5" /> If the action is successfully created, a notification is shown: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 57" src="https://github.com/user-attachments/assets/f329ccaf-611e-47ab-bd31-9e62798b4be3" /> The bulk agent actions show "Remove root privilege for N agents" when agents are selected: <img width="1919" height="805" alt="Screenshot 2025-10-09 at 16 39 14" src="https://github.com/user-attachments/assets/6ed795d3-1bd7-4498-9e0a-9cb5bba5dcdd" /> In this case, the flyout will report which agents are not eligible if any and only create the action for eligible agents: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 39 28" src="https://github.com/user-attachments/assets/cdca55f7-52da-411c-a9bd-c90c76e2373b" /> The agent details page also offers the action (as well as migration): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 05" src="https://github.com/user-attachments/assets/602ae6cd-ba2f-4b17-9eac-a8bb0f09a99a" /> With the flyout: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 20" src="https://github.com/user-attachments/assets/4c9ce2ea-2eab-490d-9d5b-e2c82ba8ffc1" /> </details> ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks These changes only impact the new Fleet agent privilege level change API. ## Release note Adds a functionality for removing root privilege from Fleet managed agents if applicable. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary Closes elastic#221891 Closes elastic#221892 This PR implements the UI for the new agent privilege level change API (single agent and bulk). Key changes: * Add an agent version check: this had been missed in the API implementation; agents should be on 9.3.0 or higher, otherwise attempting to remove root privilege through the API will fail and the UI will not allow it. * Add a check if the agent is already unprivileged: * `POST /api/fleet/agent/{agent_id}/privilege_level_change`: return 200 with message "Agent {agentId} is already unprivileged", no action created * `POST /api/fleet/agents/bulk_privilege_level_change`: no change (confirmation pending) * UI: don't show the option for root privilege removal * Add `is_action_secrets_storage_enabled` to Fleet setup API (`GET kbn:api/fleet/agents/setup`). * Add "Remove root privilege" action for Fleet agents in Fleet UI (cf. screenshots). * Store optional user password as secret if action secrets storage is enabled (all Fleet servers on 9.3.0 or higher). ### Screenshots <details> <summary>Click to reveal</summary>⚠️ At the time of writing, Elastic Agent 9.3.0 is not available yet, so screenshots show 9.2.0 instead. Considering 4 agents: * Agent on version 9.3.0 on agent policy with an integration (System) that requires root privilege: root privilege removal denied. * Agent on version 9.3.0 on agent policy with no integrations: root privilege removal permitted. * Agent on version 9.1.0 on agent policy with no integrations: root privilege removal unsupported. * Agent on version 9.3.0 already unprivileged: root privilege removal permitted but not offered in the UI. <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 23" src="https://github.com/user-attachments/assets/54cf5bda-3b46-409f-9d53-37bcfb1c7151" /> The single agent actions in the table rows only show "Remove root privilege" if the agent is eligible: <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 31" src="https://github.com/user-attachments/assets/ac2fc903-efae-4054-bbe9-0467a3884b0e" /> Clicking on "Remove root privilege" opens a flyout for the agent, allowing the user to specify options (here, action secrets are enabled and the password field would be stored as a secret if specified): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 43" src="https://github.com/user-attachments/assets/127008ec-2abb-4f93-9de3-57e35e753c57" /> If action secrets are not enabled, the user password is stored as plain text: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 17 07 42" src="https://github.com/user-attachments/assets/196c2664-72bb-4e63-b69a-994240b0a7a5" /> If the action is successfully created, a notification is shown: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 57" src="https://github.com/user-attachments/assets/f329ccaf-611e-47ab-bd31-9e62798b4be3" /> The bulk agent actions show "Remove root privilege for N agents" when agents are selected: <img width="1919" height="805" alt="Screenshot 2025-10-09 at 16 39 14" src="https://github.com/user-attachments/assets/6ed795d3-1bd7-4498-9e0a-9cb5bba5dcdd" /> In this case, the flyout will report which agents are not eligible if any and only create the action for eligible agents: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 39 28" src="https://github.com/user-attachments/assets/cdca55f7-52da-411c-a9bd-c90c76e2373b" /> The agent details page also offers the action (as well as migration): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 05" src="https://github.com/user-attachments/assets/602ae6cd-ba2f-4b17-9eac-a8bb0f09a99a" /> With the flyout: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 20" src="https://github.com/user-attachments/assets/4c9ce2ea-2eab-490d-9d5b-e2c82ba8ffc1" /> </details> ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks These changes only impact the new Fleet agent privilege level change API. ## Release note Adds a functionality for removing root privilege from Fleet managed agents if applicable. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary Closes elastic#221891 Closes elastic#221892 This PR implements the UI for the new agent privilege level change API (single agent and bulk). Key changes: * Add an agent version check: this had been missed in the API implementation; agents should be on 9.3.0 or higher, otherwise attempting to remove root privilege through the API will fail and the UI will not allow it. * Add a check if the agent is already unprivileged: * `POST /api/fleet/agent/{agent_id}/privilege_level_change`: return 200 with message "Agent {agentId} is already unprivileged", no action created * `POST /api/fleet/agents/bulk_privilege_level_change`: no change (confirmation pending) * UI: don't show the option for root privilege removal * Add `is_action_secrets_storage_enabled` to Fleet setup API (`GET kbn:api/fleet/agents/setup`). * Add "Remove root privilege" action for Fleet agents in Fleet UI (cf. screenshots). * Store optional user password as secret if action secrets storage is enabled (all Fleet servers on 9.3.0 or higher). ### Screenshots <details> <summary>Click to reveal</summary>⚠️ At the time of writing, Elastic Agent 9.3.0 is not available yet, so screenshots show 9.2.0 instead. Considering 4 agents: * Agent on version 9.3.0 on agent policy with an integration (System) that requires root privilege: root privilege removal denied. * Agent on version 9.3.0 on agent policy with no integrations: root privilege removal permitted. * Agent on version 9.1.0 on agent policy with no integrations: root privilege removal unsupported. * Agent on version 9.3.0 already unprivileged: root privilege removal permitted but not offered in the UI. <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 23" src="https://github.com/user-attachments/assets/54cf5bda-3b46-409f-9d53-37bcfb1c7151" /> The single agent actions in the table rows only show "Remove root privilege" if the agent is eligible: <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 31" src="https://github.com/user-attachments/assets/ac2fc903-efae-4054-bbe9-0467a3884b0e" /> Clicking on "Remove root privilege" opens a flyout for the agent, allowing the user to specify options (here, action secrets are enabled and the password field would be stored as a secret if specified): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 43" src="https://github.com/user-attachments/assets/127008ec-2abb-4f93-9de3-57e35e753c57" /> If action secrets are not enabled, the user password is stored as plain text: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 17 07 42" src="https://github.com/user-attachments/assets/196c2664-72bb-4e63-b69a-994240b0a7a5" /> If the action is successfully created, a notification is shown: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 57" src="https://github.com/user-attachments/assets/f329ccaf-611e-47ab-bd31-9e62798b4be3" /> The bulk agent actions show "Remove root privilege for N agents" when agents are selected: <img width="1919" height="805" alt="Screenshot 2025-10-09 at 16 39 14" src="https://github.com/user-attachments/assets/6ed795d3-1bd7-4498-9e0a-9cb5bba5dcdd" /> In this case, the flyout will report which agents are not eligible if any and only create the action for eligible agents: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 39 28" src="https://github.com/user-attachments/assets/cdca55f7-52da-411c-a9bd-c90c76e2373b" /> The agent details page also offers the action (as well as migration): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 05" src="https://github.com/user-attachments/assets/602ae6cd-ba2f-4b17-9eac-a8bb0f09a99a" /> With the flyout: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 20" src="https://github.com/user-attachments/assets/4c9ce2ea-2eab-490d-9d5b-e2c82ba8ffc1" /> </details> ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks These changes only impact the new Fleet agent privilege level change API. ## Release note Adds a functionality for removing root privilege from Fleet managed agents if applicable. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary Closes elastic#221891 Closes elastic#221892 This PR implements the UI for the new agent privilege level change API (single agent and bulk). Key changes: * Add an agent version check: this had been missed in the API implementation; agents should be on 9.3.0 or higher, otherwise attempting to remove root privilege through the API will fail and the UI will not allow it. * Add a check if the agent is already unprivileged: * `POST /api/fleet/agent/{agent_id}/privilege_level_change`: return 200 with message "Agent {agentId} is already unprivileged", no action created * `POST /api/fleet/agents/bulk_privilege_level_change`: no change (confirmation pending) * UI: don't show the option for root privilege removal * Add `is_action_secrets_storage_enabled` to Fleet setup API (`GET kbn:api/fleet/agents/setup`). * Add "Remove root privilege" action for Fleet agents in Fleet UI (cf. screenshots). * Store optional user password as secret if action secrets storage is enabled (all Fleet servers on 9.3.0 or higher). ### Screenshots <details> <summary>Click to reveal</summary>⚠️ At the time of writing, Elastic Agent 9.3.0 is not available yet, so screenshots show 9.2.0 instead. Considering 4 agents: * Agent on version 9.3.0 on agent policy with an integration (System) that requires root privilege: root privilege removal denied. * Agent on version 9.3.0 on agent policy with no integrations: root privilege removal permitted. * Agent on version 9.1.0 on agent policy with no integrations: root privilege removal unsupported. * Agent on version 9.3.0 already unprivileged: root privilege removal permitted but not offered in the UI. <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 23" src="https://github.com/user-attachments/assets/54cf5bda-3b46-409f-9d53-37bcfb1c7151" /> The single agent actions in the table rows only show "Remove root privilege" if the agent is eligible: <img width="1919" height="757" alt="Screenshot 2025-10-09 at 16 38 31" src="https://github.com/user-attachments/assets/ac2fc903-efae-4054-bbe9-0467a3884b0e" /> Clicking on "Remove root privilege" opens a flyout for the agent, allowing the user to specify options (here, action secrets are enabled and the password field would be stored as a secret if specified): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 43" src="https://github.com/user-attachments/assets/127008ec-2abb-4f93-9de3-57e35e753c57" /> If action secrets are not enabled, the user password is stored as plain text: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 17 07 42" src="https://github.com/user-attachments/assets/196c2664-72bb-4e63-b69a-994240b0a7a5" /> If the action is successfully created, a notification is shown: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 38 57" src="https://github.com/user-attachments/assets/f329ccaf-611e-47ab-bd31-9e62798b4be3" /> The bulk agent actions show "Remove root privilege for N agents" when agents are selected: <img width="1919" height="805" alt="Screenshot 2025-10-09 at 16 39 14" src="https://github.com/user-attachments/assets/6ed795d3-1bd7-4498-9e0a-9cb5bba5dcdd" /> In this case, the flyout will report which agents are not eligible if any and only create the action for eligible agents: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 39 28" src="https://github.com/user-attachments/assets/cdca55f7-52da-411c-a9bd-c90c76e2373b" /> The agent details page also offers the action (as well as migration): <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 05" src="https://github.com/user-attachments/assets/602ae6cd-ba2f-4b17-9eac-a8bb0f09a99a" /> With the flyout: <img width="1919" height="883" alt="Screenshot 2025-10-09 at 16 40 20" src="https://github.com/user-attachments/assets/4c9ce2ea-2eab-490d-9d5b-e2c82ba8ffc1" /> </details> ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks These changes only impact the new Fleet agent privilege level change API. ## Release note Adds a functionality for removing root privilege from Fleet managed agents if applicable. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary Small label fix for root privilege removal action for Fleet-managed Elastic Agents: single agent menus have the correct label "Remove root privilege" but the bulk actions menu had "Remove root access for N agents". This PR corrects "access" to "privilege" for consistency. Original implementation PR: #237790 Documentation PR: elastic/docs-content#4910 ### Screenshots Before: <img width="1728" height="576" alt="Screenshot 2026-01-30 at 16 06 45" src="https://github.com/user-attachments/assets/99384fd7-53cf-47f0-b7ac-d9db4467cc03" /> After: <img width="1728" height="576" alt="Screenshot 2026-01-30 at 16 10 50" src="https://github.com/user-attachments/assets/e34704d6-cb4b-41c5-a953-405759d1c919" /> Which matches single agent menus: <img width="1728" height="648" alt="Screenshot 2026-01-30 at 16 05 48" src="https://github.com/user-attachments/assets/703f774b-4bd1-47ed-ab59-ff0b5c012905" /> <img width="1728" height="571" alt="Screenshot 2026-01-30 at 16 06 09" src="https://github.com/user-attachments/assets/a3e6e537-313e-424a-ab80-9da37f338996" /> ### Checklist - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks UI label fix only. --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary Small label fix for root privilege removal action for Fleet-managed Elastic Agents: single agent menus have the correct label "Remove root privilege" but the bulk actions menu had "Remove root access for N agents". This PR corrects "access" to "privilege" for consistency. Original implementation PR: elastic#237790 Documentation PR: elastic/docs-content#4910 ### Screenshots Before: <img width="1728" height="576" alt="Screenshot 2026-01-30 at 16 06 45" src="https://github.com/user-attachments/assets/99384fd7-53cf-47f0-b7ac-d9db4467cc03" /> After: <img width="1728" height="576" alt="Screenshot 2026-01-30 at 16 10 50" src="https://github.com/user-attachments/assets/e34704d6-cb4b-41c5-a953-405759d1c919" /> Which matches single agent menus: <img width="1728" height="648" alt="Screenshot 2026-01-30 at 16 05 48" src="https://github.com/user-attachments/assets/703f774b-4bd1-47ed-ab59-ff0b5c012905" /> <img width="1728" height="571" alt="Screenshot 2026-01-30 at 16 06 09" src="https://github.com/user-attachments/assets/a3e6e537-313e-424a-ab80-9da37f338996" /> ### Checklist - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks UI label fix only. --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit 2417834)
…251424) # Backport This will backport the following commits from `main` to `9.3`: - [[Fleet] Fix bulk remove agent root privilege label (#251085)](#251085) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jill Guyonnet","email":"jill.guyonnet@elastic.co"},"sourceCommit":{"committedDate":"2026-02-03T10:57:19Z","message":"[Fleet] Fix bulk remove agent root privilege label (#251085)\n\n## Summary\n\nSmall label fix for root privilege removal action for Fleet-managed\nElastic Agents: single agent menus have the correct label \"Remove root\nprivilege\" but the bulk actions menu had \"Remove root access for N\nagents\". This PR corrects \"access\" to \"privilege\" for consistency.\n\nOriginal implementation PR:\nhttps://github.com//pull/237790\nDocumentation PR: https://github.com/elastic/docs-content/pull/4910\n\n### Screenshots\n\nBefore:\n<img width=\"1728\" height=\"576\" alt=\"Screenshot 2026-01-30 at 16 06 45\"\nsrc=\"https://github.com/user-attachments/assets/99384fd7-53cf-47f0-b7ac-d9db4467cc03\"\n/>\n\nAfter:\n<img width=\"1728\" height=\"576\" alt=\"Screenshot 2026-01-30 at 16 10 50\"\nsrc=\"https://github.com/user-attachments/assets/e34704d6-cb4b-41c5-a953-405759d1c919\"\n/>\n\nWhich matches single agent menus:\n<img width=\"1728\" height=\"648\" alt=\"Screenshot 2026-01-30 at 16 05 48\"\nsrc=\"https://github.com/user-attachments/assets/703f774b-4bd1-47ed-ab59-ff0b5c012905\"\n/>\n\n<img width=\"1728\" height=\"571\" alt=\"Screenshot 2026-01-30 at 16 06 09\"\nsrc=\"https://github.com/user-attachments/assets/a3e6e537-313e-424a-ab80-9da37f338996\"\n/>\n\n### Checklist\n\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nUI label fix only.\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"24178349257bbc5d382606d42e4f11b0aede2dd1","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:version","v9.3.0","v9.4.0"],"title":"[Fleet] Fix bulk remove agent root privilege label","number":251085,"url":"https://github.com/elastic/kibana/pull/251085","mergeCommit":{"message":"[Fleet] Fix bulk remove agent root privilege label (#251085)\n\n## Summary\n\nSmall label fix for root privilege removal action for Fleet-managed\nElastic Agents: single agent menus have the correct label \"Remove root\nprivilege\" but the bulk actions menu had \"Remove root access for N\nagents\". This PR corrects \"access\" to \"privilege\" for consistency.\n\nOriginal implementation PR:\nhttps://github.com//pull/237790\nDocumentation PR: https://github.com/elastic/docs-content/pull/4910\n\n### Screenshots\n\nBefore:\n<img width=\"1728\" height=\"576\" alt=\"Screenshot 2026-01-30 at 16 06 45\"\nsrc=\"https://github.com/user-attachments/assets/99384fd7-53cf-47f0-b7ac-d9db4467cc03\"\n/>\n\nAfter:\n<img width=\"1728\" height=\"576\" alt=\"Screenshot 2026-01-30 at 16 10 50\"\nsrc=\"https://github.com/user-attachments/assets/e34704d6-cb4b-41c5-a953-405759d1c919\"\n/>\n\nWhich matches single agent menus:\n<img width=\"1728\" height=\"648\" alt=\"Screenshot 2026-01-30 at 16 05 48\"\nsrc=\"https://github.com/user-attachments/assets/703f774b-4bd1-47ed-ab59-ff0b5c012905\"\n/>\n\n<img width=\"1728\" height=\"571\" alt=\"Screenshot 2026-01-30 at 16 06 09\"\nsrc=\"https://github.com/user-attachments/assets/a3e6e537-313e-424a-ab80-9da37f338996\"\n/>\n\n### Checklist\n\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nUI label fix only.\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"24178349257bbc5d382606d42e4f11b0aede2dd1"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/251085","number":251085,"mergeCommit":{"message":"[Fleet] Fix bulk remove agent root privilege label (#251085)\n\n## Summary\n\nSmall label fix for root privilege removal action for Fleet-managed\nElastic Agents: single agent menus have the correct label \"Remove root\nprivilege\" but the bulk actions menu had \"Remove root access for N\nagents\". This PR corrects \"access\" to \"privilege\" for consistency.\n\nOriginal implementation PR:\nhttps://github.com//pull/237790\nDocumentation PR: https://github.com/elastic/docs-content/pull/4910\n\n### Screenshots\n\nBefore:\n<img width=\"1728\" height=\"576\" alt=\"Screenshot 2026-01-30 at 16 06 45\"\nsrc=\"https://github.com/user-attachments/assets/99384fd7-53cf-47f0-b7ac-d9db4467cc03\"\n/>\n\nAfter:\n<img width=\"1728\" height=\"576\" alt=\"Screenshot 2026-01-30 at 16 10 50\"\nsrc=\"https://github.com/user-attachments/assets/e34704d6-cb4b-41c5-a953-405759d1c919\"\n/>\n\nWhich matches single agent menus:\n<img width=\"1728\" height=\"648\" alt=\"Screenshot 2026-01-30 at 16 05 48\"\nsrc=\"https://github.com/user-attachments/assets/703f774b-4bd1-47ed-ab59-ff0b5c012905\"\n/>\n\n<img width=\"1728\" height=\"571\" alt=\"Screenshot 2026-01-30 at 16 06 09\"\nsrc=\"https://github.com/user-attachments/assets/a3e6e537-313e-424a-ab80-9da37f338996\"\n/>\n\n### Checklist\n\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nUI label fix only.\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"24178349257bbc5d382606d42e4f11b0aede2dd1"}}]}] BACKPORT--> Co-authored-by: Jill Guyonnet <jill.guyonnet@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>



Summary
Closes #221891
Closes #221892
This PR implements the UI for the new agent privilege level change API (single agent and bulk).
Key changes:
POST /api/fleet/agent/{agent_id}/privilege_level_change: return 200 with message "Agent {agentId} is already unprivileged", no action createdPOST /api/fleet/agents/bulk_privilege_level_change: no change (confirmation pending)is_action_secrets_storage_enabledto Fleet setup API (GET kbn:api/fleet/agents/setup).Screenshots
Click to reveal
Considering 4 agents:
The single agent actions in the table rows only show "Remove root privilege" if the agent is eligible:

Clicking on "Remove root privilege" opens a flyout for the agent, allowing the user to specify options (here, action secrets are enabled and the password field would be stored as a secret if specified):

If action secrets are not enabled, the user password is stored as plain text:

If the action is successfully created, a notification is shown:

The bulk agent actions show "Remove root privilege for N agents" when agents are selected:

In this case, the flyout will report which agents are not eligible if any and only create the action for eligible agents:

The agent details page also offers the action (as well as migration):

With the flyout:

Checklist
release_note:*label is applied per the guidelinesbackport:*labels.Identify risks
These changes only impact the new Fleet agent privilege level change API.
Release note
Adds a functionality for removing root privilege from Fleet managed agents if applicable.