Adding SOCKS support for SAB

Want something added? Ask for it here.
bullox
Newbie
Newbie
Posts: 5
Joined: November 5th, 2009, 8:37 am

Re: Adding SOCKS support for SAB

Post by bullox »

So this fix can't be done on OSX unless i run it from sources? sucks. Well thanks anyways!
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Adding SOCKS support for SAB

Post by shypike »

I am willing to add the code to the next release.
However, I have 0 means of testing it.
All I have been able to test is that the added code doesn't disturb normal operation.
f00b4r
Newbie
Newbie
Posts: 8
Joined: February 21st, 2010, 4:00 pm

Re: Adding SOCKS support for SAB

Post by f00b4r »

SOCKS for SSL is as simple as stated by crk, around line 164 of newswrapper.py :

Code: Select all

s = socks.socksocket()
s.setproxy(2,sabnzbd.cfg.socks_host.get(),sabnzbd.cfg.socks_port.get(),"True",sabnzbd.cfg.socks_login.get(),sabnzbd.cfg.socks_password.get())
#self.sock = SSLConnection(ctx, socket.socket(af, socktype, proto))
self.sock = SSLConnection(ctx, s)
As you can see I am using parameters found in the config. It is also quite easy, just have to add the following to cfg.py aroud line 188 :

Code: Select all

socks_host = OptionStr('misc', 'socks_host','proxy.example.com')
socks_port = OptionNumber('misc', 'socks_port',8080)
socks_login = OptionStr('misc','socks_login',"login")
socks_password = OptionStr('misc','socks_password',"password")
As for using these parameters in the web interface...not that easy , but stille doable. But the dev team should not find that really difficult :)

In config_server.tmpl (for "smpl" skin) :

Code: Select all

<label class="label">Proxy:</label><input type="text" name="socks_host" value="$servers[$server]['socks_host']" ></label>
<br class="clear" />
<label class="label">Port:</label><input type="text" name="socks_port" value="$servers[$server]['socks_port']" ></label>
<br class="clear" />
<label class="label">Login:</label><input type="text" name="socks_login" value="$servers[$server]['socks_login']" ></label>
<br class="clear" />
<label class="label">Password:</label><input type="password" name="socks_password" value="$servers[$server]['socks_password']" ></label>
<br class="clear" />
In config.py, line 343 :

Code: Select all

self.socks_host = OptionStr('misc', 'socks_host','proxy.example.com',add=False)
self.socks_port = OptionNumber('misc', 'socks_port',8080,add=False)
self.socks_login = OptionStr('misc', 'socks_login','login',add=False)
self.socks_password = OptionStr('misc', 'socks_password','password',add=False)
It is really dirty...but it works. As I look back at it, maybe I've made some mistakes :)
shockin
Newbie
Newbie
Posts: 2
Joined: October 28th, 2010, 8:57 am

Re: Adding SOCKS support for SAB

Post by shockin »

Will this be implemented in the next version?
User avatar
noroger
Newbie
Newbie
Posts: 3
Joined: October 30th, 2010, 7:55 pm

Re: Adding SOCKS support for SAB

Post by noroger »

Pardon my foolishness, but where is the "/sabnzbd/newswrapper.py"? I don't see it in my SABnzbd 0.5.4 dir
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Adding SOCKS support for SAB

Post by shypike »

You need to download the source distribution (ending in tar.gz),
setup ActiveState Python and install some Python modules.
http://wiki.sabnzbd.org/windows-source
User avatar
noroger
Newbie
Newbie
Posts: 3
Joined: October 30th, 2010, 7:55 pm

Re: Adding SOCKS support for SAB

Post by noroger »

argh, way too much messing around with my expertise.


Either I go back to using alt.binz or use a VPN service  :(
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Adding SOCKS support for SAB

Post by shypike »

I understand.
Proxy support has a low priority now as we're completing the next major release.
User avatar
noroger
Newbie
Newbie
Posts: 3
Joined: October 30th, 2010, 7:55 pm

Re: Adding SOCKS support for SAB

Post by noroger »

no problem. I switched to a VPN for now but I really prefer SSH. It's cheaper and faster

but please do implement it, the code is already writen  :)
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Adding SOCKS support for SAB

Post by shypike »

noroger wrote: the code is already writen  :)
But only tested in one (maybe two) situations.
There is a huge variation in proxies (and the way they are configured).
Implementing it will lead to a lot of support issues, because it will
not work for everybody.
exussum
Jr. Member
Jr. Member
Posts: 79
Joined: November 18th, 2010, 2:51 am

Re: Adding SOCKS support for SAB

Post by exussum »

i know this is an old topic,

but is there any update ?

https://blueprints.launchpad.net/sabnzb ... nntp-proxy

Seen this that is scheduled for 0.6.x
Thanks for your efforts !
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Adding SOCKS support for SAB

Post by shypike »

It's not going to happen, sorry.
There are just too many more urgent matters.
Other than that, I repeat that we could never test this in a sufficient number of situations.
It would give endless support questions.
exussum
Jr. Member
Jr. Member
Posts: 79
Joined: November 18th, 2010, 2:51 am

Re: Adding SOCKS support for SAB

Post by exussum »

Does sab use the defualt connection ?

Eg in windows the one Chrome and IE use or a direct connection like firefox ?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Adding SOCKS support for SAB

Post by shypike »

The behaviour is a bit uneven.
The Usenet connections are always direct.
However, http traffic to index sites will be routed through the active proxy for IE.
The latter is just incidental, because that's how Python's http support library works.
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: Adding SOCKS support for SAB

Post by sander »

FWIW: the smallest SOCKS server on Linux / Ubuntu is this:

Code: Select all

ssh -D 1080 localhost
You have to type your local login password. And that's it: your SOCKS server is running! (Well, you must have ssh server installed and running).

To test that your SOCKS server is running, you can set your webbrowser's SOCKS setting to 127.0.0.1 and port 1080. It works for my Chrome. :)

And this way I was able to run the SOCKS-pached version of SABnzbd. Although technically interesting, I don't see a good reason to have SOCKS in SABnzbd; AFAIK, SOCKS is used on corporate networks. On such corporate networks, I would say using SABnzbd is "not done".


PS: If you have a login somewhere on some remote *ix system, you can use that system as a SOCKS too: just type "ssh -D 1080 [email protected]". The SOCKS server will be local, and will tunnel the traffic to / through that remoteserver. So the SOCKS proxy server is a tunnel from your own machine via the remote server to Internet.
Keep using 127.0.0.1 and 1080 as your SOCKS settings in Chrome, and Chrome will use the remoserver.com as SOCKS proxy ... check with http://whatismyipaddress.com/ or http://test-ipv6.com/ :)
Post Reply