Splunk Dev

Retrieving wrong credentials in Python script after using Setup screen

ralphmct
Path Finder

Hi,

I've followed the example in the documentation for creating a setup screen. My setup.xml is basic: saving username, password and realm. If I go to the admin/passwords/ endpoint and the app.conf I can see the username and password saved but the following lines in my Python script just get the first set of credentials alphabetically as opposed to the newest:

# return first set of credentials
for i, c in entities.items():
    return c['username'], c['clear_password'], c['realm']

How do I go about retrieving the newest credentials? I want to be able to return to the setup screen, update my details and have my script use those instead of the previous ones. Perhaps an easier way might be to add the credentials with the setup screen in order of date if that's possible?

Thanks

0 Karma
1 Solution

ralphmct
Path Finder

For anyone who comes to this with the same problem. I didn't figure out how to change the order on the REST API but I did manage a workaround. The configuration files hold the sequential order, so I read through the local conf files, got to the most recent credentials entry and matched it with the REST API version to get the unencrypted credentials.

View solution in original post

ralphmct
Path Finder

For anyone who comes to this with the same problem. I didn't figure out how to change the order on the REST API but I did manage a workaround. The configuration files hold the sequential order, so I read through the local conf files, got to the most recent credentials entry and matched it with the REST API version to get the unencrypted credentials.

ralphmct
Path Finder

After looking at this further I think it may be more wise to create a defined entity using setup.xml and only have one entity that gets overwritten, rather than using "_new" to create a new object each time but I'm not sure how this is done.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...