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

attempt to detect improper TLS config #843

Merged
merged 3 commits into from Mar 5, 2022

Conversation

rhansen2
Copy link
Collaborator

@rhansen2 rhansen2 commented Feb 7, 2022

when an io.ErrUnexpectedEOF is returned when reading
a correlation ID, attempt to detect if the messages
from the broker was a TLS Alert Message and decorate
the returned error

var sizeBytes [4]byte
binary.BigEndian.PutUint32(sizeBytes[:], uint32(size))
if looksLikeUnexpectedTLS(sizeBytes) {
err = fmt.Errorf("%w: broker appears to be expecting TLS", io.ErrUnexpectedEOF)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure what the best way to phrase this message is.

when an io.ErrUnexpectedEOF is returned when reading
a correlation ID, attempt to detect if the messages
from the broker was a TLS Alert Message and decorate
the returned error
Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

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

Looking good to me!

protocol/response.go Outdated Show resolved Hide resolved
Co-authored-by: Achille <achille.roussel@gmail.com>
@rhansen2 rhansen2 merged commit 34e8f71 into segmentio:main Mar 5, 2022
@rhansen2 rhansen2 deleted the detect-unexpected-tls branch March 5, 2022 00:57
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.

None yet

2 participants