-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Disconnect Postgres clients attempting plaintext connection #10089
Conversation
8f1ed0a
to
cdfefb5
Compare
Having an error in tests like
I expect that's because I'm trying to read at least 5 bytes before doing anything else, and that's invalid for short messages. The check at the top of the loop isn't doing what I thought, so maybe we have to return false, nil in the case of a short message, however then it seems that a short message that is an exact match for the initial bytes of PostgresStartTLS would have an issue? For example if there is some protocol that initially sends 4 bytes as int32(8). |
can you rebase your PR onto the v3.0 branch? |
cdfefb5
to
56c7618
Compare
Ok done! Thank you. |
Hello @sjmiller609, Thank you for your contribution! We reviewed the changes and have some feedback on the drawbacks of it, as you already have identified. The While we don't have in mind any protocol for which the client initiates a first message lower than 5 bytes, we do not want to introduce a breaking behavior. We lack a non-blocking way to check the first bytes sent by a client, and the only other alternative would be to make that behavior optional. Still, we are not comfortable with adding yet another very specific option to the Traefik static configuration. For these reasons, we are declining this PR. As a workaround, and as long as the entryPoint would not be used to handle non-TLS HTTP nor another non-TLS TCP service, one can attach a TCP catchAll router routing to an empty TCP server load balancer. Example with the file provider: tcp:
routers:
catchAll:
entryPoints:
- "[PostGRES dedicated entryPoint]"
rule: "HostSNI(`*`)"
service: empty
services:
empty:
loadBalancer:
servers: {} |
It works! 🎉
related helm chart values
|
What does this PR do?
TCP disconnect when a Postgres client is attempting a plaintext connection, instead of just hanging the connection.
Motivation
#9929
More
Additional Notes