diff options
-rw-r--r-- | cf/conf/config.xml | 74 | ||||
-rw-r--r-- | conf.default/config.xml | 74 | ||||
-rw-r--r-- | etc/crontab | 10 | ||||
-rw-r--r-- | etc/inc/pfsense-utils.inc | 3 | ||||
-rw-r--r-- | etc/inc/services.inc | 48 | ||||
-rwxr-xr-x | etc/rc.bootup | 3 |
6 files changed, 203 insertions, 9 deletions
diff --git a/cf/conf/config.xml b/cf/conf/config.xml index c00436b..f13c6f7 100644 --- a/cf/conf/config.xml +++ b/cf/conf/config.xml @@ -532,6 +532,80 @@ </wolentry> --> </wol> + <cron> + <item> + <minute>0</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 newsyslog</command> + </item> + <item> + <minute>1,31</minute> + <hour>0-5</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 adjkerntz -a</command> + </item> + <item> + <minute>1</minute> + <hour>*</hour> + <mday>1</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /etc/rc.update_bogons.sh</command> + </item> + <item> + <minute>*/60</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 sshlockout</command> + </item> + <item> + <minute>1</minute> + <hour>1</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /etc/rc.dyndns.update</command> + </item> + <item> + <minute>*/60</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot</command> + </item> + <item> + <minute>*/60</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /usr/local/sbin/expiretable -t 1800 snort2c</command> + </item> + <item> + <minute>*/5</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/local/bin/checkreload.sh</command> + </item> + </cron> <installedpackages> </installedpackages> </pfsense> diff --git a/conf.default/config.xml b/conf.default/config.xml index abc7376..47bebdc 100644 --- a/conf.default/config.xml +++ b/conf.default/config.xml @@ -523,6 +523,80 @@ </proxyarpnet> --> </proxyarp> + <cron> + <item> + <minute>0</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 newsyslog</command> + </item> + <item> + <minute>1,31</minute> + <hour>0-5</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 adjkerntz -a</command> + </item> + <item> + <minute>1</minute> + <hour>*</hour> + <mday>1</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /etc/rc.update_bogons.sh</command> + </item> + <item> + <minute>*/60</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 sshlockout</command> + </item> + <item> + <minute>1</minute> + <hour>1</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /etc/rc.dyndns.update</command> + </item> + <item> + <minute>*/60</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot</command> + </item> + <item> + <minute>*/60</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /usr/local/sbin/expiretable -t 1800 snort2c</command> + </item> + <item> + <minute>*/5</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/local/bin/checkreload.sh</command> + </item> + </cron> <wol> <!-- <wolentry> diff --git a/etc/crontab b/etc/crontab index 1309474..8be8494 100644 --- a/etc/crontab +++ b/etc/crontab @@ -2,12 +2,4 @@ SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin HOME=/var/log #minute hour mday month wday who command -0 * * * * root /usr/bin/nice -n20 newsyslog -1,31 0-5 * * * root /usr/bin/nice -n20 adjkerntz -a -1 * 1 * * root /usr/bin/nice -n20 /etc/rc.update_bogons.sh -*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 sshlockout -1 1 * * * root /usr/bin/nice -n20 /etc/rc.dyndns.update -*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot -*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -t 1800 snort2c -*/60 * * * * root /usr/bin/nice -n20 /usr/local/sbin/expiretable -t 1800 snort2c -*/5 * * * * root /usr/local/bin/checkreload.sh
\ No newline at end of file +#
\ No newline at end of file diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 190ce10..e1f511d 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1851,6 +1851,9 @@ function reload_all_sync() { /* start DHCP service */ services_dhcpd_configure(); + /* configure cron service */ + configure_cron(); + /* start the NTP client */ system_ntp_configure(); diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 81252e1..0832212 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -1181,4 +1181,52 @@ EODAD; conf_mount_ro(); } +/* configure cron service */ +function configure_cron() { + global $g, $config; + if (!$g['booting']) + conf_mount_rw(); + /* preserve existing crontab entries */ + $crontab_contents = file_get_contents("/etc/crontab"); + $crontab_contents_a = split("\n", $crontab_contents); + + for ($i = 0; $i < count($crontab_contents_a); $i++) { + $item =& $crontab_contents_a[$i]; + if (strpos($item, "# pfSense specific crontab entries") !== false) { + array_splice($crontab_contents_a, $i - 1); + break; + } + } + $crontab_contents = implode("\n", $crontab_contents_a) . "\n"; + + + if (is_array($config['cron']['item'])) { + $crontab_contents .= "#\n"; + $crontab_contents .= "# pfSense specific crontab entries\n"; + $crontab_contents .= "# Created: " . date("F j, Y, g:i a") . "\n"; + $crontab_contents .= "#\n"; + + foreach ($config['cron']['item'] as $item) { + $crontab_contents .= "\n{$item['minute']}\t"; + $crontab_contents .= "{$item['hour']}\t"; + $crontab_contents .= "{$item['mday']}\t"; + $crontab_contents .= "{$item['month']}\t"; + $crontab_contents .= "{$item['wday']}\t"; + $crontab_contents .= "{$item['who']}\t"; + $crontab_contents .= "{$item['command']}"; + } + + $crontab_contents .= "\n#\n"; + $crontab_contents .= "# If possible do not add items to this file manually.\n"; + $crontab_contents .= "# If you do so, this file must be terminated with a blank line (e.g. new line)\n"; + $crontab_contents .= "#\n\n"; + } + + /* please maintain the newline at the end of file */ + file_put_contents("/etc/crontab", $crontab_contents); + + if (!$g['booting']) + conf_mount_ro(); +} + ?> diff --git a/etc/rc.bootup b/etc/rc.bootup index 6d18662..1c251d5 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -205,6 +205,9 @@ system_webgui_start(); } + /* configure cron service */ + configure_cron(); + /* set up static routes */ system_routing_configure(); |