Skip to content
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

[BUG] DefaultConfigurationController.initializeSecuritySettings writes the keystore unnecessarily #5467

Open
jonbartels opened this issue Oct 13, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@jonbartels
Copy link
Contributor

Describe the bug

The keystore file is opened, checked for existing keypairs, has new keypairs generated if needed, then it is ALWAYS rewritten on line

. This rewrite happens even if no changes to the keystore were needed.

To Reproduce

  1. Create a keystore.jks with a self-signed cert as the mirthconnect alias
  2. Note the mtime of the file
  3. Launch MC
  4. Observe the mtime has changed

Expected behavior
If the keystore DOES NOT need any keypairs generated or added, it should not be written.

Actual behavior
If keystore.jks is not actually changed by Mirth Connect, it should never be written to.

Workaround(s)
No practical workarounds. Maybe a plugin could override the ConfigurationController implementation?

Additional context
This is important for security best-practices - If MC didn't needlessly write to the keystore then the file could be set read-only by the filesystem.

Many modern deployments will load the keystore from a secrets-store (Hashicorp Vault, Docker, k8s secrets, etc.) and loading it read-only is better for those systems.

@jonbartels jonbartels added the bug Something isn't working label Oct 13, 2022
jonbartels added a commit to jonbartels/connect that referenced this issue May 6, 2023
@jonbartels
Copy link
Contributor Author

I am playing with this at https://github.com/jonbartels/connect/tree/5467-keytore-avoid-writes

I don't even know if it compiles yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant