<?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: Pre-R80.10 dynamic objects from DNS A record lists.. one liner examples in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/58447#M3705</link>
    <description>You couldn't use Domain Objects in NAT rules in R77.x either as far as I know.</description>
    <pubDate>Thu, 18 Jul 2019 08:02:35 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2019-07-18T08:02:35Z</dc:date>
    <item>
      <title>Pre-R80.10 dynamic objects from DNS A record lists.. one liner examples</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/11566#M3427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ever want to allow access to "google.com" or "google.com.au" or some large lists of A record hosts (like AWS or Azure hosted front end elastic load balancers.. or akamai hosted stuff etc)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Domain objects not doing it for you? (reverse lookups only the first address)&lt;/P&gt;&lt;P&gt;Logical server objects not doing it for you (like they do in AWS/Azure autoscaling?)&lt;/P&gt;&lt;P&gt;Not on R80.10 yet?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a dynamic object as a destination.. then on the command line do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The dynamic object name here is "dynamic_dns_hosts" and must match the dynamic object created in the policy editor (smartconsole).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;[Expert@gw-913127:0]# dynamic_objects -n dynamic_dns_hosts&lt;/P&gt;&lt;P&gt;Operation completed successfully&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To populate the dynamic object run the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Expert@gw-913127:0]# dig +short my.changing.cloud.hostname.com google.com google.com.au|sort -u|awk '{print $1" "$1}'|xargs dynamic_objects -a -o dynamic_dns_hosts -r&lt;/P&gt;&lt;P&gt;Operation completed successfully&lt;/P&gt;&lt;P&gt;Log update success&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the object has been updated (shows both in the logs in tracker as well):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;[Expert@gw-913127:0]# dynamic_objects -l&lt;/P&gt;&lt;P&gt;object name : CPDShield&lt;BR /&gt;range 0 : 0.0.0.1 0.0.0.1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;object name : dynamic_dns_hosts&lt;BR /&gt;range 0 : 34.210.127.64 34.210.127.64&lt;BR /&gt;range 1 : 34.213.84.59 34.213.84.59&lt;BR /&gt;range 2 : 35.160.229.160 35.160.229.160&lt;BR /&gt;range 3 : 35.163.99.121 35.163.99.121&lt;BR /&gt;range 4 : 54.148.3.136 54.148.3.136&lt;BR /&gt;range 5 : 54.186.179.15 54.186.179.15&lt;BR /&gt;range 6 : 54.187.44.205 54.187.44.205&lt;BR /&gt;range 7 : 54.244.5.167 54.244.5.167&lt;BR /&gt;range 8 : 172.217.25.35 172.217.25.35&lt;BR /&gt;range 9 : 216.58.203.110 216.58.203.110&lt;/P&gt;&lt;P&gt;Operation completed successfully&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's possible to write this into cron (scheduled_task) or run in a while loop. It's possible also to depopulate the object, delete the object and all the other things too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're interested in doing this in python, there's some cool tools here (someone at checkpoint wrote it):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://bitbucket.org/chkp/dynobj/overview" title="https://bitbucket.org/chkp/dynobj/overview"&gt;chkp / dynobj — Bitbucket&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Nov 2017 11:04:27 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/11566#M3427</guid>
      <dc:creator>Iain_King</dc:creator>
      <dc:date>2017-11-15T11:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Pre-R80.10 dynamic objects from DNS A record lists.. one liner examples</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/52814#M3428</link>
      <description>This is an old post, but found it as I was looking for something to help someone.&lt;BR /&gt;Also moved it to Code Hub as it seemed like a better place for it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 07 May 2019 21:04:13 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/52814#M3428</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-05-07T21:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Pre-R80.10 dynamic objects from DNS A record lists.. one liner examples</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/58397#M3696</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can not use domain objects in NAT rules in R80. So you can use dynamic objects.&lt;/P&gt;&lt;P&gt;First create a file on your disk, such as /home/admin/file_on_your_disk.txt. Add host names line by line.&lt;/P&gt;&lt;P&gt;then create a script and add it to cron. If daily, you can use CP Job Scheduler. If frequency is less than a day then refer to sk77300.&lt;/P&gt;&lt;P&gt;-------------------------------------------------&lt;BR /&gt;#!/bin/sh&lt;/P&gt;&lt;P&gt;source /opt/CPshrd-R80/tmp/.CPprofile.sh&lt;/P&gt;&lt;P&gt;dig +short -f file_on_your_disk.txt | grep '^[.0-9]*$'| sort -u | awk '{print $1" "$1}' | xargs dynamic_objects -a -o dynamic_dns_hosts -r&lt;BR /&gt;-------------------------------------------------&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 11:26:59 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/58397#M3696</guid>
      <dc:creator>Cihat_Bulut</dc:creator>
      <dc:date>2019-07-17T11:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Pre-R80.10 dynamic objects from DNS A record lists.. one liner examples</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/58447#M3705</link>
      <description>You couldn't use Domain Objects in NAT rules in R77.x either as far as I know.</description>
      <pubDate>Thu, 18 Jul 2019 08:02:35 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/58447#M3705</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-07-18T08:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Pre-R80.10 dynamic objects from DNS A record lists.. one liner examples</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/89103#M4965</link>
      <description>Looks like the new home for the dynobj code is: &lt;A href="https://github.com/CheckPointSW/dynobj" target="_blank"&gt;https://github.com/CheckPointSW/dynobj&lt;/A&gt;</description>
      <pubDate>Thu, 18 Jun 2020 22:15:36 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Pre-R80-10-dynamic-objects-from-DNS-A-record-lists-one-liner/m-p/89103#M4965</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-06-18T22:15:36Z</dc:date>
    </item>
  </channel>
</rss>

