Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamically create crontab entries based on cake output for sync servers #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

garrit-schroeder
Copy link

@garrit-schroeder garrit-schroeder commented Mar 3, 2021

Hello @coolacid,

I have created this pull request to to allow the crontabs for MISP to be generated automatically based on configured Sync Servers in MISP.

added dependencies:

curl
This is needed because the crontab entrypoint needs to wait for nginx to startup. Otherwise the command cake Server listServers will fail. The MySQL Database is not ready at an earlier stage.
Is there a scenario where nginx will only listen on port 80? Then this will not work.

jq
This is needed for parsing the JSON output of the command cake Server listServers

Allows the removal of the environment variable: SYNCSERVERS

One thing to point out is that adding / removing sync servers from MISP requires a restart of the container. (It actually does in this version and in the one before as well. So not really a change. )

Also fixes:
https://github.com/coolacid/docker-misp/issues/99

@garrit-schroeder
Copy link
Author

What do you think about putting this in its own container?

@coolacid
Copy link
Owner

I'm going to think about this one a bit more. Couple notes:

  1. I don't want to force everyone to sync all their servers, so this needs to be configurable if included
  2. Adding Curl/jq adds more size that may/may not be warranted. Maybe a PHP script since we already have PHP might be better?

I think the entire cron thing needs to be looked at - so we're not forcing people into doing things they may want to change. Like, if there's a volume mounted cron file, don't make a new one, etc.

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 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
45 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateObjectTemplates 1 >/tmp/cronlog 2>/tmp/cronlog

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this "1" the same as the CRON_USER_ID a few lines up (which defaults to 1) or something entirely different?

@paalbra
Copy link
Contributor

paalbra commented Nov 9, 2021

  1. I don't want to force everyone to sync all their servers, so this needs to be configurable if included

👍

I would not like to sync all servers. I actually don't use SYNCSERVERS now since I want even more control (so I'm adding my own cron file after container creation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants