Security

splunklib client giving SSLError

alnu
Engager

I'm trying to make a basic connection with my local instance of splunk, but it's giving me a SSLError. Have setup splunk for the first time on my local system. Did try disabling ssl from a few config files but to no use. Missing something extremely basic here

Splunk Version: 6.4.0
Python Version(which came with Splunk): 2.7.11
Python Version(SDK is using): 2.7.10 [Will it affect it?]

import splunklib.client as client
HOST = "localhost"
PORT = 8000
USERNAME = "admin"
PASSWORD = "changeme"
service = client.connect(host=HOST, port=PORT, username=USERNAME, password=PASSWORD)
print service.apps.list()

Stacktrace:

Traceback (most recent call last):
  File "C:/Users/alnu/PycharmProjects/Splunk_Automate/test1.py", line 9, in <module>
    service = client.connect(host=HOST, port=PORT, username=USERNAME, password=PASSWORD)
  File "C:\Users\alnu\IdeaProjects\virtualenvs\splunk_venv\lib\site-packages\splunklib\client.py", line 321, in connect
    s.login()
  File "C:\Users\alnu\IdeaProjects\virtualenvs\splunk_venv\lib\site-packages\splunklib\binding.py", line 857, in login
    cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header
  File "C:\Users\alnu\IdeaProjects\virtualenvs\splunk_venv\lib\site-packages\splunklib\binding.py", line 1201, in post
    return self.request(url, message)
  File "C:\Users\alnu\IdeaProjects\virtualenvs\splunk_venv\lib\site-packages\splunklib\binding.py", line 1218, in request
    response = self.handler(url, message, **kwargs)
  File "C:\Users\alnu\IdeaProjects\virtualenvs\splunk_venv\lib\site-packages\splunklib\binding.py", line 1357, in request
    connection.request(method, path, body, head)
  File "C:\Python27\Lib\httplib.py", line 1053, in request
    self._send_request(method, url, body, headers)
  File "C:\Python27\Lib\httplib.py", line 1093, in _send_request
    self.endheaders(body)
  File "C:\Python27\Lib\httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "C:\Python27\Lib\httplib.py", line 893, in _send_output
    self.send(msg)
  File "C:\Python27\Lib\httplib.py", line 855, in send
    self.connect()
  File "C:\Python27\Lib\httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "C:\Python27\Lib\ssl.py", line 352, in wrap_socket
    _context=self)
  File "C:\Python27\Lib\ssl.py", line 579, in __init__
    self.do_handshake()
  File "C:\Python27\Lib\ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
Tags (3)
0 Karma
1 Solution

kbarker302
Communicator

I believe it's your port - you want to use the management port, which is typically 8089, but you can confirm by going to Settings -- Server Settings -- General Settings.

View solution in original post

kbarker302
Communicator

I believe it's your port - you want to use the management port, which is typically 8089, but you can confirm by going to Settings -- Server Settings -- General Settings.

alnu
Engager

Yes I did figure it out, but since the question was in moderation I wasn't able to delete it. Thanks though!!

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...