Knowledge Management

What is the splunk.secret file, and is it possible to change it?

cdo_splunk
Splunk Employee
Splunk Employee

The splunk.secret file is located in the $SPLUNK_HOME/etc/auth directory. It is used to encrypt and decrypt the passwords in the Splunk configuration files. If the splunk.secret file is removed, a new one is automatically generated. When this occurs, the decryption of passwords in the configuration files will no longer yield the correct value, and communication will stop. You will need to enter the clear text (unencrypted value) for all passwords in the configuration files, and then restart Splunk. This will encrypt these values again using the new splunk.secret.

To identify which entries need to be re-encrypted, refer to the answer below.

cdo_splunk
Splunk Employee
Splunk Employee

To identify which entries need to be re-encrypted, you may do the following:

1) Go to the location where Splunk is installed. By default, this is /opt/splunk on Linux, and c:\Program Files\Splunk on Windows.
This command will run on window powershell

2) C:\Program Files\Splunk> Get-ChildItem -Recurse *.conf | Select-String -Pattern '\$1\$.' -List
This command will run on linux

3) Run one of the following grep commands
find ./etc/ -type f -name "*.conf" -exec grep -iH "\$1\$." {} \;
find ./etc/ -type f -name "*.conf" | xargs grep -iH "\$1\$."
You should get a list of all files which have a password encrypted using the splunk.secret. Examples of this are:

./etc/system/local/authentication.conf:bindDNpassword = $1$tiw5an/3CRc1dmTN7pdI
./etc/system/local/server.conf:#sslPassword = $1$0X18KG2mW3RH
./etc/system/local/server.conf:sslPassword = $1$1Xl8LyvJ
./etc/system/local/server.conf:pass4SymmKey = $1$hjEodCjgECZH
./etc/system/local/server.conf:pass4SymmKey = $1$hD0kcyHJ
./etc/apps/testapp/default/outputs.conf:pass4SymmKey = $1$liw5fz32GCB0U32Mvdd3MZ4HxFE=
./etc/apps/testapp/default/server.conf:pass4SymmKey = $1$hD0kcyHJ

4) Go to each of the files listed in step #2 or #3, and change the password to the clear text version used in your deployment.
Example: In server.conf, there are at least three locations where pass4SymmKey may be entered. You will need to locate each one, and enter the correct value in clear text. If the password is mySecretPassword, edit the identified file, and make the following change.
Pass4SymmKey = $1$1Xl8LyvJ í Pass4SymmKey = mySecretPassword

5) After all the appropriate changes have been made, stop and restart the Splunk services. All your passwords should be re-encrypted using the new splunk.secret.

fredclown
Builder

The regex for the encrypted password values needs to be updated. Encrypted vales can start with more that just $1$ now.  I've seen $1$, $7$, and $6$. I use \$[0-9]\$ for the regex ...

Windows

C:\Program Files\Splunk> Get-ChildItem -Recurse *.conf | Select-String -Pattern '\$[0-9]\$.' -List

Linux

find ./etc/ -type f -name "*.conf" -exec grep -iH "\$[0-9]\$." {} \;
find ./etc/ -type f -name "*.conf" | xargs grep -iH "\$[0-9]\$."

 

thambisetty
SplunkTrust
SplunkTrust

this is what i was thinking when i saw the answer. 

————————————
If this helps, give a like below.
0 Karma

MuS
Legend

Nice information indeed - thanks!

Might I suggest to split this post just after a new one is automatically generated. and use the rest of the post as answer?

cheers, MuS

DalJeanis
Legend

updated to mark code so that * doesn't get treated as HTML.

0 Karma

somesoni2
Revered Legend

Awesome information!!!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...