-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
clientconn: set dial target "Authority" with target address #2650
Conversation
When user dials with "grpc.WithDialer", "grpc.DialContext" "cc.parsedTarget" update only happpens once. This is problematic, because when TLS is enabled, retries happen through "grpc.WithDialer" with static "cc.parsedTarget" from the initial dial call. If the server authenticates by IP addresses, we want to set a new endpoint as a new authority. Otherwise "transport: authentication handshake failed: x509: certificate is valid for 127.0.0.1, 192.168.154.254, not 192.168.208.149" when the new dial target is "192.168.154.254" whose certificate host name is also "192.168.154.254" but client tries to authenticate with previously set "cc.parsedTarget" field "192.168.208.149" Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
I am not sure if this is the right fix, but at least this was the workaround that resolved the issue for us. |
/cc @menghanl can you take a quick look at this PR? it affects many projects right now. |
Sorry for the late reply. What's the dial target you passed to |
We have a base balancer and picker to implement |
It's unexpected to create a ClientConn to an IP, and then connect to a different IP using the same ClientConn. Also I think certificates should normally be signed for an abstract name, like "example.com", not IP. Some ideas: There's an option for balancer to control what credentials to use for each SubConn. You can configure the client to skip the verification (InsecureSkipVerify). This won't protect you from man-in-the-middle attacks, but if you trust your connections, it may be fine. You can also configure the server so it uses a different certificate based on the server name clients sends (SNI). |
Closing for now. Please reply if you have more questions. Thanks! |
Why cannot we dial to an IP, and then supply the balancer with alternative IP addresses as different backends? I think this is also a valid use case. |
@xiang90 With that being said, dialing to an IP but connect to a different IP works with dialer or balancer, but it breaks the address hierarchy that was assumed, so extra work need to be done to fix the gap, like the balancer option to configure credentials I mentioned above. |
I am creating this PR, in order to start a discussion :)
When user dials with "grpc.WithDialer", "grpc.DialContext" "cc.parsedTarget"
update only happpens once. This is problematic, because when TLS is enabled,
retries happen through "grpc.WithDialer" with static "cc.parsedTarget" from
the initial dial call.
If the server authenticates by IP addresses, we want to set a new endpoint as
a new authority. Otherwise
when the new dial target is "192.168.154.254" whose certificate host name is also "192.168.154.254"
but client tries to authenticate with previously set "cc.parsedTarget" field "192.168.208.149"
ref.
/cc @xiang90 @jpbetz
To add more details, this is the etcd use case.
Server 1 certificate:
Server 2 certificate:
Server 3 certificate:
Server 1
.grpc.WithDialer
while passing the first endpoint in the slice to the balancer, later to be used for parsed target)192.168.84.19
is the IP requesting the client calls.