-
Notifications
You must be signed in to change notification settings - Fork 690
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
SNI lost when using httpproxy as TLS, TCP reverse Proxy #4373
Comments
Hi @Jochen-dba, I believe this feature is currently not implemented but it sounds like a good feature. I think "passing" the SNI from downstream to upstream is not supported by Envoy, but it would be possible to set the SNI to a specific value. We have that for HTTP connections (via header policy) but it seems to be missing for TCPProxy. |
Agreed, it seems reasonable to set the SNI for a forwarded connection to whatever it was on reception. |
Hello and good morning from europe @tsaarni, @youngnick, hope you've had a good weekend! I'm very happy to hear that you like the idea of having this feature. I had a closer look at header policy and as expected it cannot be used for TCP as you already correctly pointed out. I also had a closer look at Upstream Validation: According to #2893 the ExtensionService processing configures Envoy to send a SNI server name when upstream TLS validation is enabled. Surprisingly to me the API already allows us to set
Unfortunately my tests showed, that none of those three things happen. Further I was able to verify that at least my expectations 1) and 2) indeed are satisfied for So to summarise my findings:
In case my findings are correct this could maybe easily be implemented and we might be able to achieve a "quick win" here. Many thanks again & best Regards, |
Thanks for the great investigation and detailed report @Jochen-dba. I agree that the I also agree that replicating that behavior seems like it should be straightforward. Writing end-to-end tests to validate it may be a bit tricky, but worthwhile anyway. I've labelled this and added it to the milestone, we'll see if we can get it done. I've also marked it as help-wanted, as it seems eminently doable even for someone not super familiar with the code. |
Hey @youngnick, thanks a lot - sounds great! As I never used Go before I was not confident enough to try this on my own. Best Regards, |
@Jochen-dba did you get a change to work on this? Just checking in since contour v1.21 is coming soon in case you wanted to get your work into that release |
Hello @sunjayBhatia, unfortunately I didn't manage to work on this until now. Best regards, |
Hello,
I'm trying to use HTTPPROY as TLS, TCP reverse Proxy for MongoDB.
This is my YAML:
Why?:
*.cluster-local
.(ACME cannot validate *.cluster-local)
*.externaldomain.com
)I successfully terminate TLS (certificates valid for external FQDN) using
spec.virtualhost.tls
The TCP traffic which is encapsulated in TLS is forwarded:
spec.tcpproxy
I use upstream TLS:
spec.tcpproxy.services.protocol
All of this works - the only issue is: it seems like due to TLS termination SNI from the Client is not passed into the upstream TLS connection. Unfortunately the MongoDB Server requires the SNI for Split-Horizon (which is in turn required for clients outside of k8s):
https://docs.mongodb.com/kubernetes-operator/master/reference/k8s-operator-specification/#spec.connectivity.replicaSetHorizons
Using
spec.virtualhost.tls.passthrough
is unfortunately not an option, as this would present the certificates which are only valid for*.cluster-local
to the client.What could I do to preserve the external clients SNI while terminating TLS and using upstream TLS via HTTPPROXY with TLS encapsulated TCP traffic?
Is there a feature to achieve this I'm not aware of?
Many, many thanks & best Regards,
Jochen
The text was updated successfully, but these errors were encountered: