<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Credentials Encryption in bash script in Security</title>
    <link>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578601#M15784</link>
    <description>&lt;P&gt;It can handle the first part, but not the last --remotePassword.&lt;/P&gt;&lt;P&gt;I prefer to use ansible for those. Another way is store those to env variables as&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;read remotePass 
&amp;lt;add pass here, then Ctlr+D&amp;gt;
splunk .... -remotePassword $remotePass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;When you want to use any password on scripts you must have vault password somewhere which need to enter/get from files/&amp;lt;your method here&amp;gt; to used to decrypt the encrypted password from file.&lt;/P&gt;&lt;P&gt;I haven't try to use tokens with this kind of issues. Basically it could be possible to define token and then use curl (instead of traditional cli) for those tasks where it's suitable. That way you don't need to write that password as a clear text into bash files. Anyhow that token is there and anyone who get it can do anything what is allowed with it (that user).&lt;/P&gt;&lt;P&gt;This is one reason why I prefer ansible with vault from centralised ctrl node. Then I have only one place where I must restrict access and ensure that it's security level is enough high.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
    <pubDate>Thu, 16 Dec 2021 08:46:21 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2021-12-16T08:46:21Z</dc:date>
    <item>
      <title>Credentials Encryption in bash script</title>
      <link>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578593#M15780</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;I have this short bash script, and i want to encrypt the admin and changeme credentials, cause it is displayed on clear text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash

/opt/splunk/bin/splunk set minfreemb 1000 -auth admin:changeme
/opt/splunk/bin/splunk edit user test01 -force-change-pass true -auth admin:changeme&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to achieve this.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 07:12:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578593#M15780</guid>
      <dc:creator>jadengoho</dc:creator>
      <dc:date>2021-12-16T07:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Credentials Encryption in bash script</title>
      <link>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578597#M15782</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;In my minds there is at least two options, cannot say if those are suitable for you.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;If possible login first into splunk and then run that script without user pass options. Just enter into cmd line "splunk login" then enter user + pass. Of course this needs that you can run this first part manually. After that there are login token under Splunk User until it expires.&lt;/LI&gt;&lt;LI&gt;Use ansible with vault and there is an option no_log which prevent writing password to log files.&amp;nbsp;&lt;A href="https://docs.ansible.com/ansible/latest/reference_appendices/logging.html" target="_blank"&gt;https://docs.ansible.com/ansible/latest/reference_appendices/logging.html&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 08:21:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578597#M15782</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-12-16T08:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Credentials Encryption in bash script</title>
      <link>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578598#M15783</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can the first option process this ?&lt;BR /&gt;&lt;BR /&gt;/opt/splunk/bin/splunk add search-server &lt;A href="https://&amp;lt;IPADDRESS" target="_blank"&gt;https://&amp;lt;IPADDRESS&lt;/A&gt;&amp;gt;-auth admin:changeme -remoteUsername &amp;lt;ADMIN&amp;gt;-remotePassword &amp;lt;PASS&amp;gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 08:28:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578598#M15783</guid>
      <dc:creator>jadengoho</dc:creator>
      <dc:date>2021-12-16T08:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Credentials Encryption in bash script</title>
      <link>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578601#M15784</link>
      <description>&lt;P&gt;It can handle the first part, but not the last --remotePassword.&lt;/P&gt;&lt;P&gt;I prefer to use ansible for those. Another way is store those to env variables as&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;read remotePass 
&amp;lt;add pass here, then Ctlr+D&amp;gt;
splunk .... -remotePassword $remotePass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;When you want to use any password on scripts you must have vault password somewhere which need to enter/get from files/&amp;lt;your method here&amp;gt; to used to decrypt the encrypted password from file.&lt;/P&gt;&lt;P&gt;I haven't try to use tokens with this kind of issues. Basically it could be possible to define token and then use curl (instead of traditional cli) for those tasks where it's suitable. That way you don't need to write that password as a clear text into bash files. Anyhow that token is there and anyone who get it can do anything what is allowed with it (that user).&lt;/P&gt;&lt;P&gt;This is one reason why I prefer ansible with vault from centralised ctrl node. Then I have only one place where I must restrict access and ensure that it's security level is enough high.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 08:46:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578601#M15784</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-12-16T08:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Credentials Encryption in bash script</title>
      <link>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578630#M15786</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I manage to create a BASH script that will run ansible playbook for docker containers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bash script:&lt;/STRONG&gt; - using "-e" to pass the parameters from the bash script to ansible playbook.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ansible-playbook splunk_docker_creation.yml -e docker_folder_path=${docker_folder_path} -e folder_to_find=${folder_to_find} -e splunk_mount_path=${splunk_mount_path} -e base_port=${port} -e splunk_container_port=${splunk_container_port} -e username=${username} --vault-password-file /somewhere/pass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ansible Playbook -&lt;/STRONG&gt; since i need to run a script for the docker i use this script&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;- name: Setting minfreemb to 1000
  shell: docker exec --user root {{ dockercontainername }} bash -c '/opt/splunk/bin/splunk set minfreemb 1000 -auth admin:{{ SplunkDefaultAdminCredentials }}'
  no_log: true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;and as suggested i use &lt;STRONG&gt;ansible vault&lt;/STRONG&gt; to secure the password with the &lt;STRONG&gt;no_log&lt;/STRONG&gt; and put the key into a secured file.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 12:39:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Credentials-Encryption-in-bash-script/m-p/578630#M15786</guid>
      <dc:creator>jadengoho</dc:creator>
      <dc:date>2021-12-16T12:39:07Z</dc:date>
    </item>
  </channel>
</rss>

