From 32e8c2cf098ae59baae5672e70436e47299bec82 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Tue, 19 Jul 2022 23:40:11 +0200 Subject: searx.network: add "verify" option to the networks Each network can define a verify option: * false to disable certificate verification * a path to existing certificate. SearXNG uses SSL_CERT_FILE and SSL_CERT_DIR when they are defined see https://www.python-httpx.org/environment_variables/#ssl_cert_file --- searx/webapp.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'searx/webapp.py') diff --git a/searx/webapp.py b/searx/webapp.py index 688698bb6..5c3fbae8b 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -165,6 +165,7 @@ timeout_text = gettext('timeout') parsing_error_text = gettext('parsing error') http_protocol_error_text = gettext('HTTP protocol error') network_error_text = gettext('network error') +ssl_cert_error_text = gettext("SSL error: certificate validation has failed") exception_classname_to_text = { None: gettext('unexpected crash'), 'timeout': timeout_text, @@ -189,6 +190,8 @@ exception_classname_to_text = { 'KeyError': parsing_error_text, 'json.decoder.JSONDecodeError': parsing_error_text, 'lxml.etree.ParserError': parsing_error_text, + 'ssl.SSLCertVerificationError': ssl_cert_error_text, # for Python > 3.7 + 'ssl.CertificateError': ssl_cert_error_text, # for Python 3.7 } -- cgit v1.2.3