|
@@ -1060,14 +1060,14 @@ function install_not_on_BBB {
|
1060
|
1060
|
function randomize_cron {
|
1061
|
1061
|
# The predictable default timing of Debian cron jobs might
|
1062
|
1062
|
# be exploitable knowledge. Avoid too much predictability
|
1063
|
|
- # by randomizing the times when cron jobs run
|
|
1063
|
+ # by randomizing the times when cron jobs run
|
1064
|
1064
|
if grep -Fxq "randomize_cron" $COMPLETION_FILE; then
|
1065
|
1065
|
return
|
1066
|
1066
|
fi
|
1067
|
1067
|
|
1068
|
1068
|
# randomize the day on which the weekly cron job runs
|
1069
|
1069
|
randdow=$(($RANDOM%6+1))
|
1070
|
|
- sed -i "s/* * 7/* $randdow/g" /etc/crontab
|
|
1070
|
+ sed -i "s|\* \* 7|* * $randdow|g" /etc/crontab
|
1071
|
1071
|
|
1072
|
1072
|
# randomize the time when the weekly cron job runs
|
1073
|
1073
|
randmin=$(($RANDOM%60))
|
|
@@ -1077,12 +1077,15 @@ function randomize_cron {
|
1077
|
1077
|
# randomize the time when the daily cron job runs
|
1078
|
1078
|
randmin=$(($RANDOM%60))
|
1079
|
1079
|
randhr=$(($RANDOM%3+4))
|
1080
|
|
- sed -i "s|25 6\t* * *|$randmin $randhr\t|g" /etc/crontab
|
|
1080
|
+ sed -i "s|25 6\t\* \* \*|$randmin $randhr\t* * *|g" /etc/crontab
|
1081
|
1081
|
|
1082
|
1082
|
# randomize the time when the hourly cron job runs
|
1083
|
1083
|
randmin=$(($RANDOM%60))
|
1084
|
|
- sed -i "s|17 *\t* * *|$randmin *\t|g" /etc/crontab
|
|
1084
|
+ sed -i "s|17 \*\t|$randmin *\t|g" /etc/crontab
|
1085
|
1085
|
|
|
1086
|
+ # randomize monthly cron job time and day
|
|
1087
|
+ sed -i "s|52 6\t|$randmin $randhr\t|g" /etc/crontab
|
|
1088
|
+ sed -i "s|\t1 \* \*|\t$randdom * *|g" /etc/crontab
|
1086
|
1089
|
echo 'randomize_cron' >> $COMPLETION_FILE
|
1087
|
1090
|
}
|
1088
|
1091
|
|