<?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: Why does setup.xml with encrypted credentials fail on re-run? in Security</title>
    <link>https://community.splunk.com/t5/Security/Why-does-setup-xml-with-encrypted-credentials-fail-on-re-run/m-p/305429#M8070</link>
    <description>&lt;P&gt;I got one solution here,&lt;/P&gt;

&lt;P&gt;If you know username then create 'passwords.conf' in default directory containing,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[credential::user_name:]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in setup.xml use entity "user_name" instead of "_new"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;block title="Public Key" endpoint="storage/passwords" entity="user_name*" mode="iter" eai_strict="false"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 19:42:51 GMT</pubDate>
    <dc:creator>mkhan_splunk</dc:creator>
    <dc:date>2020-09-29T19:42:51Z</dc:date>
    <item>
      <title>Why does setup.xml with encrypted credentials fail on re-run?</title>
      <link>https://community.splunk.com/t5/Security/Why-does-setup-xml-with-encrypted-credentials-fail-on-re-run/m-p/305428#M8069</link>
      <description>&lt;P&gt;It's unclear to me how to allow users to change a stored password via &lt;CODE&gt;setup.xml&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;The "Setup page example with user credentials" (&lt;A href="http://dev.splunk.com/view/SP-CAAAE9B#creds"&gt;http://dev.splunk.com/view/SP-CAAAE9B#creds&lt;/A&gt;) works fine for initially configuring the app I'm developing; I can see that an entry gets created in &lt;CODE&gt;/servicesNS/nobody/&amp;lt;appname&amp;gt;/storage/passwords&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;However, upgrading the app ("Install app from file" / [x] Upgrade app) prompts me to enter Setup again after app upgrade. This time, the credential post fails with the error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Encountered the following error while trying to update:
Error while posting to url=/servicesNS/nobody/&amp;lt;appname&amp;gt;/storage/passwords/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Meanwhile, splunkd.log displays the error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SetupAdminHandler - Cannot find field='name' in url='/storage/passwords/_new/' setting value to empty string
SetupAdminHandler - Cannot find field='name' in url='/storage/passwords/_new/' setting value to empty string
SetupAdminHandler - Error while posting to url=/servicesNS/nobody/&amp;lt;appname&amp;gt;/storage/passwords/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I presume this is because a password has already been saved in the &lt;CODE&gt;storage/passwords&lt;/CODE&gt; store, and my setup.xml block refers to the &lt;CODE&gt;_new&lt;/CODE&gt; entity, i.e:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;block title="Script credentials" endpoint="storage/passwords" entity="_new"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've seen suggestions about using a custom endpoint to accomplish this better, and advice that users should manually clear settings from &lt;CODE&gt;local/passwords.conf&lt;/CODE&gt; files during an upgrade/before changing their username/password. The latter seems unideal (some users may not have filesystem access to their splunk instance), and the former feels like overkill.&lt;/P&gt;

&lt;P&gt;What I'm basically looking for is "create or update" logic when using the &lt;CODE&gt;storage/passwords&lt;/CODE&gt; endpoint.  Is there a streamlined/best-practice way to accomplish this without having to implement this logic in conjunction with a custom endpoint? This feels like the type of thing that should be a pretty common occurrence, so I'm surprised that I haven't found anything in the documentation about it.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 00:51:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-does-setup-xml-with-encrypted-credentials-fail-on-re-run/m-p/305428#M8069</guid>
      <dc:creator>ssanborn</dc:creator>
      <dc:date>2017-02-16T00:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why does setup.xml with encrypted credentials fail on re-run?</title>
      <link>https://community.splunk.com/t5/Security/Why-does-setup-xml-with-encrypted-credentials-fail-on-re-run/m-p/305429#M8070</link>
      <description>&lt;P&gt;I got one solution here,&lt;/P&gt;

&lt;P&gt;If you know username then create 'passwords.conf' in default directory containing,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[credential::user_name:]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in setup.xml use entity "user_name" instead of "_new"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;block title="Public Key" endpoint="storage/passwords" entity="user_name*" mode="iter" eai_strict="false"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:42:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Why-does-setup-xml-with-encrypted-credentials-fail-on-re-run/m-p/305429#M8070</guid>
      <dc:creator>mkhan_splunk</dc:creator>
      <dc:date>2020-09-29T19:42:51Z</dc:date>
    </item>
  </channel>
</rss>

