Add new setting to verify outgoing SSL connections

The new setting 'verify_ssl_connections' tells the requests library to
verify secured outgoing HTTP connections.
Usually verifying is desired and helps to reveal configuration
problems. It also disables an ugly warning when HTTPS connections
are made without verification.
This commit is contained in:
Enrico Tröger
2020-01-25 19:44:11 +01:00
parent 1cd423041c
commit 68843d9664
7 changed files with 50 additions and 19 deletions

View File

@ -501,7 +501,7 @@ def setting_basic():
'pretty_ipv6_ptr', 'dnssec_admins_only',
'allow_user_create_domain', 'bg_domain_updates', 'site_name',
'session_timeout', 'warn_session_timeout', 'ttl_options',
'pdns_api_timeout', 'verify_user_email'
'pdns_api_timeout', 'verify_ssl_connections', 'verify_user_email'
]
return render_template('admin_setting_basic.html', settings=settings)

View File

@ -144,7 +144,8 @@ def api_login_create_zone():
method='POST',
data=request.get_json(force=True),
headers=headers,
accept='application/json; q=1')
accept='application/json; q=1',
verify=Setting().get('verify_ssl_connections'))
except Exception as e:
current_app.logger.error("Cannot create domain. Error: {}".format(e))
abort(500)
@ -219,7 +220,8 @@ def api_login_delete_zone(domain_name):
resp = utils.fetch_remote(urljoin(pdns_api_url, api_full_uri),
method='DELETE',
headers=headers,
accept='application/json; q=1')
accept='application/json; q=1',
verify=Setting().get('verify_ssl_connections'))
if resp.status_code == 204:
current_app.logger.debug("Request to powerdns API successful")