<?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: Automating HA key exchange in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/436187#M2790</link>
    <description>&lt;P&gt;Yes, that is exactly what i'm looking for to automate, maybe someone has an expect script handy?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 23 Sep 2021 16:19:15 GMT</pubDate>
    <dc:creator>pkhavkine</dc:creator>
    <dc:date>2021-09-23T16:19:15Z</dc:date>
    <item>
      <title>Automating HA key exchange</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/436151#M2788</link>
      <description>&lt;P&gt;Hello all.&lt;/P&gt;&lt;P&gt;Is there a way to automate the exchange of HA keys when creating an HA pair?&lt;/P&gt;&lt;P&gt;I have gotten everything else using terraform/ansible/panorama. But I cannot figure out how to do HA key exchange programmatically.&lt;/P&gt;&lt;P&gt;Anyone has done it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 14:25:01 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/436151#M2788</guid>
      <dc:creator>pkhavkine</dc:creator>
      <dc:date>2021-09-23T14:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Automating HA key exchange</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/436186#M2789</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/85949"&gt;@pkhavkine&lt;/a&gt;, can you confirm which part(s) of the HA key procedure you are looking to automate? If you are referring to step 6 listed&amp;nbsp;&lt;A href="https://docs.paloaltonetworks.com/pan-os/10-0/pan-os-admin/high-availability/set-up-activepassive-ha/configure-activepassive-ha.html" target="_self"&gt;here&lt;/A&gt;, the export function of the XML API does not include the high availability keys as an option today, which rules out Ansible and Terraform too, so the step 6 tasks would need to be done via CLI automation to get things done programmatically.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 16:14:53 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/436186#M2789</guid>
      <dc:creator>JimmyHolland</dc:creator>
      <dc:date>2021-09-23T16:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Automating HA key exchange</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/436187#M2790</link>
      <description>&lt;P&gt;Yes, that is exactly what i'm looking for to automate, maybe someone has an expect script handy?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 16:19:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/436187#M2790</guid>
      <dc:creator>pkhavkine</dc:creator>
      <dc:date>2021-09-23T16:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Automating HA key exchange</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/527779#M3299</link>
      <description>&lt;P&gt;anyone get anywhere on this? Steps are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SSH to &amp;lt;USERNAME&amp;gt;@&amp;lt;FWA-IP&amp;gt;
&amp;lt;EXPECT-"Password:"&amp;gt;
&amp;lt;SSHPASSWORD&amp;gt;
&amp;lt;EXPECT-"&amp;lt;USERNAME&amp;gt;@&amp;lt;HOSTNAME&amp;gt;"&amp;gt;
scp export high-availability-key from HA-key-&amp;lt;SN#A&amp;gt; to sftpuser@&amp;lt;SFTP&amp;gt;:/home/sftpuser/HA-key-&amp;lt;SN#A&amp;gt;
&amp;lt;EXPECT-"sftpuser@&amp;lt;SFTP&amp;gt;'s password:"&amp;gt;
&amp;lt;SFTPPASSWORD&amp;gt;
&amp;lt;EXPECT-"&amp;lt;USERNAME&amp;gt;@&amp;lt;HOSTNAME&amp;gt;"&amp;gt;
exit

SSH to &amp;lt;USERNAME&amp;gt;@&amp;lt;FWB-IP&amp;gt;
&amp;lt;EXPECT-"Password:"&amp;gt;
&amp;lt;SSHPASSWORD&amp;gt;
&amp;lt;EXPECT-"&amp;lt;USERNAME&amp;gt;@&amp;lt;HOSTNAME&amp;gt;"&amp;gt;
scp export high-availability-key from HA-key-&amp;lt;SN#B&amp;gt; to sftpuser@1&amp;lt;SFTP&amp;gt;:/home/sftpuser/HA-key-&amp;lt;SN#B&amp;gt;
&amp;lt;EXPECT-"sftpuser@&amp;lt;SFTP&amp;gt;'s password:"&amp;gt;
&amp;lt;SFTPPASSWORD&amp;gt;
&amp;lt;EXPECT-"&amp;lt;USERNAME&amp;gt;@&amp;lt;HOSTNAME&amp;gt;"&amp;gt;
scp import high-availability-key from sftpuser@&amp;lt;SFTP&amp;gt;:/home/sftpuser/HA-key-&amp;lt;SN#A&amp;gt;
&amp;lt;EXPECT-"sftpuser@&amp;lt;SFTP&amp;gt;'s password:"&amp;gt;
&amp;lt;SFTPPASSWORD&amp;gt;
&amp;lt;EXPECT-"&amp;lt;USERNAME&amp;gt;@&amp;lt;HOSTNAME&amp;gt;"&amp;gt;
exit

SSH to &amp;lt;USERNAME&amp;gt;@&amp;lt;FWA-IP&amp;gt;
&amp;lt;EXPECT-"Password:"&amp;gt;
&amp;lt;SSHPASSWORD&amp;gt;
&amp;lt;EXPECT-"&amp;lt;USERNAME&amp;gt;@&amp;lt;HOSTNAME&amp;gt;"&amp;gt;
scp import high-availability-key from sftpuser@&amp;lt;SFTP&amp;gt;:/home/sftpuser/HA-key-&amp;lt;SN#B&amp;gt;
&amp;lt;EXPECT-"sftpuser@&amp;lt;SFTP&amp;gt;'s password:"&amp;gt;
&amp;lt;SFTPPASSWORD&amp;gt;
&amp;lt;EXPECT-"&amp;lt;USERNAME&amp;gt;@&amp;lt;HOSTNAME&amp;gt;"&amp;gt;
exit&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;I haven't ever used expect and that is just psuedo code based on what it might be like.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 21:07:46 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/527779#M3299</guid>
      <dc:creator>sborba-ntx</dc:creator>
      <dc:date>2023-01-19T21:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Automating HA key exchange</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/527802#M3300</link>
      <description>&lt;P&gt;ok - I am not a patient person here are the scripts&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;#!/usr/bin/expect
#Usage exporthakey.expect &amp;lt;host&amp;gt; &amp;lt;ssh user&amp;gt; &amp;lt;ssh password&amp;gt; &amp;lt;SFTP IP&amp;gt; &amp;lt;sftp user&amp;gt; &amp;lt;sftp password&amp;gt; &amp;lt;local SN#&amp;gt;

set timeout 60

spawn ssh [lindex $argv 1]@[lindex $argv 0]

expect "yes/no" {
        send "yes\r"
        expect "*?assword" { send "[lindex $argv 2]\r" }
        } "*?assword" { send "[lindex $argv 2]\r" }

expect "&amp;gt; " { send "scp export high-availability-key from HA-key-[lindex $argv 6] to [lindex $argv 4]@[lindex $argv 3]:HA-key-[lindex $argv 6]\r" }
expect "yes/no" {
        send "yes\r"
        expect "password: " { send "[lindex $argv 5]\r" }
        } "password: " { send "[lindex $argv 5]\r" }
expect "&amp;gt; " { send "exit\r" }&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;#!/usr/bin/expect
#Usage importhakey.expect &amp;lt;host&amp;gt; &amp;lt;ssh user&amp;gt; &amp;lt;ssh password&amp;gt; &amp;lt;SFTP IP&amp;gt; &amp;lt;sftp user&amp;gt; &amp;lt;sftp password&amp;gt; &amp;lt;peer SN#&amp;gt;

set timeout 60

spawn ssh [lindex $argv 1]@[lindex $argv 0]

expect "yes/no" {
        send "yes\r"
        expect "*?assword" { send "[lindex $argv 2]\r" }
        } "*?assword" { send "[lindex $argv 2]\r" }

expect "&amp;gt; " { send "scp import high-availability-key from [lindex $argv 4]@[lindex $argv 3]:~/HA-key-[lindex $argv 6]\r" }
expect "yes/no" {
        send "yes\r"
        expect "password: " { send "[lindex $argv 5]\r" }
        } "password: " { send "[lindex $argv 5]\r" }
expect "&amp;gt; " { send "exit\r" }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You would export on each, then import - 4 ssh connections, not optimized for speed, but optimized for code base.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 18:04:53 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/automating-ha-key-exchange/m-p/527802#M3300</guid>
      <dc:creator>sborba-ntx</dc:creator>
      <dc:date>2023-01-20T18:04:53Z</dc:date>
    </item>
  </channel>
</rss>

