Change disable SSL cert verification for logins in pp-scripts.

This commit is contained in:
Prinz23 2018-04-04 20:55:23 +02:00 committed by JackDandy
parent 80bcee49bc
commit aab753aa09
4 changed files with 10 additions and 4 deletions

View file

@ -5,6 +5,7 @@
* Change improve security with DNS rebinding prevention, set "Allowed browser hostnames" at config/General/Web Interface
* Change improve test for creating self-signed SSL cert
* Change force restart when switching SSL on/off
* Change disable SSL cert verification for logins in pp-scripts
* Change hachoir targa and mpeg_ts mime parser tags so they validate
* Update backports/ssl_match_hostname 3.5.0.1 (r18) to 3.7.0.1 (r28)
* Update cachecontrol library 0.12.3 (db54c40) to 0.12.4 (bd94f7e)

View file

@ -156,7 +156,7 @@ import os
import re
import sys
__version__ = '1.3'
__version__ = '1.4'
verbose = 0 or 'yes' == os.environ.get('NZBPO_SG_VERBOSE', 'no')
@ -485,7 +485,7 @@ def call_sickgear(nzb_name, dir_name, test=False):
s = requests.Session()
if username or password:
login = '%s%s:%s%s/login' % (protocol, host, port, webroot)
r = s.get(login)
r = s.get(login, verify=False)
login_params = {'username': username, 'password': password}
if 401 == r.status_code and r.cookies.get('_xsrf'):
login_params['_xsrf'] = r.cookies.get('_xsrf')

View file

@ -133,7 +133,7 @@ def processEpisode(dir_to_process, org_NZB_name=None, status=None):
try:
sess = requests.Session()
if username or password:
r = sess.get(login_url)
r = sess.get(login_url, verify=False)
login_params = {'username': username, 'password': password}
if 401 == r.status_code and r.cookies.get('_xsrf'):
login_params['_xsrf'] = r.cookies.get('_xsrf')

View file

@ -181,7 +181,12 @@ def main():
try:
sess = requests.Session()
sess.post(login_url, data={'username': username, 'password': password}, stream=True, verify=False)
if username or password:
r = sess.get(login_url, verify=False)
login_params = {'username': username, 'password': password}
if 401 == r.status_code and r.cookies.get('_xsrf'):
login_params['_xsrf'] = r.cookies.get('_xsrf')
sess.post(login_url, data=login_params, stream=True, verify=False)
response = sess.get(url, auth=(username, password), params=params, verify=False, allow_redirects=False)
except Exception as e:
scriptlogger.error(u': Unknown exception raised when opening url: ' + str(e))