ns1-python
ns1-python copied to clipboard
Add support for mTLS-capable HTTP proxy with self-signed certs
Secure environments commonly use mutual TLS (mTLS)-capable HTTP proxies to ensure only approved clients are able to make outbound calls to only approved endpoints on the Internet. The client certificates for mTLS can be self-signed or using a custom CA.
This PR adds the support for doing the above when requests transport is used.
For passing the necessary config parameters to NS1 instance, the config in-take is also reworked in this PR to accept arbitrary dictionary in addition to API key. This is rework is designed to be backwards compatible.
An example use of this feature would be:
NS1(
apiKey='super-secret',
config={
'http_proxy': 'http://proxy.corp.com',
'client_cert': ('path/to/cert', 'path/to/key'),
'cert_verify': 'path/to/certfile',
# optionally put api key here instead of above
'apiKey': 'super-secret,
}
)
I'll work on the tests once the implementation approach is approved.