splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

mTLS support

Open RaviTezu opened this issue 5 years ago • 1 comments

Hi, Our Splunk instance uses mTLS and then username/password to authenticate clients. Any example that you can provide? I can use splunklib.client.connect for basic auth but looks like it doesn't take the client side certificate paths ? Thank you.

RaviTezu avatar Jan 12 '21 12:01 RaviTezu

Found a way, you can pass on a custom handler(which accepts the client certs) to the splunklib.client.connect.

import splunklib.client as client
from splunklib.binding import handler
. 
.
.
        connection = client.connect(
            **{
                "host": <splunk-url>,
                "scheme": <scheme(https)>,
                "port": <splunk-port>,
                "autologin": True,
                "username": <username>,
                "password": <password>,
                "handler": handler(cert_file=<path-to-cert-file>, key_file=<path-to-private-key-file>, verify=True)
            }

RaviTezu avatar Jan 14 '21 06:01 RaviTezu