Bug #77924 JDBC SOCKS should not perform local DNS resolution
Submitted: 3 Aug 2015 23:09 Modified: 7 Apr 2022 22:02
Reporter: David Phillips Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.35 OS:Any
Assigned to: Alexander Soklakov CPU Architecture:Any
Tags: jdbc, socks

[3 Aug 2015 23:09] David Phillips
Description:
When connecting over SOCKS using the recently added "socksProxyHost" property, the InetSocketAddress should be created as an unresolved address to allow resolution to happen via the proxy, rather than performing resolution locally.

A common reason for using a proxy is to access something not available on the local network. For example, accessing a machine on a production network from a corporate network. In such cases, the DNS might not even be available locally (e.g. internal server names only resolve on the production network).

Another potential issue is address types: the client machine and target machine might both have IPv4 and IPv6 addresses, but the proxy only has IPv6. In this case, resolving an IPv4 address on the client means that the proxy won't be able to connect, but if the proxy resolved the address, it would correctly choose the IPv6 address.

Instead,

How to repeat:
Connect to to a remote machine via SOCKS using a hostname for the target MySQL database. Notice that the DNS resolution happens locally rather than the original hostname being passed to the proxy.

Suggested fix:
The driver should pass the hostname to the proxy as an unresolved address and let the proxy do the resolution.
[6 Jan 2022 7:01] Vipul Goel
Hi Team,

May I know when this issue will be fixed.
Or is there a workaround.

Please fix this soon it is affecting too much at our end.

Thanks,
Vipul goel
[7 Apr 2022 22:02] Daniel So
Posted by developer:
 
Added the following entry to the Connector/J 8.0.29 changelog: 

"A new connection property socksProxyRemoteDNS has been added, which, when set to true, makes the SocksProxySocketFactory execute its own connect() implementation that passes the unresolved InetSocketAddress of a MySQL Server host to the created proxy socket, instead of having the address resolved locally."