Cron - shell escape parameters using shlex functions

This commit is contained in:
Ad Schellevis 2021-11-19 19:58:19 +01:00
parent 6db23da495
commit 88ab77fc85

View File

@ -10,7 +10,11 @@ PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
{% for job in helpers.toList('OPNsense.cron.jobs.job') %}
{% if job.enabled|default('0') == '1' %}
# Origin/Description: {{job.origin}}/{{job.description}}
{{job.minutes}} {{job.hours}} {{job.days}} {{job.months}} {{job.weekdays}} /usr/local/sbin/configctl -d {{job.command}} {{job.parameters}}
{{job.minutes}} {{job.hours}} {{job.days}} {{job.months}} {{job.weekdays}} /usr/local/sbin/configctl -d {{job.command}} {%
if job.parameters %} {%
for param in job.parameters|shlex_split %} {{param|shlex_quote}}{%
endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}