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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...