-
Notifications
You must be signed in to change notification settings - Fork 282
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
Update certs for SecuritySSLReloadCertsActionTests #2679
Conversation
Signed-off-by: Craig Perkins <[email protected]>
@@ -52,18 +52,18 @@ public class SecuritySSLReloadCertsActionTests extends SingleClusterTest { | |||
ImmutableMap.of( | |||
"issuer_dn", "CN=Example Com Inc. Signing CA,OU=Example Com Inc. Signing CA,O=Example Com Inc.,DC=example,DC=com", | |||
"subject_dn", "CN=node-1.example.com,OU=SSL,O=Test,L=Test,C=DE", | |||
"san", "[[8, 1.2.3.4.5.5], [0, [2.5.4.3, node-1.example.com]], [2, node-1.example.com], [2, localhost], [7, 127.0.0.1]]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this back from the change introduced in this PR because I'm not positive how to specify the SAN in the openssl command. PR where this was added: https://github.com/opensearch-project/security/pull/1369/files#diff-9e1e704af587fb1787556fe19857df59ef099619245b491958b0c9de83e5f2fe
Node certificates are being generated with the following commands:
openssl genrsa -out node-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in node-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out node.key.pem
openssl req -new -key node.key.pem -subj "/C=DE/L=Test/O=Test/OU=SSL/CN=node-1.example.com" -out node.csr
openssl x509 -req -days 3650 -extfile <(printf "subjectAltName=DNS:node-1.example.com,DNS:localhost,IP:127.0.0.1,RID:1.2.3.4.5.5") -in node.csr -out node.crt.pem -CA signing.pem -CAkey signing-key.pem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm able to add otherName
in the subjectAltName
, but I'm not sure if this is correct:
openssl genrsa -out node2-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in node2-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out node2.key.pem
openssl req -new -key node2.key.pem -subj "/C=DE/L=Test/O=Test/OU=SSL/CN=node-2.example.com" -out node2.csr
openssl x509 -req -days 3650 -extfile <(printf "subjectAltName=DNS:node-2.example.com,DNS:localhost,IP:127.0.0.1,RID:1.2.3.4.5.5,otherName:2.5.4.3;UTF8:node-2.example.com") -in node2.csr -out node2.crt.pem -CA signing.pem -CAkey signing-key.pem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I regenerated the node certificates using:
openssl genrsa -out node-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in node-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out node.key.pem
openssl req -new -key node.key.pem -subj "/C=DE/L=Test/O=Test/OU=SSL/CN=node-1.example.com" -out node.csr
openssl x509 -req -days 3650 -extfile <(printf "subjectAltName=RID:1.2.3.4.5.5,otherName:2.5.4.3;UTF8:node-1.example.com,DNS:node-1.example.com,DNS:localhost,IP:127.0.0.1") -in node.csr -out node.crt.pem -CA signing.pem -CAkey signing-key.pem
openssl genrsa -out node-new-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in node-new-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out node-new.key.pem
openssl req -new -key node-new.key.pem -subj "/C=DE/L=Test/O=Test/OU=SSL/CN=node-1.example.com" -out node-new.csr
openssl x509 -req -days 3650 -extfile <(printf "subjectAltName=RID:1.2.3.4.5.5,otherName:2.5.4.3;UTF8:node-1.example.com,DNS:node-1.example.com,DNS:localhost,IP:127.0.0.1") -in node-new.csr -out node-new.crt.pem -CA signing.pem -CAkey signing-key.pem
openssl genrsa -out node-wrong-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in node-wrong-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out node-wrong.key.pem
openssl req -new -key node-wrong.key.pem -subj "/C=DE/L=Test/O=Test/OU=SSL/CN=node-2.example.com" -out node-wrong.csr
openssl x509 -req -days 3650 -extfile <(printf "subjectAltName=RID:1.2.3.4.5.5,otherName:2.5.4.3;UTF8:node-2.example.com,DNS:node-2.example.com,DNS:localhost,IP:127.0.0.1") -in node-wrong.csr -out node-wrong.crt.pem -CA signing.pem -CAkey signing-key.pem
and the tests pass locally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More details about subjectAltName
can be found here: https://www.openssl.org/docs/man1.0.2/man5/x509v3_config.html
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #2679 +/- ##
============================================
- Coverage 61.39% 61.35% -0.05%
Complexity 3383 3383
============================================
Files 269 269
Lines 18668 18668
Branches 3279 3279
============================================
- Hits 11462 11454 -8
- Misses 5611 5618 +7
- Partials 1595 1596 +1 see 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
I used the commands below to generate new certs:
In addition to generating node.crt.pem, node-new.crt.pem, node-wrong.crt.pem, kirk.crt.pem and spock.crt.pem I had to include the entire certificate chain in each file including the intermediate signing certificate and root certificate. I was not able to figure out how to automatically add the certificate chain when creating a .pem file. When bundling the certificates together in the same file the root certificate was placed at the bottom and the lowest level certificate on the top. |
This SO post describes how to add all certificates to the keystore. https://stackoverflow.com/a/9300727 In summary, the commands for kirk would be:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for helping with this Craig. Looks good to me!
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.x 1.x
# Navigate to the new working tree
cd .worktrees/backport-1.x
# Create a new branch
git switch --create backport/backport-2679-to-1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 bbd43ec56cf1d7913bbe49547b09558ac37bc89f
# Push it to GitHub
git push --set-upstream origin backport/backport-2679-to-1.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.x Then, create a pull request where the |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.3 1.3
# Navigate to the new working tree
cd .worktrees/backport-1.3
# Create a new branch
git switch --create backport/backport-2679-to-1.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 bbd43ec56cf1d7913bbe49547b09558ac37bc89f
# Push it to GitHub
git push --set-upstream origin backport/backport-2679-to-1.3
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.3 Then, create a pull request where the |
* Update certs for SecuritySSLReloadCertsActionTests Signed-off-by: Craig Perkins <[email protected]> * Add otherName back in Signed-off-by: Craig Perkins <[email protected]> * Ensure files end in new line Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> (cherry picked from commit bbd43ec)
* Update certs for SecuritySSLReloadCertsActionTests Signed-off-by: Craig Perkins <[email protected]> * Add otherName back in Signed-off-by: Craig Perkins <[email protected]> * Ensure files end in new line Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> (cherry picked from commit bbd43ec) Co-authored-by: Craig Perkins <[email protected]>
…t#2679) * Update certs for SecuritySSLReloadCertsActionTests Signed-off-by: Craig Perkins <[email protected]> * Add otherName back in Signed-off-by: Craig Perkins <[email protected]> * Ensure files end in new line Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Maciej Mierzwa <[email protected]>
…t#2679) * Update certs for SecuritySSLReloadCertsActionTests Signed-off-by: Craig Perkins <[email protected]> * Add otherName back in Signed-off-by: Craig Perkins <[email protected]> * Ensure files end in new line Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Maciej Mierzwa <[email protected]>
…t#2679) * Update certs for SecuritySSLReloadCertsActionTests Signed-off-by: Craig Perkins <[email protected]> * Add otherName back in Signed-off-by: Craig Perkins <[email protected]> * Ensure files end in new line Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Maciej Mierzwa <[email protected]>
…t#2679) * Update certs for SecuritySSLReloadCertsActionTests Signed-off-by: Craig Perkins <[email protected]> * Add otherName back in Signed-off-by: Craig Perkins <[email protected]> * Ensure files end in new line Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Maciej Mierzwa <[email protected]>
…t#2679) * Update certs for SecuritySSLReloadCertsActionTests Signed-off-by: Craig Perkins <[email protected]> * Add otherName back in Signed-off-by: Craig Perkins <[email protected]> * Ensure files end in new line Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Sam <[email protected]>
Description
This PR updates expired certs used in SecuritySSLReloadCertsActionTests
Test fix
Issues Resolved
#2675
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.