<?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: Script suggestions - execute multiple commands to 20+ gateways - R80.40 in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132934#M6402</link>
    <description>&lt;P&gt;I did find this link from sk101047&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion/Central-Script-to-run-command-on-multiple-gateways/td-p/38948" target="_blank"&gt;https://community.checkpoint.com/t5/API-CLI-Discussion/Central-Script-to-run-command-on-multiple-gateways/td-p/38948&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It looks like it would solve most of what I need. Unfortunately you have to type the command in. Would like the ability to either paste multiple commands when it asks, or have the script reference a file for the commands&amp;nbsp; (like it does for the gateway IP's)&lt;/P&gt;</description>
    <pubDate>Sun, 31 Oct 2021 13:59:45 GMT</pubDate>
    <dc:creator>JaySon_2021</dc:creator>
    <dc:date>2021-10-31T13:59:45Z</dc:date>
    <item>
      <title>Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132909#M6394</link>
      <description>&lt;P&gt;I have a need to enter multiple expert mode commands (basically adding objects) to about 20 or so R80.40 firewalls. I have direct access to the firewalls via SSH from a jump server. Looking for suggestions to script the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- ssh to firewall&lt;/P&gt;&lt;P&gt;-run expert mode commands&lt;/P&gt;&lt;P&gt;- exit&lt;/P&gt;&lt;P&gt;- ssh to next firewall&lt;/P&gt;&lt;P&gt;-run expert mode commands&lt;/P&gt;&lt;P&gt;- etc&lt;/P&gt;&lt;P&gt;From what I have read it sounds like I could create a script in the repository and run it on each firewall from Smartconsole (ie: right click, run script) but I am looking for a more automated way to do it. Ansible looks like it may be what I need. Just looking for suggestions.&lt;/P&gt;&lt;P&gt;Note - I do not want to have to install any special software on the management station or endpoints. Just looking for a simple solution if possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 19:36:09 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132909#M6394</guid>
      <dc:creator>RCordova</dc:creator>
      <dc:date>2021-10-30T19:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132911#M6395</link>
      <description>&lt;P&gt;The one-liner below can be run in expert mode on your management server to execute EXPERT_MODE_COMMANDS on all your centrally managed gateways:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;echo; for i in `grep 'sic_name\|ipaddr' $FWDIR/conf/objects.C|grep -A1 sic_name|grep 'ipaddr '|tr -d ':ipadr ()\t'`; do cprid_util -server $i -verbose rexec -rcmd /bin/bash -c "EXPERT_MODE_COMMANDS"; done&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Pro:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;no additional software / expertise required&lt;/LI&gt;
&lt;LI&gt;utilizes Check Point's native &lt;CODE&gt;cprid_util&lt;/CODE&gt;&amp;nbsp;(&lt;A href="https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&amp;amp;solutionid=sk101047" target="_self"&gt;&lt;EM&gt;sk101047&lt;/EM&gt;&lt;/A&gt;)&lt;/LI&gt;
&lt;LI&gt;can be run as cronjob&lt;/LI&gt;
&lt;LI&gt;can be added to SmartConsole's script repository to manually run the one-liner from there&lt;/LI&gt;
&lt;LI&gt;can be easily adjusted to be executed for specific gateways only&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Sun, 31 Oct 2021 15:48:21 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132911#M6395</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2021-10-31T15:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132923#M6398</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp; You can use the CDT to run the script on a pre-defined candidates list&lt;/P&gt;
&lt;P&gt;&amp;nbsp; The deployment plan shall be very simple and you can control the candidates list by simply editing a csv file&lt;/P&gt;
&lt;P&gt;&amp;nbsp; SK111158 provides details&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 04:48:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132923#M6398</guid>
      <dc:creator>Boaz_Orshav</dc:creator>
      <dc:date>2021-10-31T04:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132930#M6400</link>
      <description>&lt;P&gt;Thanks Danny. I think I'd like more control. Meaning, I'd like to do a few endpoints at a time by passing hosts to the command from a file.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 13:32:29 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132930#M6400</guid>
      <dc:creator>RCordova</dc:creator>
      <dc:date>2021-10-31T13:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132931#M6401</link>
      <description>&lt;P&gt;Thanks Boaz. I want to find a solution (if possible) where I don't have to install any software on the management station.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 13:32:09 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132931#M6401</guid>
      <dc:creator>RCordova</dc:creator>
      <dc:date>2021-10-31T13:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132934#M6402</link>
      <description>&lt;P&gt;I did find this link from sk101047&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion/Central-Script-to-run-command-on-multiple-gateways/td-p/38948" target="_blank"&gt;https://community.checkpoint.com/t5/API-CLI-Discussion/Central-Script-to-run-command-on-multiple-gateways/td-p/38948&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It looks like it would solve most of what I need. Unfortunately you have to type the command in. Would like the ability to either paste multiple commands when it asks, or have the script reference a file for the commands&amp;nbsp; (like it does for the gateway IP's)&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 13:59:45 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132934#M6402</guid>
      <dc:creator>JaySon_2021</dc:creator>
      <dc:date>2021-10-31T13:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132950#M6403</link>
      <description>&lt;P&gt;Cool. Below is an example to read in the gateways's IP addresses from a file.txt:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;echo; while read i; do cprid_util -server $i -verbose rexec -rcmd /bin/bash -c "EXPERT_MODE_COMMANDS"; done &amp;lt;file.txt&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 15:56:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132950#M6403</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2021-10-31T15:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132951#M6404</link>
      <description>&lt;P&gt;CDT is built in?&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 16:39:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132951#M6404</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-10-31T16:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132954#M6405</link>
      <description>&lt;P&gt;Thanks PB. I assumed it wasn't installed by default as I didn't see a mention of that in the SK (sk111158).&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 21:39:42 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/132954#M6405</guid>
      <dc:creator>JaySon_2021</dc:creator>
      <dc:date>2021-10-31T21:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Script suggestions - execute multiple commands to 20+ gateways - R80.40</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/133118#M6409</link>
      <description>&lt;P&gt;The script is a very simple and rough example of how to use&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;cprid_util&lt;/STRONG&gt;. I recommend you to learn basics of Unix shell first.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You can pass multiple shell commands separated by semicolons to the &lt;STRONG&gt;-c&lt;/STRONG&gt; argument of bash. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;bash -c "echo 1 ; echo 2"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can even have the commands in a file separated by newlines (like a regular shell script):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;$ cat &amp;gt;tmpcmds.txt
echo 1
echo 2

$ bash -c "$(&amp;lt;tmpcmds.txt)"
1
2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second one-liner from Danny is better suited for this task than the script you are referring to. Certainly first test anything on mostly harmless commands like &lt;STRONG&gt;echo&lt;/STRONG&gt;. It is a good practice to first change the real commands to tests by prepending &lt;STRONG&gt;echo&lt;/STRONG&gt; to them.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Nov 2021 10:34:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-suggestions-execute-multiple-commands-to-20-gateways-R80/m-p/133118#M6409</guid>
      <dc:creator>Václav_Brožík</dc:creator>
      <dc:date>2021-11-03T10:34:32Z</dc:date>
    </item>
  </channel>
</rss>

