5

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?

6
  • Hi there. Several things come to mind after reading your post. First, 8080 is the default http port, it's possible that you already have another server running on port 8080 making it unusable for SOCKS. Have you tried the default port 1080? Second, what do you mean by "I run the SOCKS server in the background through a tunnel to an SSH server"? Are you running the server natively on your system? Are you redirecting all of the server's traffic through an SSH connection? If you could provide your SOCKS server configuration it would help! Why are you running a proxy server in your own computer? Mar 4 '16 at 8:56
  • @JoãoNeves 8080 is not being used (as I said, this works perfectly for Safari. ;P). I use SSH for SOCKS with ssh -D 8080 -f -C -q -N xx@xxxxxx, which requires me to connect through port 8080 on localhost (as it acts as a network tunnel). As for the server configuration, I'm not sure what I can say aside that AllowTcpForwarding is set to yes and the uncomplicated firewall is allowing inbound/outbound traffic through port 8080. Could you be more specific in that? Mar 4 '16 at 9:07
  • @JoãoNeves Also, just for progeny's sake, port 8080 is a typical port for proxies. Port 80 is the default HTTP port. ;) Mar 4 '16 at 9:15
  • I'm sorry, I'm having a hard time understanding your setup. If I understood correctly you have a computer (let's call it computer A) with SOCKS server and minecraft installed and you used ssh from a different computer (let's call it computer B) to log into computer A and test the proxy server with safari. Is that it? What I meant with proxy server configuration was the port it was listening to, but you already said it was 8080 ;). Right disregard that part of my comment I was thinking of default ports in webservers in development mode ;). Mar 4 '16 at 9:27
  • After digging up a little bit about socks and ssh (sorry, I didn't know how socks worked) I think I understood your setup. You told ssh to open up a proxy server on port 8080 with command ssh -D 8080 -f -C -q -N xx@xxxxxx and tested it successfully with safari. This was all done in the same computer, am I correct? If so, the only thing I can think of is to try to replace -DsocksProxyHost=127.0.0.1 with -DsocksProxyHost=localhost, not that it should have much impact though. I can't really e of any further assistance =/. Mar 4 '16 at 9:44
3

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.

3

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.

1
  • Also note that the Minecraft bootstrap .jar (the one downloaded from minecraft.net) accepts --proxyHost, --proxyPort, --proxyUser, --proxyPass arguments, which it actually passes down to the launcher and to the game itself without needing to edit command line arguments in the launcher. Still, these options are only used for authentication with Mojang, the communication to the server is always direct (I think it's by design, since it would be slow and you wouldn't be able to connect to local servers). But you can set up a static forwarding for that as you said.
    – matega
    Apr 25 '16 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.