Skip to content

NMS-20625: Minion truststore loses the JDK CA certificates - #9178

Open
mershad-manesh wants to merge 3 commits into
foundation-2024from
mem/NMS-20625
Open

mershad-manesh wants to merge 3 commits into
foundation-2024from
mem/NMS-20625

Conversation

@mershad-manesh

Copy link
Copy Markdown
Contributor

When minion-server-certs.env is used, the entrypoint copies the JDK cacerts with rsync before importing the listed certificates. cacerts is a symlink, and without -L rsync skips it while still exiting 0. keytool then creates a new truststore that holds only the configured certificates, so Minion no longer trusts any public CA.

All Contributors

External References

@marshallmassengill marshallmassengill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this target foundation-2024?

-entrypoint.sh:450: the list-then-delete of an existing alias is now dead code, since the store is always fresh.

…r certs

When minion-server-certs.env is used, the entrypoint copies the JDK
cacerts with rsync before importing the listed certificates. cacerts is
a symlink, and without -L rsync skips it while still exiting 0. keytool
then creates a new truststore that holds only the configured
certificates, so Minion no longer trusts any public CA.

Copy the file the symlink points to with rsync -L and make the copy
writable, since the system file is read-only and keytool could not
save to it otherwise. Fail the entrypoint if either step fails, and
define E_INIT_CONFIG, which the entrypoint already used but never set.

The truststore is now a fresh copy on every start, so drop the check
that deleted an alias before importing it. Skip blank lines, and fail
with a clear message when a listed certificate file is missing or not
readable, or when keytool cannot import it, for example because an
alias is listed twice.

Add a smoke test that mounts a certificate directory and checks the
Minion truststore holds every JDK CA plus the configured certificate.
@github-actions
github-actions Bot requested a review from indigo423 November 19, 2026 19:40
@github-actions github-actions Bot added the docs label Nov 19, 2026
@mershad-manesh
mershad-manesh changed the base branch from foundation-2026 to foundation-2024 November 19, 2026 19:40

@marshallmassengill marshallmassengill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more:

  • Entrypoint.sh:268: an alias listed twice in minion-server-certs.env now aborts startup with exit 127. The removed list-then-delete block tolerated that case. The new error message does name the cause; decide whether fatal is acceptable in a maintenance release... not sure on this one to be honest so may be worth a discussion/look.

This is more "if we're in here...":

  • entrypoint.sh:260: while read certid silently skips a last line with no trailing newline (confirmed locally). This predates the PR; while read -r certid || [[ -n $certid ]] fixes it while the loop is being touched.

An alias listed twice in minion-server-certs.env, or one with the same
name as a JDK CA, made the import fail and stopped the Minion. Before
this change the entrypoint deleted an existing entry and imported it
again, so restore that check and log when an entry is replaced.

A last line without a trailing newline was skipped; read it as well.
@github-actions github-actions Bot removed the docs label Nov 19, 2026
@mershad-manesh

Copy link
Copy Markdown
Contributor Author

One more:

  • Entrypoint.sh:268: an alias listed twice in minion-server-certs.env now aborts startup with exit 127. The removed list-then-delete block tolerated that case. The new error message does name the cause; decide whether fatal is acceptable in a maintenance release... not sure on this one to be honest so may be worth a discussion/look.

This is more "if we're in here...":

  • entrypoint.sh:260: while read certid silently skips a last line with no trailing newline (confirmed locally). This predates the PR; while read -r certid || [[ -n $certid ]] fixes it while the loop is being touched.

This issue should be resolved.
An invalid or missing certificate will stop the startup with error code 127 (instead of 1)

@marshallmassengill marshallmassengill left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • MinionServerCertsIT.java:98: the test only covers the happy path; neither round-2 fix is exercised. Writing CERT_ALIAS + "\n" + CERT_ALIAS with no trailing newline would cover the duplicate-alias path.... not really a blocker to me but if you want to fix it...
  • entrypoint.sh:262: a CRLF minion-server-certs.env now fails as "missing or not readable" with the \r invisible in the message. Again... probably not a blocker.

…ixes

Strip a trailing carriage return from each line so a file with Windows
line endings does not fail with a missing-certificate error that hides
the \r. The smoke test now uses a CRLF line, a repeated alias and a last
line with no trailing newline.

This branch has not been deployed

No deployments
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