Page 2 of 3

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 3:42 pm
by sander
@Dewdman42:

In SABnzbd, go to your RSS settings for nzb.is by clicking on "Edit URL" and change the URL from

Code: Select all

https://nzb.is/rss?...
to

Code: Select all

http://nzb.is/rss?
So change "https" to "http". Save, and restart SABnzbd. Post the result here.

FWIW: My SABnzbd has no problem with https://nzb.is/rss?... nor https://nzb.is/rss?..., so my guess there is something wrong on your NAS setup (not in SABnzbd itself)

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 3:42 pm
by mogodon
I also just tried the following:

http://nzb.is/ - NZB passed to SABnzbd and downloads
https://nzb.is/ - NZB stuck at fetching

So I guess I need to find out why SABnzbd won't accept the https protocol and how I fix it.

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 3:50 pm
by sander
mogodon wrote:I also just tried the following:

http://nzb.is/ - NZB passed to SABnzbd and downloads
https://nzb.is/ - NZB stuck at fetching

So I guess I need to find out why SABnzbd won't accept the https protocol and how I fix it.
The problem is probably not in SABnzbd, but in your NAS OS or python. Easy way to check: login on your NAS, start python and type:

Code: Select all

import urllib2
f = urllib2.urlopen('http://www.google.com/', timeout=5)
f.read()[:100]
That should work. Post the output here in a code block.

Now with https:

Code: Select all

import urllib2
f = urllib2.urlopen('https://www.google.com/', timeout=5)
f.read()[:100]
Post the output here in a code block. If you have a problem, there is a problem in your NAS OS or python, not SABnzbd (proof: in the above code there is no SABnzbd involved ... :P )

For refence: this is what happens when everything is OK:

Code: Select all

>>> import urllib2
>>> f = urllib2.urlopen('http://www.google.com/', timeout=5)
>>> f.read()[:100]
'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="nl"><head><meta content'
>>> 

>>> import urllib2
>>> f = urllib2.urlopen('https://www.google.com/', timeout=5)
>>> f.read()[:100]
'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="nl"><head><meta content'
>>>

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 3:52 pm
by Dewdman42
I think I figured out my /tmp had filled up the root partition. Things seem to be working ok now.

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 4:38 pm
by mogodon
Well pretty obvious that the python is the issue:

http

Code: Select all

[/usr/bin] # /usr/bin/python
Python 2.7.9 (default, Mar 24 2015, 00:42:24)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
f = urllib2.urlopen('http://www.google.com/', timeout=5)
f.read()[:100]>>> >>>
'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en                                                -GB"><head><meta cont'
https

Code: Select all

>>> import urllib2
f = urllib2.urlopen('https://www.google.com/', timeout=5)
f.read()[:100]>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/share/MD0_DATA/.qpkg/Python/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/share/MD0_DATA/.qpkg/Python/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/share/MD0_DATA/.qpkg/Python/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/share/MD0_DATA/.qpkg/Python/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/share/MD0_DATA/.qpkg/Python/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/share/MD0_DATA/.qpkg/Python/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
I reckon a recent firmware update has broken it.

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 4:54 pm
by sander
mogodon wrote:Well pretty obvious that the python is the issue:
...
I reckon a recent firmware update has broken it.
Yes. Probably an upgrade to Python 2.7.9 combined with a incorrect certificate setup on your NAS. See https://forums.sabnzbd.org/viewtopic.php?f=1&t=18565 for a long explanation.

Try this:

Code: Select all

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

import urllib2
f = urllib2.urlopen('https://www.google.com/', timeout=5)
f.read()[:100]

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 5:01 pm
by mogodon
Sander, thanks very much for your support, much appreciated. I will read your link and then go try the QNAP forums. Hopefully I can roll back the python version to 2.7.3

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 5:03 pm
by sander
mogodon wrote:Sander, thanks very much for your support, much appreciated. I will read your link and then go try the QNAP forums. Hopefully I can roll back the python version to 2.7.3
OK, but can you first try the code I gave above? If that works, you can make SABnzbd work again with two lines of code ... :)

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 5:30 pm
by mogodon
Having read the other thread and also https://forums.sabnzbd.org/viewtopic.ph ... B&start=15 I actually chanced it and used your patch on SABnzbd.py

Code: Select all

opt_out_of_certificate_verification = True
if opt_out_of_certificate_verification:
    try:
        import ssl
        ssl._create_default_https_context = ssl._create_unverified_context
    except:
        pass
Restarted and it's working again!

Thank you!

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 5:40 pm
by sander
Well done!

Re: stuck at "trying to fetch"

Posted: September 3rd, 2015, 6:00 pm
by mogodon
sander wrote:Well done!
No idea why I didn't find the other QNAP post when I searched earlier today. Anyway, I now know how to run python on my NAS, sabnzbd works again and I'm no longer swearing at my NAS, so all good!

I've linked to your posts on the SABnzbd threads in the QNAP forum so hopefully anyone-else with the same issue can sort it.

Thanks again.

Re: stuck at "trying to fetch"

Posted: September 4th, 2015, 12:02 am
by sander
mogodon wrote:
sander wrote:Well done!
No idea why I didn't find the other QNAP post when I searched earlier today. Anyway, I now know how to run python on my NAS, sabnzbd works again and I'm no longer swearing at my NAS, so all good!

I've linked to your posts on the SABnzbd threads in the QNAP forum so hopefully anyone-else with the same issue can sort it.

Thanks again.

FYI:
if you can't access https://www.google.com/, there is something wrong with your NAS' setup. It is preferred to solve that.
The code you implemented now is meant for situations where the the index' https certificate is incorrect.

So ... in the QNAP forum, try to find a solution for your NAS' setup.

Re: stuck at "trying to fetch"

Posted: September 9th, 2015, 2:09 pm
by mogodon
Yes apparently there is an "issue" with SSL certificates on all of the QNAP models. Apparently they provide a shared certificate which is the same for all users. QNAP have been asked by the community in the past to fix this but nothing had been done. Now that Python 2.7.9 has been implemented on firmware 4.2.0 and browser are becoming stricter more people are finding out about this issue.

Re: stuck at "trying to fetch"

Posted: September 9th, 2015, 2:13 pm
by sander
mogodon wrote:Yes apparently there is an "issue" with SSL certificates on all of the QNAP models. QNAP have been asked by the community in the past to fix this but nothing had been done.
Interesting. Have you got a link for me?

Re: stuck at "trying to fetch"

Posted: September 9th, 2015, 2:15 pm
by mogodon
It believe it's to do with the fact that they provide a shared certificate rather than an individual one per device that is causing a lot of issues. I'll see if I can dig some links from the QNAP forum.