Skip to content

Fix permissions - #7

Open
Dimariqe wants to merge 2 commits into
gregtwallace:mainfrom
Dimariqe:fix-permissions
Open

Fix permissions#7
Dimariqe wants to merge 2 commits into
gregtwallace:mainfrom
Dimariqe:fix-permissions

Conversation

@Dimariqe

Copy link
Copy Markdown

This pull request improves the handling of file permissions for certificate and key files in the application, ensuring permissions are set correctly and consistently. The changes primarily affect how permissions are parsed from environment variables and how file permissions are applied during file creation and updates.

File Permission Handling Improvements

  • Changed the parsing of KEY_PERM and CERT_PERM environment variables to use base 8 (octal) and a 32-bit integer size for correct permission values in pkg/main/config.go. [1] [2]

Explicit Permission Setting After File Writes

  • Updated the logic in updateCertFilesAndRestartContainers (in pkg/main/update_common.go) to explicitly set file permissions using os.Chmod after writing key, certificate, and PFX files. This ensures permissions are correctly applied, even if the underlying OS or filesystem does not honor the permissions set during file creation. [1] [2] [3]
  • Enhanced logging to include the permissions used when writing files, improving traceability and debugging. [1] [2] [3]

Changed strconv.ParseInt calls for KEY_PERM and CERT_PERM to use base 8 and 32-bit size, ensuring correct parsing of octal file permission values from environment variables.
Adds explicit os.Chmod calls after writing key, cert, and pfx files to guarantee correct file permissions are set. Improves reliability of permission handling and updates log messages to reflect permission changes.
@gregtwallace

Copy link
Copy Markdown
Owner

I appreciate these efforts and I am not ignoring them. I am in the middle of doing a large refactor to try and un-spaghetti a lot of this code and will work on matching these PRs up after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants