Saturday, November 28, 2009
1:40 AM

SSH PROXY AND SOPCAST

This moderately complex how-to applies when we have no access to: broker.sopcast.com e.g.:
ping broker.sopcast.com - returns 100% packet loss and the user wants to use its services.

Sopcast is well known p2p internet tv platform. See http://www.sopcast.com .
broker.sopcast.com is the tracker which finds peers and makes sopcast network function normally.

Prerequisites:
1. tsocks - available for debian and ubuntu , probably every distro may have it.
2. ssh client (usually typing ssh in terminal is enough)
3. shell (ssh) access to a pc from whose internet we can freely ping broker.sopcast.com :)
Step 3 seems the toughest but you ask a friend to give you ssh access to watch some sport event on sopcast.
Actual steps for making sopcast work even when we cannot ping broker.sopcast.com :

1. Run in terminal: ssh user@sshaccess.com -D 8000

Please note -D 8000 which is important - it leaves port 8000 on localhost (127.0.0.1) open and bound to sshaccess.com - our ssh remote example server. That should be a kinda ssh tunnel :)

2. Run in terminal: sudo vi /etc/tsocks.conf - edit the end of file where things look like:
###############
server = 127.0.0.1
# 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 = 8000
# 8000 is the port we set earlier - if you set another , edit accordingly , 127.0.0.1 remains.
###############

3. Export some command line variables (in terminal) borrowed from the tor's torrify howto in their wiki:

http_proxy=http://127.0.0.1:8000/
HTTP_PROXY=$http_proxy
export http_proxy HTTP_PROXY
Pay attention to the port 8000 - my example started with it and I stick to it :)

5. Start sopcast with that weird command line :

tsocks sp-sc sop://211.152.36.38:3912/6015 8900 8200

Where:
tsocks invokes sp-sc loading this sopcast address sop://211.152.36.38:3912/6015 which is the address of discovery channel in sopcast.
If you need more sopcast addresses try to figure them out here:
http://www.sopcast.com/gchlxml
8900 is localport - I chose that number randomly , you may choose freely here
8200 is the port where the stream on our pc will be , mplayer or vlc will need it, also possible to put any port you like.

5. Finally use mplayer or vlc to watch the local stream that sp-sc produces using that command.

mplayer http://127.0.0.1:8200/

In conclusion I might add that if you put a little imagination after understanding this example it should be possible to use sopcast over tor , although I find that unethical and slow , never tried it. But if you lack the ssh access mentioned in the 3rd prerequisite - tor would be your last resort.
Enjoy.

0 comments:

Post a Comment