Skip to content

Backport of cmd/tls: set explicit file permissions for generated certs into release/1.20.x #22366

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

Merged

Conversation

sujay-hashicorp
Copy link
Contributor

@sujay-hashicorp sujay-hashicorp commented Jun 2, 2025

Description

Consul CLI's tls create command was generating some sensitive files (e.g. consul tls ca create -server) that had excessive permissions at 0666 for public certs created and it should be 0644. Updated the code to use 0644 file perms when creating sensitive files with ca and certs.
NOTE: disabled Compatibility Integration Tests until pipeline upgrade is in place

Testing & Reproduction steps

  1. Update default OS masking to view actual code behaviour: umask 000
  2. Run consul tls ca create -domain=example.test and list the directory to view generated files with ls -lah with excessive perms.
  3. Run consul tls cert create -server to see similar results
  4. Revert OS level masking to default: umask 022

Links

https://hashicorp.atlassian.net/browse/SECVULN-8634

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

@sujay-hashicorp sujay-hashicorp requested a review from a team as a code owner June 2, 2025 05:30
@github-actions github-actions bot added the theme/cli Flags and documentation for the CLI interface label Jun 2, 2025
@sujay-hashicorp sujay-hashicorp merged commit fcf1774 into release/1.20.x Jun 2, 2025
144 of 148 checks passed
@sujay-hashicorp sujay-hashicorp deleted the backport/sujay/tls-file-perms/manual-pr-1 branch June 2, 2025 06:39
@sujay-hashicorp sujay-hashicorp changed the title (manual) Backport of cmd/tls: set explicit file permissions for generated certs into release/1.20.x Backport of cmd/tls: set explicit file permissions for generated certs into release/1.20.x Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/no-backport theme/cli Flags and documentation for the CLI interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants