Skip to content

Add AKI on certificate generation for brokers #11399

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

o-afanasenko
Copy link

@o-afanasenko o-afanasenko commented May 1, 2025

Type of change

Bugfix

Description

Closes #11375
This PR changes generation of secrets with alternative names which happens for broker and cruise control certificates (they have IP or DNS name). For them it adds AKI (authorityKeyIdentifier) which is required by Python >=3.13 Before this PR Python scripts failed on connection with exception

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Missing Authority Key Identifier (_ssl.c:1020)

This could be fixed by flag VERIFY_X509_STRICT=false.

Checklist

Please go through this checklist and make sure all applicable tasks have been done

  • Write tests
  • Make sure all tests pass
  • Update documentation
  • Check RBAC rights for Kubernetes / OpenShift roles
  • Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally
  • Reference relevant issue(s) and close them after merging
  • Update CHANGELOG.md
  • Supply screenshots for visual changes, such as Grafana dashboards

@o-afanasenko o-afanasenko force-pushed the issue-11375-add-aki branch from 61754af to 0d0d0c5 Compare May 1, 2025 11:57
Signed-off-by: Oleksiy Afanasenko <oleksiy.afanasenko@exness.com>
@o-afanasenko o-afanasenko force-pushed the issue-11375-add-aki branch 2 times, most recently from 52bfd7c to 9b5da50 Compare May 1, 2025 14:48
Signed-off-by: Oleksiy Afanasenko <oleksiy.afanasenko@exness.com>
@o-afanasenko o-afanasenko marked this pull request as ready for review May 2, 2025 06:33
@ppatierno ppatierno added this to the 0.47.0 milestone May 5, 2025
@@ -282,7 +284,7 @@ private void generateCaCert(File issuerCaKeyFile, File issuerCaCertFile,
}

csrFile = Files.createTempFile(null, null);
sna = buildConfigFile(subject, true);
sna = buildConfigFile(subject, true, false);
Copy link
Member

Choose a reason for hiding this comment

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

We can use true here right? Because it's going to add a AKI extension to the CA cert which will point just to itself as reported in the SKI.

Copy link
Author

@o-afanasenko o-afanasenko May 5, 2025

Choose a reason for hiding this comment

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

No, here CSR (request) is generated. I tried to put true here and got exceptions for all tests

Error adding request extensions from section v3_req
808C170602000000:error:11000079:X509 V3 routines:v2i_AUTHORITY_KEYID:no issuer certificate:crypto/x509/v3_akid.c:156:
808C170602000000:error:11000080:X509 V3 routines:X509V3_EXT_nconf_int:error in extension:crypto/x509/v3_conf.c:48:section=v3_req, name=authorityKeyIdentifier, value=keyid,issuer

For CA certificate is generated starting from line 299 (301) but it uses defaultConfig. Do you want to add AKI to CA cert?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I lost the CSR generation above.

Do you want to add AKI to CA cert?

I would do it for consistency across all the certificates generated by Strimzi. I know it's going to be a redundant copy of the SKI but it makes all the certificates looking the same from this pov. Do you see any drawbacks in doing it?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it is possible to add AKI to all certificates. I did the minimal changes to fix the problem. But if you want I can change PR to do this. What is better for you: add another openssl.conf to generate CSR or programatically remove authorityKeyIdentifier for CSR?

Copy link
Author

Choose a reason for hiding this comment

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

No drawbacks, maybe little redundant for CA but may be useful for client certificates

Copy link
Member

Choose a reason for hiding this comment

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

I think that the current programmatic approach would be better.

Copy link
Member

@scholzj scholzj left a comment

Choose a reason for hiding this comment

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

Aside from my comment on the issue ... how does this diff it against the existing certificate to know that it needs to be recreated? If it is used only for new certificates, it can create pretty wierd mess with some certs having it, some not etc.

@o-afanasenko
Copy link
Author

Aside from my comment on the issue ... how does this diff it against the existing certificate to know that it needs to be recreated? If it is used only for new certificates, it can create pretty wierd mess with some certs having it, some not etc.

This code itself doesn't cause rotation of certificates. To fix the issue I removed secret <cluster-name>_-kafka-brokers in Kafka namespace and strimzi operator recreated it. With new broker certificates the problem was fixed

@scholzj
Copy link
Member

scholzj commented May 6, 2025 via email

@o-afanasenko o-afanasenko force-pushed the issue-11375-add-aki branch from 5f73e1f to c14a159 Compare May 7, 2025 10:57
@o-afanasenko o-afanasenko force-pushed the issue-11375-add-aki branch from c14a159 to 086b88f Compare May 7, 2025 11:51
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.

Python >= 3.13 clients fail to connect with self-signed TLS certs due to VERIFY_X509_STRICT
3 participants