I am writing a script were I need to pass authentication to access storage password. I update the commands.conf and added the passAuth = True as well as updated the inputs.conf with passAuth = admin, but I can't seem to get the sessionKey.
This code does work, sessionKey = splunk.auth.getSessionKey('admin','changeme') but when I do sessionKey= sys.stdin.readline().strip() it doesn't work. Am I missing something?
Here is my code:
import splunk.entity as entity
import splunk.auth, splunk.search
import sys, os
myapp = 'test'
# list all credentials
entities = entity.getEntities(
['admin', 'passwords'], namespace=myapp,
except Exception, e:
"Could not get %s credentials from splunk."
"Error: %s" % (myapp, str(e)))
credentials = 
# return credentials
for i, c in entities.items():
raise Exception("No credentials have been found")
sessionKey = sys.stdin.readline().strip()
credentials = getCredentials(sessionKey)
for username, password in credentials: