From b348f79d5126c5a5fca40f5c00cd9ca9cb61d38b Mon Sep 17 00:00:00 2001 From: doug Date: Sun, 15 May 2016 06:47:35 -0400 Subject: [PATCH] random cron delay should be at least 10 minutes --- bin/so-squert-ip2c | 5 ++- debian/changelog | 6 +++ ...m-cron-delay-should-be-at-least-10-minutes | 40 +++++++++++++++++++ debian/patches/series | 1 + 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 debian/patches/random-cron-delay-should-be-at-least-10-minutes diff --git a/bin/so-squert-ip2c b/bin/so-squert-ip2c index 1b796b6..e201017 100644 --- a/bin/so-squert-ip2c +++ b/bin/so-squert-ip2c @@ -48,9 +48,10 @@ else date > $IP2C_LOG echo >> $IP2C_LOG - # If running from cron, pause for a random number of minutes (up to 50). + # If running from cron, pause for a random number of minutes (between 10 and 50). if [ $# -eq 1 ] && [ $1 == "cron" ]; then - RMIN=$(($(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -d' ' -f1) % 50)); + RMIN=$(($(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -d' ' -f1) % 40)); + let RMIN=RMIN+10 echo "Sleeping for $RMIN minutes to avoid overwhelming sites." >> $IP2C_LOG sleep ${RMIN}m date >> $IP2C_LOG diff --git a/debian/changelog b/debian/changelog index 01a6e73..98f7294 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +securityonion-squert-cron (20120722-0ubuntu0securityonion9) trusty; urgency=medium + + * random cron delay should be at least 10 minutes + + -- Doug Burks Sun, 15 May 2016 06:46:30 -0400 + securityonion-squert-cron (20120722-0ubuntu0securityonion8) trusty; urgency=medium * change $LOG to $IP2C_LOG diff --git a/debian/patches/random-cron-delay-should-be-at-least-10-minutes b/debian/patches/random-cron-delay-should-be-at-least-10-minutes new file mode 100644 index 0000000..91c79eb --- /dev/null +++ b/debian/patches/random-cron-delay-should-be-at-least-10-minutes @@ -0,0 +1,40 @@ +Description: + TODO: Put a short summary on the line above and replace this paragraph + with a longer explanation of this change. Complete the meta-information + with other relevant fields (see below for details). To make it easier, the + information below has been extracted from the changelog. Adjust it or drop + it. + . + securityonion-squert-cron (20120722-0ubuntu0securityonion9) trusty; urgency=medium + . + * random cron delay should be at least 10 minutes +Author: Doug Burks + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: http://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: + +--- securityonion-squert-cron-20120722.orig/bin/so-squert-ip2c ++++ securityonion-squert-cron-20120722/bin/so-squert-ip2c +@@ -48,9 +48,10 @@ else + date > $IP2C_LOG + echo >> $IP2C_LOG + +- # If running from cron, pause for a random number of minutes (up to 50). ++ # If running from cron, pause for a random number of minutes (between 10 and 50). + if [ $# -eq 1 ] && [ $1 == "cron" ]; then +- RMIN=$(($(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -d' ' -f1) % 50)); ++ RMIN=$(($(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -d' ' -f1) % 40)); ++ let RMIN=RMIN+10 + echo "Sleeping for $RMIN minutes to avoid overwhelming sites." >> $IP2C_LOG + sleep ${RMIN}m + date >> $IP2C_LOG diff --git a/debian/patches/series b/debian/patches/series index af6e323..0867a30 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,3 +6,4 @@ Squert-ip2c-cron-job-should-run-as-a-non-root-user-and-sleep-a-random-number-of- add-cron-option-to-force-random-delay upload-to-git change-$LOG-to-$IP2C_LOG +random-cron-delay-should-be-at-least-10-minutes