All Apps and Add-ons

I need to encrypt the password in my curl command to update a tag entry. Any good way to do this easily?

dmacgillivray
Communicator

Hi All,

I have an app that updates tags when needed. Problem is I am trying to make the initial curl call as secure and as ease as possible.

Does anyone know the simplest way to do this? I do not want to see my password for this app get logged in syslog or any other place. However, I simply want to encrypt the password as seen below.

I know the below command works but how to I get to bring in the password that is encrypted from my password.conf file? I set this up in /local/password.conf of the search app.

curl -k -u user:encrypted_password https://localhost:8089/servicesNS/nobody/search/search/tags/test_hosts -d add=host::testserver1.com

0 Karma

sfrazer
Explorer

Curl has the ability to pull a username / password from a "netrc" file, and you can use this to fill environment variables. The format for a netrc file is likely different from the password.conf app, though.

Here's some more information:

http://stackoverflow.com/a/33818945

0 Karma

dmacgillivray
Communicator

Thanks sfrazer, I saw this. It actually has a URL option, which I wonder if I can call our pass rest that way.
--netrc url

appreciate the suggestion.

-Daniel

0 Karma

dmacgillivray
Communicator

Hi Sfrazer and all out there doing similar stuff in Splunk, I decided to go with Python and calling the REST from that code. It will allow me to do more things and a richer set of possibilities for an all in one solution.

I really liked this link from below from Splunk using the

import splunk.entity as entity (object) 🙂

https://docs.splunk.com/Documentation/Splunk/6.4.3/AdvancedDev/SetupExampleCredentials#2._Write_a_py...

I will post an update to this when done coding. Happy to contribute.

0 Karma
Take the 2021 Splunk Career Survey

Help us learn about how Splunk has
impacted your career by taking the 2021 Splunk Career Survey.

Earn $50 in Amazon cash!