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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...