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

Extended /certificates endpoint with additional SSL certs info #4882

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

willyborankin
Copy link
Collaborator

@willyborankin willyborankin commented Nov 7, 2024

Description

Enhanced the /certificates endpoint to provide more detailed information. The endpoint now lists all certificates used by each node, with additional properties for each certificate, including:

  • format
  • alias
  • serial_number
  • has_private_key

Check List

  • New functionality includes testing
  • New functionality has been documented
  • New Roles/Permissions have a corresponding security dashboards plugin PR
  • API changes companion pull request created
  • Commits are signed per the DCO using --signoff

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.

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 71.49%. Comparing base (4aa7b1c) to head (a9d34d4).

Files with missing lines Patch % Lines
...lic/rest/api/ssl/CertificatesInfoNodesRequest.java 50.00% 3 Missing and 1 partial ⚠️
.../security/dlic/rest/api/CertificatesApiAction.java 66.66% 1 Missing and 1 partial ⚠️
...rg/opensearch/security/ssl/config/Certificate.java 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4882      +/-   ##
==========================================
+ Coverage   71.41%   71.49%   +0.07%     
==========================================
  Files         334      333       -1     
  Lines       22515    22533      +18     
  Branches     3585     3580       -5     
==========================================
+ Hits        16080    16110      +30     
+ Misses       4643     4632      -11     
+ Partials     1792     1791       -1     
Files with missing lines Coverage Δ
...ch/security/dlic/rest/api/ssl/CertificateInfo.java 82.69% <100.00%> (+28.69%) ⬆️
...h/security/dlic/rest/api/ssl/CertificatesInfo.java 100.00% <100.00%> (ø)
.../api/ssl/TransportCertificatesInfoNodesAction.java 96.29% <100.00%> (+6.55%) ⬆️
...org/opensearch/security/ssl/SslContextHandler.java 98.86% <100.00%> (+0.02%) ⬆️
...a/org/opensearch/security/ssl/config/CertType.java 100.00% <100.00%> (ø)
...rg/opensearch/security/ssl/config/Certificate.java 61.64% <0.00%> (+3.31%) ⬆️
.../security/dlic/rest/api/CertificatesApiAction.java 80.00% <66.66%> (-3.79%) ⬇️
...lic/rest/api/ssl/CertificatesInfoNodesRequest.java 73.68% <50.00%> (-19.18%) ⬇️

... and 4 files with indirect coverage changes


import java.util.Locale;

public enum CertificateType {
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this enum?

Copy link
Collaborator Author

@willyborankin willyborankin Nov 12, 2024

Choose a reason for hiding this comment

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

The main issue is the use of duplicate definitions for certificate types, which prevents the REST endpoint from providing information about transport client certificates. These certificates can be configured differently from standard transport certificates as extended SSL configuration.

@@ -51,6 +76,10 @@ public CertificateInfo(final StreamInput in) throws IOException {

@Override
public void writeTo(final StreamOutput out) throws IOException {
out.writeOptionalString(format);
Copy link
Member

Choose a reason for hiding this comment

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

Whenever reading and writing is modified, isn't it recommended to add to the end? There may be issues in a mixed cluster if a message is serialized from a newer node and communicates with an older node that doesn't understand the new values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True

Enhanced the /certificates endpoint to provide more detailed information. The endpoint now lists all certificates used by each node, with additional properties for each certificate, including:
 - "format"
 - "alias"
 - "serial_number"
 - "has_private_key"

Signed-off-by: Andrey Pleskach <ples@aiven.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants