<?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 Adding cron jobs with quotes in Firewall and Security Management</title>
    <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102242#M8024</link>
    <description>&lt;P&gt;One of the problems having gaia reinventing the wheel is the problem of adding simple commands using quotes.&lt;/P&gt;&lt;P&gt;For instance, a simple find command does not execute due to quotes being removed and wildcards executed in the wrong context.&lt;/P&gt;&lt;P&gt;Example, I want to clean up the /var/log/CPbackup/backups folder on a schedule.&lt;/P&gt;&lt;P&gt;The linux admin way is to do something like this in crontab:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;00      05      *       *       *       find /var/log/CPbackup/backups/ -name "*.tgz" -type f -mtime +1 -delete -print&lt;/LI-CODE&gt;&lt;P&gt;When adding this command with clish (add cron) the quotes disappear and the entire command changes fatally.&lt;/P&gt;&lt;P&gt;So one can "trick" clish by adding single quotes:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;add cron job backup_cleanup command 'find /var/log/CPbackup/backups/ -name "*.tgz" -type f -mtime +1 -delete -print' recurrence daily time 05:00&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Though what happens if you do a `show configuration cron`?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;harald-r80-40-mgmt&amp;gt; show configuration cron
add cron job backup_cleanup command "find /var/log/CPbackup/backups/ -name "*.tgz" -type f -mtime +1 -delete -print" recurrence daily time 07:45&lt;/LI-CODE&gt;&lt;P&gt;The double quotes are back again!&lt;/P&gt;&lt;P&gt;So if you want to be safe, don't use commands in gaia cron, call a script. Also remember &lt;SPAN&gt;sk90441&lt;/SPAN&gt;&amp;nbsp;(and &lt;SPAN&gt;sk167632).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;A plea to the clish developers; if you really have to reinvent the wheel, at least make it round.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Nov 2020 07:55:05 GMT</pubDate>
    <dc:creator>Harald_Hansen</dc:creator>
    <dc:date>2020-11-17T07:55:05Z</dc:date>
    <item>
      <title>Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102242#M8024</link>
      <description>&lt;P&gt;One of the problems having gaia reinventing the wheel is the problem of adding simple commands using quotes.&lt;/P&gt;&lt;P&gt;For instance, a simple find command does not execute due to quotes being removed and wildcards executed in the wrong context.&lt;/P&gt;&lt;P&gt;Example, I want to clean up the /var/log/CPbackup/backups folder on a schedule.&lt;/P&gt;&lt;P&gt;The linux admin way is to do something like this in crontab:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;00      05      *       *       *       find /var/log/CPbackup/backups/ -name "*.tgz" -type f -mtime +1 -delete -print&lt;/LI-CODE&gt;&lt;P&gt;When adding this command with clish (add cron) the quotes disappear and the entire command changes fatally.&lt;/P&gt;&lt;P&gt;So one can "trick" clish by adding single quotes:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;add cron job backup_cleanup command 'find /var/log/CPbackup/backups/ -name "*.tgz" -type f -mtime +1 -delete -print' recurrence daily time 05:00&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Though what happens if you do a `show configuration cron`?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;harald-r80-40-mgmt&amp;gt; show configuration cron
add cron job backup_cleanup command "find /var/log/CPbackup/backups/ -name "*.tgz" -type f -mtime +1 -delete -print" recurrence daily time 07:45&lt;/LI-CODE&gt;&lt;P&gt;The double quotes are back again!&lt;/P&gt;&lt;P&gt;So if you want to be safe, don't use commands in gaia cron, call a script. Also remember &lt;SPAN&gt;sk90441&lt;/SPAN&gt;&amp;nbsp;(and &lt;SPAN&gt;sk167632).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;A plea to the clish developers; if you really have to reinvent the wheel, at least make it round.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 07:55:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102242#M8024</guid>
      <dc:creator>Harald_Hansen</dc:creator>
      <dc:date>2020-11-17T07:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102249#M8025</link>
      <description>&lt;DIV class=""&gt;
&lt;P&gt;You always have to know the environment you are working with. Clish isn't Expert mode and has it's own limitations. Even when you are directly working on a Linux Bash you have to know how to work with single and double quotes in combination. You'll often find situations where you need to escape them \" to make something work. When your code gets too complex you'll sometimes even have to find more advanced ways to hide your code from Bash's syntax checking which is when you base64 encode it and only decode it at execution time.&lt;/P&gt;
&lt;P&gt;I always use this approach to cleanup the backup folder with no quotes involved:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;ls -tl /var/log/CPbackup/backups/*.tgz|tail -n +10|xargs rm -f&lt;/LI-CODE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 17 Nov 2020 08:56:07 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102249#M8025</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2020-11-17T08:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102250#M8026</link>
      <description>&lt;P&gt;Thanks for the tip, though I would avoid using -f when running any command as root.&lt;/P&gt;&lt;P&gt;Also, we don't need to make excuses for the clish developers, the clish environment has to improve, as expectations are for it to be linux compatible. Even though there are limitations these are not easy to discern and the edge cases are many.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 09:00:37 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102250#M8026</guid>
      <dc:creator>Harald_Hansen</dc:creator>
      <dc:date>2020-11-17T09:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102280#M8028</link>
      <description>&lt;P&gt;Why should clish improve by integrating bash ? You had the same difference in old SPLAT and have the same in GAiA Embedded, a linux compatible shell and a non-Linux CP config shell.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 12:09:02 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102280#M8028</guid>
      <dc:creator>G_W_Albrecht</dc:creator>
      <dc:date>2020-11-17T12:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102281#M8029</link>
      <description>&lt;P&gt;One could at least expect clish to keep quotes straight. The reason why is clish overwriting crontab, which splat did not do (if I remember correctly).&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 12:12:37 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102281#M8029</guid>
      <dc:creator>Harald_Hansen</dc:creator>
      <dc:date>2020-11-17T12:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102333#M8030</link>
      <description>&lt;P&gt;For security reasons Check Point is moving towards a general usage of its Clish, more and more avoiding the need for modifications within expert mode. &lt;A href="https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html" target="_self"&gt;Double quotes&lt;/A&gt; are a special thing even in pure Bash. Especially when not directly used at CLI which is the case for Clish scripts. Therefore I try to avoid using several characters and words and special characters at CLI, such as - and ", wherever possible &amp;gt;&amp;nbsp;&lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/One-liner-to-show-reserved-words-within-hostnames/td-p/98594" target="_self"&gt;Script example&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 14:09:40 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102333#M8030</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2020-11-17T14:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102372#M8040</link>
      <description>&lt;P&gt;Did you mean to leave the long option in there? Also this also doesn't protect against files with spaces in the names (just throwing it out there).&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 18:03:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102372#M8040</guid>
      <dc:creator>John_Fleming</dc:creator>
      <dc:date>2020-11-17T18:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102498#M8052</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;gt;For security reasons Check Point is moving towards a general usage of its Clish&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Then the developers should work even harder to improve clish and avoid the above mentioned pitfalls.&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;SPAN&gt;avoiding the need for modifications within expert mode&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The day I'm forced to work without expert is the day I'll move to that other firewall eco system. The main difference between CP and and that firewall is the possibility to troubleshoot with a shell and with Linux-ish behaviour.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 13:11:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102498#M8052</guid>
      <dc:creator>Harald_Hansen</dc:creator>
      <dc:date>2020-11-18T13:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102855#M8085</link>
      <description>&lt;P&gt;Even though it shows with double quotes, does the command you added actually work?&lt;BR /&gt;Seems to me this is a bug (visual or otherwise) and a TAC case is suggested.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 00:41:40 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102855#M8085</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-11-22T00:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102936#M8101</link>
      <description>&lt;P&gt;Probably it is a visual bug until you export and import the clish configuration:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;harald-r80-40-mgmt&amp;gt; add cron job testquote command "echo 'testing quotes'" recurrence daily time 09:00
harald-r80-40-mgmt&amp;gt; add cron job testquoteinvert command 'echo "testing quotes inverted"' recurrence daily time 09:00
harald-r80-40-mgmt&amp;gt; show configuration cron
add cron job testquoteinvert command "echo "testing quotes inverted"" recurrence daily time 09:00
add cron job testquote command "echo 'testing quotes'" recurrence daily time 09:00
[Expert@harald-r80-40-mgmt:0]# crontab -l
#  This file was AUTOMATICALLY GENERATED
#  Generated by /bin/cron_xlate on Mon Nov 23 08:13:05 2020
#
#  DO NOT EDIT
#
SHELL=/bin/bash
MAILTO=""
#
# mins  hrs     daysinm months  daysinw command
#

##testquoteinvert
00      09      *       *       *       echo "testing quotes inverted"

##testquote
00      09      *       *       *       echo 'testing quotes'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 07:20:56 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102936#M8101</guid>
      <dc:creator>Harald_Hansen</dc:creator>
      <dc:date>2020-11-23T07:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102937#M8102</link>
      <description>&lt;P&gt;I would recommend putting everything, even if it's only a single line command into a separate shell script and only invoking this through cron.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 07:34:04 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/102937#M8102</guid>
      <dc:creator>Norbert_Bohusch</dc:creator>
      <dc:date>2020-11-23T07:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/103122#M8128</link>
      <description>&lt;P&gt;While I agree, it requires additional steps while upgrading that are easy to forget.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I could keep things simple and configure everything in clish, we would avoid a lot of "I forgot to check this and that".&lt;/P&gt;&lt;P&gt;An example; we have to add some SNMP checks in monitoring for certain customers. Every time someone is doing a jumbo hotfix update we loose the settings and the NOC will call the engineer on duty, usually at night.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 10:36:13 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/103122#M8128</guid>
      <dc:creator>Harald_Hansen</dc:creator>
      <dc:date>2020-11-24T10:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/103126#M8129</link>
      <description>&lt;P&gt;I would honestly suggest to brief the person installing jumbo hf updates destroying config about the issues they cause - i thought we are all working in security business and just trying &lt;STRONG&gt;not&lt;/STRONG&gt; to burn down the house8)&lt;/img&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 10:57:49 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/103126#M8129</guid>
      <dc:creator>G_W_Albrecht</dc:creator>
      <dc:date>2020-11-24T10:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Adding cron jobs with quotes</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/103128#M8130</link>
      <description>&lt;P&gt;In a perfect world ... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the less perfect, real, instance, you will have people with various levels of knowledge and skill working with the firewalls. Even when we have some kind of responsibility at customers, we cannot deny them access to their own equipment. Or if there is a emergency and someone with no knowledge of the configuration has to do some emergency patching? There are many reasons why things don't go as planned.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 11:02:04 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Adding-cron-jobs-with-quotes/m-p/103128#M8130</guid>
      <dc:creator>Harald_Hansen</dc:creator>
      <dc:date>2020-11-24T11:02:04Z</dc:date>
    </item>
  </channel>
</rss>

