added verify_ssl_cert option to fix broken ssl installs

This commit is contained in:
theguardian
2015-10-20 21:52:55 -07:00
parent 18d53167d0
commit 022976d2f6
4 changed files with 19 additions and 2 deletions

View File

@@ -177,6 +177,16 @@ def main():
"module to enable HTTPS. HTTPS will be disabled.")
headphones.CONFIG.ENABLE_HTTPS = False
#This fix is put in place for systems with broken SSL (like QNAP)
certificate_verification = headphones.CONFIG.VERIFY_SSL_CERT
if not certificate_verification:
try:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
except:
pass
#==== end block (should be configurable at settings level)
# Try to start the server. Will exit here is address is already in use.
web_config = {
'http_port': http_port,

View File

@@ -80,6 +80,12 @@
<input type="text" name="https_key" value="${config['https_key']}" size="30">
</div>
</div>
<div class="row checkbox">
<input type="checkbox" name="verify_ssl_cert" id="verify_ssl_cert" value="1" ${config['verify_ssl_cert']} />
<label title="Verify SSL Certificates (Disable this for broken SSL installs (Like QNAP)">
Verify SSL
</label>
</div>
</fieldset>
</td>
<td>

View File

@@ -253,7 +253,7 @@ _CONFIG_DEFINITIONS = {
'UTORRENT_LABEL': (str, 'uTorrent', ''),
'UTORRENT_PASSWORD': (str, 'uTorrent', ''),
'UTORRENT_USERNAME': (str, 'uTorrent', ''),
'VERIFY_SSL_CERT': (bool_int, 'Advanced', 1),
'VERIFY_SSL_CERT': (int, 'Advanced', 1),
'WAIT_UNTIL_RELEASE_DATE' : (int, 'General', 0),
'WAFFLES': (int, 'Waffles', 0),
'WAFFLES_PASSKEY': (str, 'Waffles', ''),

View File

@@ -1025,6 +1025,7 @@ class WebInterface(object):
"enable_https": checked(headphones.CONFIG.ENABLE_HTTPS),
"https_cert": headphones.CONFIG.HTTPS_CERT,
"https_key": headphones.CONFIG.HTTPS_KEY,
"verify_ssl_cert": checked(headphones.CONFIG.VERIFY_SSL_CERT),
"api_enabled": checked(headphones.CONFIG.API_ENABLED),
"api_key": headphones.CONFIG.API_KEY,
"download_scan_interval": headphones.CONFIG.DOWNLOAD_SCAN_INTERVAL,
@@ -1286,7 +1287,7 @@ class WebInterface(object):
# Handle the variable config options. Note - keys with False values aren't getting passed
checked_configs = [
"launch_browser", "enable_https", "api_enabled", "use_blackhole", "headphones_indexer", "use_newznab", "newznab_enabled", "use_torznab", "torznab_enabled",
"launch_browser", "enable_https", "verify_ssl_cert", "api_enabled", "use_blackhole", "headphones_indexer", "use_newznab", "newznab_enabled", "use_torznab", "torznab_enabled",
"use_nzbsorg", "use_omgwtfnzbs", "use_kat", "use_piratebay", "use_oldpiratebay", "use_mininova", "use_waffles", "use_rutracker",
"use_whatcd", "use_strike", "preferred_bitrate_allow_lossless", "detect_bitrate", "ignore_clean_releases", "freeze_db", "cue_split", "move_files",
"rename_files", "correct_metadata", "cleanup_files", "keep_nfo", "add_album_art", "embed_album_art", "embed_lyrics",