Minecraft is very cool, much fun, but it doesn't appear to be listening when I tell it to use a SOCKS proxy for multiplayer connections.

In Java 8 (my version is 1.8.0_65), under section 2.4 of this page in the documentation, it says the following:

There are 2 system properties related to SOCKS:

  • socksProxyHost for the host name of the SOCKS proxy server
  • socksProxyPort for the port number, the default value being 1080

However, when running MC with the following options concatenated onto the end of the JVM arguments:

-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=8080 -DproxySet=true

or

-Djava.net.useSystemProxies=true

It does not send the information through SOCKS. I have tested this server in Safari and it works just fine (external IP address changes). (note that this is using localhost as I run the SOCKS server in the background through a tunnel to an SSH server).

I've also tried manually starting launcher.jar with these options, but to no avail.

Am I missing something here?


Solution 1:

This is a documented bug...

And it doesn't look like it's getting fixed anytime soon. However, I'm going to play with modifying the .jar file and edit this answer when I've found the solution through that method.

Solution 2:

Another Method

Even though the SOCKS forwarding is not done, we can do something else (slightly more annoying to configure, but it works).

Firstly, start up your SOCKS connection. Then, start up your launcher with the following command:

java -jar -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=<proxy port> -DproxySet=true -Dhttp.nonProxyHosts="localhost|127.0.0.1" /path/to/launcher.jar

Also add the following command line arguments to your Minecraft Profile:

-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=<proxy port> -DproxySet=true -Dhttp.nonProxyHosts="localhost|127.0.0.1" 

Replace <proxy port> with the port number you normally use to connect to SOCKS. This is to allow us to still be recognized as a valid session (because we're connecting from the correct IP).

Using your SOCKS server information, we can port forward by pure ssh:

ssh -N -f -q <SOCKS proxy IP> -L 25565:<MC server IP>:<MC server port>

Replace all the things in <> with the correct information, then go to your Minecraft server list and add the following server address:

localhost:25565

Connect to that server, and bingo. This connects through an encrypted SSH tunnel rather than via SOCKS.