Wow thanks for that last answer.
Together with this "SSH to get your iPhone online via USB cable" blog post, I came up with a pretty solid instant reverse SSH/SOCKS solution over USB tether given only an SSH server somewhere on your network. This allows all my tcp-based apps to use an SSH server's internet across USB despite my WiFi being defective and not having a strong phone data plan (T-Mobile Prepaid).
No proxy server configuration required.
The gist of the blog post is that you CAN control the proxy from the command line. Use the file:
/private/var/preferences/SystemConfiguration/preferences.plist
Find the "ip1" section (if you want to replace GPRS/EDGE/3G interface) like:
<dict>
<key>Interface</key>
<dict>
<key>DeviceName</key>
<string>ip1</string>
<key>Hardware</key>
<string>com.apple.CommCenter</string>
<key>Type</key>
<string>com.apple.CommCenter</string>
</dict>
Be careful that you got the ip1 section if you want to override EDGE/3G! Do not look for the other Proxies entries in the file.
Then add the following section afterwards:
<key>Proxies</key>
<dict>
<key>ProxyAutoConfigEnable</key>
<integer>1</integer>
<key>ProxyAutoConfigURLString</key>
<string>file:///private/var/preferences/proxy.pac</string>
</dict>
Then use your trick to specify an SOCKS proxy in the file we just specified:
/private/var/preferences/proxy.pac
Add:
function FindProxyForURL(url, host)
{
return "SOCKS 127.0.0.1:1080";
}
Change permissions on proxy.pac to 777 (all can read, write, execute).
Reboot the iPhone.
Download iTunnel for iTunes 9 (older versions are available too). (http://www.mediafire.com/?2q1fzowoy12)
Create a new Putty Connection: in Connection>SSH>Tunnels section add new forwarded "remote" port, like port 202 on the iPhone to your internet-facing SSH server (say, 192.168.2.100:22).
Source Port: 202
Destination: 192.168.2.100:22
In the SSH section of the same Putty Connection set your Remote Commmand to:
ssh -D 1080 [email protected] -p 202
Save your Putty configuration to a new named session.
Optionally generate keys & add the public keys to *~/.ssh/authorized_keys* to both ends so you don't need to type passwords. Use putty.exe -load "Profile Name" in a shortcut to speed it up even more.