Page 1 of 1

proxychains and sabnzbdplus

Posted: February 7th, 2015, 6:40 am
by Kiesel
Hi,

I am trying to channel the traffic of sabnzbdplus through a socks5 proxy with "proxychains". The problem is that now I get the error that the webserver didnt start (which it did, I can access it). I am guessing the culprit is this line:

Code: Select all

|R-chain|-<>-127.0.0.1:51098-<><>-127.0.0.1:8085-<--timeout
The main issue is that sabnzbdplus says usenet-server connection successfull but doesn´t start downloading.

Did anyone successfully set up proxychains and sabnzbdplus?

Kiesel

Re: proxychains and sabnzbdplus

Posted: February 7th, 2015, 9:30 am
by sander
I think it would help if you posted what commands and setup you use.

Re: proxychains and sabnzbdplus

Posted: February 8th, 2015, 2:37 am
by Kiesel
I am running xubuntu 14.04 and start my stunnel using

Code: Select all

sudo stunnel
I then use 3proxy to create a socks5 proxy and authenticate at the stunnel. This works without a problem, I can use the socks5 with t.ex. foxyproxy in firefox.

Proxychains is configured to just pass the traffic through to this proxy that runs on port 6000

Code: Select all

strict_chain
proxy_dns
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks5 127.0.0.1 6000
And finally I start sabnzbdplus with

Code: Select all

proxychains sabnzbdplus
As I said sab complains that the webserver is not running but I can connect to it, no downloads start and the error I get on the command line is

Code: Select all

|R-chain|-<>-127.0.0.1:51098-<><>-127.0.0.1:8085-<--timeout
I tried the same with nzbget and it works there so the setup seems correct. Is there some setting I can use in sab to persuade it that the webserver is running and where it is running?

Re: proxychains and sabnzbdplus

Posted: February 9th, 2015, 6:34 am
by sander
Here's how I tested, with no problems with the webinterface and Test Server, but indeed no downloading. I don't know why not.

Start a Socks proxy:

Code: Select all

ssh -NfD 9050 <my-remote-server>
Contents of /etc/proxychains.conf (I only changes the last 2 lines) :

Code: Select all

$ cat /etc/proxychains.conf | grep -vi -e "^#" | grep -vi "^$"
strict_chain
proxy_dns 
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks4 	127.0.0.1 9050
Start SABnzbd, with local LAN address and an unused port (both on local and remote system):

Code: Select all

proxychains ./SABnzbd.py -s 192.168.1.113:12222 -l2 -f sab-proxychain2.ini
I then get the SABnzbd wizard on http://192.168.1.113:12222/sabnzbd/. Clicking on Test Server results in "Connection Successful!", but no downloading by SABnzbd itself. :o

proxychains logging to the screen, first the Test Server, then autonomous output:

Code: Select all

|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.113:12222-|DNS-request| newsreader3.eweka.nl 
|S-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| newsreader3.eweka.nl is 81.171.92.205
|DNS-request| newsreader3.eweka.nl 
|S-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| newsreader3.eweka.nl is 81.171.92.205
|S-chain|-<>-127.0.0.1:9050-<><>-81.171.92.205:119-<><>-OK
<--timeout
|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.113:12222-<--timeout
|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.113:12222-<--timeout
|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.113:12222-<--timeout
|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.113:12222-<--timeout
The ssh terminal says:

Code: Select all

channel 6: open failed: connect failed: Connection timed out
channel 7: open failed: connect failed: Connection timed out
channel 8: open failed: connect failed: Connection timed out
channel 9: open failed: connect failed: Connection timed out
channel 10: open failed: connect failed: Connection timed out
channel 2: open failed: connect failed: Connection timed out
channel 4: open failed: connect failed: Connection timed out
channel 3: open failed: connect failed: Connection timed out
channel 5: open failed: connect failed: Connection timed out
channel 6: open failed: connect failed: Connection timed out
channel 7: open failed: connect failed: Connection timed out

Re: proxychains and sabnzbdplus

Posted: February 9th, 2015, 7:55 am
by sander
As a base test, I created a small NNTP test program called sj-nntplib-test.py:

Code: Select all

#!/usr/bin/env python
import nntplib
import sys

s = nntplib.NNTP('newsreader3.eweka.nl', 119, 'blabla', 'blabla')
print s.getwelcome()

print s.help()

resp, count, first, last, name = s.group('alt.binaries')
print resp, count, first, last, name

s.quit()
and that works within proxychains:

Code: Select all

sander@flappie:~$ proxychains python sj-nntplib-test.py
ProxyChains-3.1 (http://proxychains.sf.net)
|DNS-request| newsreader3.eweka.nl 
|S-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| newsreader3.eweka.nl is 81.171.92.205
|S-chain|-<>-127.0.0.1:9050-<><>-81.171.92.205:119-<><>-OK
200 Welcome to Eweka (fx23.am4)

('100 Legal Commands', ['  article [<messageid>|number]', '  authinfo type value', '  body [<messageid>|number]', '  date', '  group newsgroup', '  head [<messageid>|number]', '  help', '  last', '  list [active wildmat|active.times|counts wildmat]', '  list [overview.fmt|newsgroups wildmat]', '  listgroup newsgroup', '  mode reader', '  next', '  post', '  stat [<messageid>|number]', '  xhdr field [range]', '  xover [range]', '  xpat field range pattern', '  xfeature useragent <client identifier>', '  xfeature compress gzip [terminator]', '  xzver [range]', '  xzhdr field [range]', '  quit'])

211 41834330 2250761 44085090 alt.binaries 41834330 2250761 44085090 alt.binaries
sander@flappie:~$ 
That proves it works. Now only make it clear to SABnzbd ... ;)

Re: proxychains and sabnzbdplus

Posted: February 9th, 2015, 12:34 pm
by sander
Maybe downloader.py (AFAIK the main news articles downloader) does not use the same mechanism as servertests.py?
Maybe downloader.py does explicit binding to a local IP address for outbound connections?

I'll see if SP can shine his light on this.

Re: proxychains and sabnzbdplus

Posted: February 9th, 2015, 3:55 pm
by shypike
Both pieces of code use the same method.
It would require tracing with a Python debugger to find out what happens.
The problem is, I don't know anything about proxychains; so creating a test situation is a challenge.
SABnzbd doesn't anything specific relating to proxies, so anything that happens
is a by-product of the Python libraries.
BTW: the standard NNTP library isn't used, since it is incomplete and doesn't support SSL.

Re: proxychains and sabnzbdplus

Posted: February 9th, 2015, 4:32 pm
by sander
OK, thanks SP.

More analysis ... and this is a very long shot:

When I click on "Test Server", this is shown in the terminal running "proxychains sabnzbdplus ...":

Code: Select all

|DNS-request| newsreader3.eweka.nl 
|S-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| newsreader3.eweka.nl is 81.171.92.205
|DNS-request| newsreader3.eweka.nl 
|S-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| newsreader3.eweka.nl is 81.171.92.205
|S-chain|-<>-127.0.0.1:9050-<><>-81.171.92.205:119-<><>-OK
So first a DNS request, then a connection from 127.0.0.1:9050 to newsserver 81.171.92.205:119. Note: this is my guess-interpretation of the proxychains logging.

When I leave the terminal running, this appears:

Code: Select all

|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.148:11111-<--timeout
|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.148:11111-<--timeout
|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.148:11111-<--timeout
|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.148:11111-<--timeout
|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.148:11111-<--timeout
|S-chain|-<>-127.0.0.1:9050-<><>-192.168.1.148:11111-<--timeout
So ... if my guess is correct, this means SABnzbd is trying to make a connection to ... 192.168.1.148:11111 ... which is its own interface, not a newsserver

Now the interesting part: SAB's gui shows this message:
2015-02-09 22:20:36,926 WARNING: Error: Session Key Incorrect
... that could be true if indeed SAB is trying a 'news' connection to its own web interface ...