fix(agent): private key permissions on Windows - #1931
fix(agent): private key permissions on Windows#1931Kyle Bouchard (ptrstr) wants to merge 1 commit into
Conversation
Let maintainers know that an action is required on their side
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f07c58984c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| #[cfg(windows)] | ||
| restrict_to_system_and_admins(&client_key_path)?; |
There was a problem hiding this comment.
Apply the DACL when creating the key file
On Windows MSI installations, the Agent data directory grants built-in users read access to inherited children, but this call runs only after std::fs::write has created, populated, and closed the key file. A local user monitoring the certs directory can therefore open the temporarily inherited-readable file before this call; changing its DACL afterward does not revoke that handle, allowing the private key to be copied. Create the file with the restrictive security descriptor atomically, or write it in a pre-secured location before moving it into place.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Adds Windows ACL restrictions for newly enrolled Agent tunnel client keys.
Changes:
- Builds a protected DACL granting access only to SYSTEM and Administrators.
- Applies the DACL during enrollment persistence.
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| #[cfg(windows)] | ||
| restrict_to_system_and_admins(&client_key_path)?; |
| #[cfg(windows)] | ||
| restrict_to_system_and_admins(&client_key_path)?; |
Private keys for the agent tunnel are now created with an explicit access control list limited to SYSTEM and Administrators, instead of inheriting the permissions of the Devolutions data directory. Previously these files were readable by any local user on the machine: the tunnel CA and server keys on a Gateway host, and the tunnel client key on an enrolled Agent.
Existing keys keep their current permissions. I'm not sure how widely deployed/used this feature was, so let me know if a migration is required.