Fix add-cert-helper.sh only adding a single certificate in Chrome #2660
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
Description
When running
/opt/bin/add-cert-helper.sh
, if multiple certificates are present in the directory passed in the-d
argument, only the last certificate alphabetically will be added to the Chrome store, as the same certificate alias is used for each certificate.Steps to reproduce
Prepare a certificates folder on an instance of the container, e.g.
/tmp/certs
, containing more than one root certificate.Run
Using NoVNC, open the Chrome browser and verify that only the last certificate has been added: three dots > Settings > Privacy and Security > Security > Manage certificates > Authorities.
If you View the certificate, the added certificate will have the alias SeleniumHQ displayed immediately under Certificate Hierarchy.
Any other certificates that were imported before the last alphabetical certificate will not be present.
This pull request alters the
add-cert-helper.sh
script to use a differentALIAS
for each imported certificate from the source directory.To verify this addresses the issue, repeat the process to add a directory of certificates as above. Using NoVNC, open the Chrome browser and verify the available certificates: three dots > Settings > Privacy and Security > Security > Manage certificates > Authorities.
Note that multiple certificates, if present in the source directory, are now imported.
Motivation and Context
This change is necessary in order to use
add-cert-helper.sh
to load a directory containing more than one root certificate into Chrome's root certificate store.Types of changes
Checklist
I have not run automated tests, but this change only affects the utility script
/opt/bin/add-cert-helper.sh
.PR Type
Bug fix
Description
Fixes issue where only one certificate was added to Chrome.
Introduces unique aliases for each certificate during import.
Ensures multiple certificates from a directory are imported correctly.
Changes walkthrough 📝
add-cert-helper.sh
Use unique aliases for importing multiple certificates
charts/selenium-grid/certs/add-cert-helper.sh
ALIAS
with dynamicALIAS_PREFIX
.