Sync Servers now set be ENV SYNCSERVERS - Closes #40

pull/1/head
Jason Kendall 2020-03-11 14:00:10 -04:00
parent 7c7216b9cb
commit dcd893e069
2 changed files with 22 additions and 9 deletions

View File

@ -39,6 +39,7 @@ services:
- "HOSTNAME=https://localhost"
- "INIT=true" # Initialze MISP, things includes, attempting to import SQL and the Files DIR
# - "NOREDIR=true" #Do not redirect port 80
# - "SYNCSERVERS=1 2 3 4"
misp-modules:
image: coolacid/misp-docker:modules-latest

View File

@ -2,19 +2,31 @@
# Create the misp cron tab
cat << EOF > /etc/cron.d/misp
00 0 * * * www-data /var/www/MISP/app/Console/cake Server pull "$CRON_USER_ID" >/tmp/cronlog 2>/tmp/cronlog
10 0 * * * www-data /var/www/MISP/app/Console/cake Server push "$CRON_USER_ID" >/tmp/cronlog 2>/tmp/cronlog
20 0 * * * www-data /var/www/MISP/app/Console/cake Server cacheFeed "$CRON_USER_ID" all >/tmp/cronlog 2>/tmp/cronlog
30 0 * * * www-data /var/www/MISP/app/Console/cake Server fetchFeed "$CRON_USER_ID" all >/tmp/cronlog 2>/tmp/cronlog
20 2 * * * www-data /var/www/MISP/app/Console/cake Server cacheFeed "$CRON_USER_ID" all >/tmp/cronlog 2>/tmp/cronlog
30 2 * * * www-data /var/www/MISP/app/Console/cake Server fetchFeed "$CRON_USER_ID" all >/tmp/cronlog 2>/tmp/cronlog
00 1 * * * www-data /var/www/MISP/app/Console/cake Admin updateGalaxies >/tmp/cronlog 2>/tmp/cronlog
10 1 * * * www-data /var/www/MISP/app/Console/cake Admin updateTaxonomies >/tmp/cronlog 2>/tmp/cronlog
20 1 * * * www-data /var/www/MISP/app/Console/cake Admin updateWarningLists >/tmp/cronlog 2>/tmp/cronlog
30 1 * * * www-data /var/www/MISP/app/Console/cake Admin updateNoticeLists >/tmp/cronlog 2>/tmp/cronlog
45 1 * * * www-data /var/www/MISP/app/Console/cake Admin updateObjectTemplates >/tmp/cronlog 2>/tmp/cronlog
00 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateGalaxies >/tmp/cronlog 2>/tmp/cronlog
10 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateTaxonomies >/tmp/cronlog 2>/tmp/cronlog
20 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateWarningLists >/tmp/cronlog 2>/tmp/cronlog
30 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateNoticeLists >/tmp/cronlog 2>/tmp/cronlog
45 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateObjectTemplates >/tmp/cronlog 2>/tmp/cronlog
EOF
if [ ! -z "$SYNCSERVERS" ];
then
TIME=0
for SYNCSERVER in $SYNCSERVERS
do
cat << EOF >> /etc/cron.d/misp
$TIME 0 * * * www-data /var/www/MISP/app/Console/cake Server pull "$CRON_USER_ID" "$SYNCSERVER">/tmp/cronlog 2>/tmp/cronlog
$TIME 1 * * * www-data /var/www/MISP/app/Console/cake Server push "$CRON_USER_ID" "$SYNCSERVER">/tmp/cronlog 2>/tmp/cronlog
EOF
((TIME+=5))
done
fi
# Build a fifo buffer for the cron logs, 777 so anyone can write to it
if [[ ! -p /tmp/cronlog ]]; then
mkfifo /tmp/cronlog