Why use a SOCKS proxy?
Using a SOCKS proxy and combining it with an SSH connection is a great way to make sure your traffic remains encrypted on your iOS device.
This is particularly useful when surfing the web at unprotected wifi access points, for example, at Starbucks, McDonald’s or at the airport. SSH will make sure that your traffic and communications remain private on your iPhone or iPad.
Another essential use is for bypassing college, company, or ISP firewalls. SSH can be used to gain access to content that your university or enterprise does not want you to access. For example, you can enable access to games, p2p, or blocked websites.
SOCKS proxy on iPhone/iPad
Now let’s set up a SOCKS proxy, with SSH support, on your iOS device.
iOS PAC File
- Download this .pac file (right-click -> save as) (courtesy of Thireus).
- SSH into your iPhone/iPad (or alternatively use iFile if you don’t wish to use SSH), and place the proxy.pac file in the following location:
- Make sure to set the permissions of the proxy.pac file so that root can read, write and execute the file.
Install Cydia Unix Apps
- Launch Cydia and download the following apps: inetutils, connect.c, automatic SSH, screen, MobileTerminal, and OpenSSH.
You must also make sure your Cydia User Info is set as ‘Hacker’ or ‘Developer’. Go to ‘Sources’, ‘Settings’, and choose ‘Hacker’ or ‘Developer’. Press ‘Reload’ on the main Cydia screen.
iOS SSH Tunnel Settings
Now that we have all of the software, we must configure the SSH tunnel correctly so that Safari and all of your other apps can properly connect to it through your SOCKS proxy.
- Launch MobileTerminal
- Press the ‘i’ icon on the right of the screen.
- Press ‘Shortcut Menu’, then ‘+’ at the top right of the screen.
- Under ‘Shortcut Action’ add your SSH tunnel command.
Here is what I use:
autossh -M 12345 -D 1080 -C -p <ssh port> -N <user>@<ssh server>.
- Change the command to whatever suits your needs: Insert your port, username, and server address. Enter a name in the blank box above your command. Example: “My SSH connection”.
- Press ‘Done’, then ‘Back’ twice. To run your SSH command, press the ‘i’ button and then press “My SSH connection”, or whatever you named it. This will run the command and thus connect to your SSH server.
iOS SOCKS settings
By this stage, you have a working SSH connection set up on your iPhone/iPad. Now we must configure iOS to use a SOCKS proxy, which will allow Safari and all of your apps to use the SSH connection.
- Press the Home button. This will exit MobileTerminal, however it will continue to run the SSH connection in the background, so don’t worry about that!
- Navigate to ‘Settings’, ‘Network’, ‘Wifi’, <‘blue button’ your network>, ‘HTTP Proxy’, ‘Auto’, and enter the location of the .pac file in the ‘URL’ field. It should be:
- This specifies your Wifi connection to use the SSH tunnel through the SOCKS proxy .pac file. This means all of your iPhone and iPad apps, including Safari, will use the SOCKS proxy with SSH.
Congratulations! If you followed this guide perfectly, the operation should be complete. You should have all of your apps using a SOCKS proxy and SSH on your iPhone or iPad.
If you are having any problems, please leave a comment and I’ll try my best to help you out.