<?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: export config through cli in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47692#M35074</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Jason,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the API for this&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1) go to &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://XXX.XXX.XXX.XXX/esp/restapi.esp?type=keygen&amp;amp;user=XXX&amp;amp;password=XXX"&gt;https://XXX.XXX.XXX.XXX/esp/restapi.esp?type=keygen&amp;amp;user=XXX&amp;amp;password=XXX&lt;/A&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; this will generate an API key which you need to export the config (alternatively you can just login the PA and then go to the second url)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2) go to &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://XXX.XXX.XXX.XXX/esp/restapi.esp?key=XXX&amp;amp;type=export&amp;amp;category=configuration"&gt;https://XXX.XXX.XXX.XXX/esp/restapi.esp?key=XXX&amp;amp;type=export&amp;amp;category=configuration&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also check out &lt;A href="https://live.paloaltonetworks.com/docs/DOC-1714"&gt;How to use the XML API to backup your firewall configuration&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Mar 2014 14:35:11 GMT</pubDate>
    <dc:creator>mr.linus</dc:creator>
    <dc:date>2014-03-26T14:35:11Z</dc:date>
    <item>
      <title>export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47688#M35070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;Is there a way to export the&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;(running)&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; config through cli?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Output should be a config file we can IMPORT back into a new device.&lt;/P&gt;&lt;P&gt;- NOT using SCP (we have restrictions on this)&lt;/P&gt;&lt;P&gt;- NOT using the API (php/rest/browse.php/export::configuration) (we only have ssh access) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) "show config running" or under configuration-mode "show" -&amp;gt; this will output the config, but is not in XML format and thus can not be imported&lt;/P&gt;&lt;P&gt;2) "set cli config-output-format xml" + under configuration-mode "show" -&amp;gt; this will output the config in xml format, but this is NOT importable in a PaloAlto. This is just a xml representation of the config, and not the config in xml format: there is a difference. (why you would want the "xml representation of the config" is a mystery to me, since you can not use it in any way)&lt;/P&gt;&lt;P&gt;3) "set cli config-output-format set" + under configuration-mode "show" -&amp;gt; this will output the config in set commands. This CAN technically be used to "import" the config, but importing a 1000+ lines of set commands is bound to fail somewhere down the line...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any of you guys got any other solutions, or maybe just a nice script that will rewrite the output of "set cli config-output-format xml" + "show" into an importable config file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 09:18:31 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47688#M35070</guid>
      <dc:creator>mr.linus</dc:creator>
      <dc:date>2014-03-26T09:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47689#M35071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Mr&lt;SPAN class="GINGER_SOFTWARE_mark"&gt;.&lt;/SPAN&gt;&lt;SPAN class="GINGER_SOFTWARE_mark"&gt;linus&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any specific reason you want to export the configuration file from CLI only..? &lt;SPAN class="GINGER_SOFTWARE_mark"&gt;( &lt;/SPAN&gt;It will be very easy to perform the same from GUI). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can try below mentioned steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. &amp;gt; &lt;SPAN class="GINGER_SOFTWARE_mark"&gt;set&lt;/SPAN&gt; &lt;SPAN class="GINGER_SOFTWARE_mark"&gt;cli&lt;/SPAN&gt; pager off&lt;/P&gt;&lt;P&gt;2. &amp;gt;&lt;SPAN class="GINGER_SOFTWARE_mark"&gt;set&lt;/SPAN&gt; &lt;SPAN class="GINGER_SOFTWARE_mark"&gt;cli&lt;/SPAN&gt; config-output-format xml&lt;/P&gt;&lt;P&gt;3. Log the putty session to a &lt;SPAN class="GINGER_SOFTWARE_mark"&gt;txt&lt;/SPAN&gt; file&lt;/P&gt;&lt;P&gt;4. Go &lt;SPAN class="GINGER_SOFTWARE_mark"&gt;to&lt;/SPAN&gt; configuration mode&lt;/P&gt;&lt;P&gt;5. PAN# show&amp;nbsp; &lt;/P&gt;&lt;P&gt;6. Turn off logging for that session.&lt;/P&gt;&lt;P&gt;7. Edit that &lt;SPAN class="GINGER_SOFTWARE_mark"&gt;txt&lt;/SPAN&gt; file and change the &lt;SPAN class="GINGER_SOFTWARE_mark"&gt;file extension to&lt;/SPAN&gt;&lt;SPAN class="GINGER_SOFTWARE_mark"&gt; .&lt;/SPAN&gt;&lt;SPAN class="GINGER_SOFTWARE_mark"&gt;xml&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 13:28:30 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47689#M35071</guid>
      <dc:creator>HULK</dc:creator>
      <dc:date>2014-03-26T13:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Re: export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47690#M35072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there an automated way to export the config through the GUI since it seems like CLI is out?&amp;nbsp; We need to backup many PA's but don't want to buy Panorama.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 14:14:07 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47690#M35072</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2014-03-26T14:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47691#M35073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Hulk,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry but that is not correct. (as explained in my initial question)&lt;/P&gt;&lt;P&gt;If you do a "show" in configuration mode with cli config-output-format set to xml you do NOT get a xml config file. Try it. &lt;/P&gt;&lt;P&gt;Not only does the output contain things like "&amp;lt;response status="success" code="19"&amp;gt;" also the order of the xml is different and thus can NOT be imported again.&lt;/P&gt;&lt;P&gt;The output DOES contain all necessary information to rebuild a working config, but you need to do a lot of find and replace...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree the GUI would be far easier, but if that would be possible in my setup, I would not be asking this question &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 14:30:48 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47691#M35073</guid>
      <dc:creator>mr.linus</dc:creator>
      <dc:date>2014-03-26T14:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47692#M35074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Jason,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the API for this&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1) go to &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://XXX.XXX.XXX.XXX/esp/restapi.esp?type=keygen&amp;amp;user=XXX&amp;amp;password=XXX"&gt;https://XXX.XXX.XXX.XXX/esp/restapi.esp?type=keygen&amp;amp;user=XXX&amp;amp;password=XXX&lt;/A&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; this will generate an API key which you need to export the config (alternatively you can just login the PA and then go to the second url)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2) go to &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://XXX.XXX.XXX.XXX/esp/restapi.esp?key=XXX&amp;amp;type=export&amp;amp;category=configuration"&gt;https://XXX.XXX.XXX.XXX/esp/restapi.esp?key=XXX&amp;amp;type=export&amp;amp;category=configuration&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also check out &lt;A href="https://live.paloaltonetworks.com/docs/DOC-1714"&gt;How to use the XML API to backup your firewall configuration&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 14:35:11 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47692#M35074</guid>
      <dc:creator>mr.linus</dc:creator>
      <dc:date>2014-03-26T14:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47693#M35075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guess this is not possible then... I will send in a &lt;EM&gt;feature request&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 08:32:41 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47693#M35075</guid>
      <dc:creator>mr.linus</dc:creator>
      <dc:date>2014-04-02T08:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47694#M35076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Panorama makes backups (in 6.0 anyway)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Apr 2014 14:39:26 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47694#M35076</guid>
      <dc:creator>${userLoginName}</dc:creator>
      <dc:date>2014-04-04T14:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47695#M35077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Automatic backups from Panorama are also available in 5.0 and 5.1 trains.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Apr 2014 18:44:17 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47695#M35077</guid>
      <dc:creator>pulukas</dc:creator>
      <dc:date>2014-04-06T18:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47696#M35078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;True,&lt;/P&gt;&lt;P&gt;But we don't have a panorama in our setup &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 09:53:28 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47696#M35078</guid>
      <dc:creator>mr.linus</dc:creator>
      <dc:date>2014-04-07T09:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: export config through cli</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47697#M35079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Besides exporting the configuration file to an SCP or a TFTP server through SSH &lt;A href="https://live.paloaltonetworks.com/docs/DOC-1551"&gt;CLI Commands to Export/Import Configuration and Log Files&lt;/A&gt;, there are two other options to extract a restorable version of the configuration file from the firewall. There is a 'dirty' way and a 'clean' way. The 'dirty' way can help you if you only had Console access. The 'clean' way requires HTTPS access to a firewall's interface.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'dirty' way is to extract the configuration file in a stanza of set commands.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can achieve this by going to the CLI and executing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; set cli pager off&lt;/P&gt;&lt;P&gt;&amp;gt; set cli config-output-format set&lt;/P&gt;&lt;P&gt;&amp;gt; configure&lt;/P&gt;&lt;P&gt;Entering configuration mode&lt;/P&gt;&lt;P&gt;[edit]&lt;/P&gt;&lt;P&gt;# show&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'clean' method is to leverage the API using cURL to get the xml file. As a side note, the "&amp;gt; set cli config-output-format xml" command won't help you, as it will result in displaying the configuration file in an xml format that is not restorable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use the API, you must begin by obtaining the API KEY, which will be used as your authentication token for API queries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To obtain it with curl, execute:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;SPAN&gt;curl -k "&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://live.paloaltonetworks.com/" rel="nofollow"&gt;https://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;IP_PAN&amp;gt;/api/?type=keygen&amp;amp;user=&amp;lt;your_user&amp;gt;&amp;amp;password=&amp;lt;your_password&amp;gt;" &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will result in obtaining a long string, which will be your API key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then obtain your config with command:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;curl -o config.xml -k "&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://live.paloaltonetworks.com/" rel="nofollow"&gt;https://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;IP_PAN&amp;gt;/esp/restapi.esp?type=config&amp;amp;action=show&amp;amp;key=&amp;lt;API-KEY&amp;gt;" &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where &amp;lt;API-KEY&amp;gt; is the key previously obtained and &amp;lt;IP_PAN&amp;gt; is the management IP of your firewall.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you vi config.xml, you will see the XML is wrapped in a &amp;lt;response status="success"&amp;gt;&amp;lt;result&amp;gt; and at the end of the file closes with its corresponding&lt;/P&gt;&lt;P&gt;&amp;lt;/result&amp;gt;&amp;lt;/response&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can clean your config.xml file with search and replace. If you used perl the commands will be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;To fix the header: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;perl -i.bak -pe 's/&amp;lt;response status="success"&amp;gt;&amp;lt;result&amp;gt;/&amp;lt;?xml version="1.0"?&amp;gt;\n/' config.xml&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To fix the footer:&lt;/P&gt;&lt;P&gt;perl -i.bak -pe 's/&amp;lt;\/result&amp;gt;&amp;lt;\/response&amp;gt;//' config.xml&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Or you can alternatively concatenate the command as: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;curl -o config.xml -k "&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://live.paloaltonetworks.com/" rel="nofollow"&gt;https://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;IP_PAN&amp;gt;/esp/restapi.esp?type=config&amp;amp;action=show&amp;amp;key=&amp;lt;API-KEY&amp;gt;" &amp;amp;&amp;amp; perl -i.bak -pe 's/&amp;lt;response status="success"&amp;gt;&amp;lt;result&amp;gt;/&amp;lt;?xml version="1.0"?&amp;gt;\n/' config.xml &amp;amp;&amp;amp; perl -i.bak -pe 's/&amp;lt;\/result&amp;gt;&amp;lt;\/response&amp;gt;//' config.xml &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 18:31:02 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/export-config-through-cli/m-p/47697#M35079</guid>
      <dc:creator>mivaldi</dc:creator>
      <dc:date>2014-07-16T18:31:02Z</dc:date>
    </item>
  </channel>
</rss>

