Ubuntu + Proxy + Sickbeard

S1ght

Expert Member
Joined
Jan 23, 2006
Messages
3,301
Reaction score
27
Location
Berlin
So here's a head scratcher for the Linux gurus out there :)

So I have a Ubuntu 13.10 box sitting behind a proxy that makes use of Active Directory for Authentication. The Ubuntu is running Sickbeard/Couchpotato. To make my life easier on the authentication side I just installed a transparent proxy that Ubuntu talks to and then it obviously handles the authentication etc.

So it goes HTTP Request -> localhost:3128 -> proxy:8080

I first tried cntlm and for the most part I got that to work with everything except SB/CP. Basically everything can see the internet but the moment SB/CP tries to do a search the logs will show Access Denied and then I tried squid and exact same result.

CP Server Thread-5 :: URL error [Errno 111] Connection refused while loading URL https://api.github.com/repos/midgetspy/Sick-Beard/commits?per_page=100&sha=development
WARNING SHOWQUEUE-FORCE-UPDATE :: Unable to contact TVDB, aborting: We recently timed out, so giving up early this time

I've tried setting the environment variables, updating .bashrc file, checking that I can make a simple get call from a python terminal (which I can) and updating the ip tables to route all 80 traffic to 3128 but still can't get SB/CP to work. My guess is maybe the python process that spawns to run SB/CP isn't aware of the transparent proxy settings or is somehow ignoring the environment variables for HTTP_PROXY/HTTPS_PROXY.

Sooooo....Any ideas after that dump of information? :)

Kind Regards,
S1ght
 
How do you launch the sickbeard process? The http proxy environment variable surely have to be set before launching it, and in the same environment that the sickbeard process run. For example you may need to set it in the init.d script if that is what you are using.

Interesting enough, google is more focused on setting up a reverse proxy for sickbeard, than having sickbeard work behind a proxy.
 
How do you launch the sickbeard process? The http proxy environment variable surely have to be set before launching it, and in the same environment that the sickbeard process run. For example you may need to set it in the init.d script if that is what you are using.

Interesting enough, google is more focused on setting up a reverse proxy for sickbeard, than having sickbeard work behind a proxy.

I've got it as a service in /etc/default where the process starts up under the same user I'm logging in as.

And yup, Google has been pretty useless with this :( Closest I've seen is people in the UK asking the Sickbeard devs to include a Proxy option as their ISPs were beginning to block certain sites (or something like that)
 
So here's a head scratcher for the Linux gurus out there :)

So I have a Ubuntu 13.10 box sitting behind a proxy that makes use of Active Directory for Authentication. The Ubuntu is running Sickbeard/Couchpotato. To make my life easier on the authentication side I just installed a transparent proxy that Ubuntu talks to and then it obviously handles the authentication etc.

So it goes HTTP Request -> localhost:3128 -> proxy:8080

I first tried cntlm and for the most part I got that to work with everything except SB/CP. Basically everything can see the internet but the moment SB/CP tries to do a search the logs will show Access Denied and then I tried squid and exact same result.

CP Server Thread-5 :: URL error [Errno 111] Connection refused while loading URL https://api.github.com/repos/midgetspy/Sick-Beard/commits?per_page=100&sha=development
WARNING SHOWQUEUE-FORCE-UPDATE :: Unable to contact TVDB, aborting: We recently timed out, so giving up early this time

I've tried setting the environment variables, updating .bashrc file, checking that I can make a simple get call from a python terminal (which I can) and updating the ip tables to route all 80 traffic to 3128 but still can't get SB/CP to work. My guess is maybe the python process that spawns to run SB/CP isn't aware of the transparent proxy settings or is somehow ignoring the environment variables for HTTP_PROXY/HTTPS_PROXY.

Sooooo....Any ideas after that dump of information? :)

Kind Regards,
S1ght

Not sure if I am following you 100% correctly but transparent proxy (redirect) cannot work with ntlm authentication or any form of authentication.

I would suggest allowing your MAC address through with no auth or possibly just allowing the link the SB connects to with no auth.

FYI : I install proxies weekly
 
Not sure if I am following you 100% correctly but transparent proxy (redirect) cannot work with ntlm authentication or any form of authentication.

I would suggest allowing your MAC address through with no auth or possibly just allowing the link the SB connects to with no auth.

FYI : I install proxies weekly

Don't worry, I probably don't follow what I wrote completely either. Still very new to Linux/Ubuntu and proxies :p Unfortunately not my proxy so I can't go adding any special rules to it. Should probably take the time to note that I'm not trying to go around the proxy. It just makes life easier in terms of authentication when applications don't need to enter my credentials. If that makes sense? >.<

At the moment though I got tired of playing around with Linux configuration so I've managed to play around with the Sickbeard python scripts and found a lil' file it seems to use for most of it's HTTP calls. So modified that to include my proxy and now that seems to be working :) Still seems to fail on some calls like checking for updates but I'm sure it's probably somewhere else in the code then.

Next step is couch potato and that has a lot of python script files to look through :| Since this is the first time I'm looking at Python though it all just looks like 1 big mess to me :p I dunno how developers survived before Google :p

EDIT:
For any future people who read this post and want to know what file to edit
/sickbeard/sickbeard/helpers.py : Line 143

def getURL(url, post_data=None, headers=[]):
"""
Returns a byte-string retrieved from the url provider.
"""
proxy = urllib2.ProxyHandler({'http': '127.0.0.1:3128'})
opener = urllib2.build_opener(proxy)

opener.addheaders = [('User-Agent', USER_AGENT), ('Accept-Encoding', 'gzip,deflate')]
 
Last edited:
I would probably go around it in a different manner, which seems cleaner to me as a sysadmin.

Run a bunch of vms on that physical host. Have one set up as a gateway for the machine running sickbeard ect. THen on that gateway vm, run a transparent proxy which authenticates to the actual proxy as a parent proxy. Should be easier to get everything in sickbeard ect to just work.
 
Top
Sign up to the MyBroadband newsletter
X