-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Strip trailing dot of hostname to fix SSL certificate verification issue (correct setup w/ unit test) #5253
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
base: master
Are you sure you want to change the base?
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
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.
Pull request overview
This PR reapplies functionality to strip trailing dots from hostnames during SSL certificate verification, which was previously reverted. The trailing dot causes certificate validation failures because X.509 certificates don't include dots in Subject Alternative Names, while DNS uses them to indicate absolute FQDNs.
- Adds
rd_kafka_ssl_normalize_hostname()function to strip trailing dots from hostnames - Updates SSL endpoint identification to use normalized hostnames for both SNI and certificate verification
- Implements comprehensive unit tests for hostname normalization edge cases
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/rdkafka_ssl.c | Implements hostname normalization function and integrates it into SSL endpoint identification flow, adds unit tests |
| src/rdunittest.c | Registers the new SSL unit test in the test framework |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #if ENABLE_DEVEL | ||
| RD_EXPORT | ||
| #else | ||
| static | ||
| #endif | ||
| const char *rd_kafka_ssl_normalize_hostname(const char *hostname, |
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.
This is just static, the unit test runs from the same file.
| #if ENABLE_DEVEL | |
| RD_EXPORT | |
| #else | |
| static | |
| #endif | |
| const char *rd_kafka_ssl_normalize_hostname(const char *hostname, | |
| static const char *rd_kafka_ssl_normalize_hostname(const char *hostname, |
| return 0; | ||
| } | ||
|
|
||
| #if WITH_SSL |
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.
Remove this condition as the rdkafka_ssl.c file is already included only when SSL is enabled. In Makefile:
SRCS_$(WITH_SSL) += rdkafka_ssl.c
Combining the original PR to address the trailing dot bug (#5231) which was reverted as it was breaking master and the PR to add unit test (#5244)
Jira: https://confluentinc.atlassian.net/browse/NONJAVACLI-4101