Tutorials Linux Emulator Networking Proxy Firewall

From WebOS Internals
Revision as of 00:01, 19 November 2010 by Hemna (talk | contribs) (Create the tsocks.conf file)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Howto proxy network connections in Emulator

Get tsocks

Since the emulator is running as x86, you can just copy over your tsocks files from your linux distro

  • Fire up the emulator (palm-emulator)
  • copy tsocks to Emulator -> /usr/local/bin
scp -P 5522 /usr/bin/tsocks root@localhost:/usr/local/bin
  • copy libtsocks.so to Emulator -> /usr/lib
scp -P 5522 /usr/lib/libtsocks.so root@localhost:/usr/lib

Create the tsocks.conf file

# This is the configuration for libtsocks (transparent socks)
# Lines beginning with # and blank lines are ignored
# The basic idea is to specify:
#	- Local subnets - Networks that can be accessed directly without
#			  assistance from a socks server
#	- Paths - Paths are basically lists of networks and a socks server
#		  which can be used to reach these networks
#	- Default server - A socks server which should be used to access 
#			   networks for which no path is available
# Much more documentation than provided in these comments can be found in
# the man pages, tsocks(8) and tsocks.conf(8)

# Local networks
# For this example this machine can directly access 
# (192.168.0.*) and (10.*)

local =
local =
#local = <Network for your personal network>/<netmask>

# Paths
# For this example this machine needs to access as 
# well as port 80 on the network through
# the socks 5 server at (if this machines hostname was 
# "socks.hello.com" we could also specify that, unless --disable-hostnames
# was specified to ./configure).

##path {
#	reaches =
#	reaches =
#	server =
#	server_type = 5
#	default_user = delius
#	default_pass = hello

# Default server
# For connections that aren't to the local subnets or to
# the server at should be used (again, hostnames could be used
# too, see note above)

#server =
server = <IP OF YOUR socks proxy>
# Server type defaults to 4 so we need to specify it as 5 for this one
server_type = 5
# The port defaults to 1080 but I've stated it here for clarity 
server_port = 1080 

default_user = user@host
default_pass = <password here>
  • You can test your config file by doing this
/usr/local/bin/tsocks wget http://www.cnn.com
  • If you are behind the socks proxy and the tsocks.conf is setup correctly, then the wget command should work.

Shim LunaSysMgr

Permanently shim LunaSysMgr

  • You can force LunaSysMgr to always use the proxy by editing the upstart script that lives in /etc/event.d
  • Add the tsocks line in front of the call to exec LunaSysMgr
  • vi /etc/event.d/LunaSysMgr and update the exec line to make it look like this:
exec /usr/local/bin/tsocks /usr/bin/LunaSysMgr -s `cat /var/luna/preferences/sysmgr-args`
  • reboot the emulator. enjoy.