diff --git a/docker-compose.yml b/docker-compose.yml index 659aad2..bbede58 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,13 +45,14 @@ services: # Database Configuration (And their defaults) # - "MYSQL_HOST=db" # - "MYSQL_USER=misp" -# - "MYSQL_PASSWORD=example" # NOTE: This should be AlphaNum with no Special Chars. Otherwise, edit config files after first run. +# - "MYSQL_PASSWORD=example" # NOTE: This should be AlphaNum with no Special Chars. Otherwise, edit config files after first run. # - "MYSQL_DATABASE=misp" # Optional Settings # - "NOREDIR=true" # Do not redirect port 80 # - "DISIPV6=true" # Disable IPV6 in nginx # - "SECURESSL=true" # Enable higher security SSL in nginx # - "MISP_MODULES_FQDN=http://misp-modules" # Set the MISP Modules FQDN, used for Enrichment_services_url/Import_services_url/Export_services_url +# - "ADMIN_PASSWORD=xxx" set temp password for the default user admin@admin.test only if INIT=true. Must comply with the password requirements in MISP. misp-modules: image: coolacid/misp-docker:modules-latest environment: diff --git a/server/Dockerfile b/server/Dockerfile index 4447617..0ddaf79 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -73,6 +73,7 @@ ARG PHP_VER supervisor \ git \ cron \ + curl \ openssl \ gpg-agent gpg \ ssdeep \ diff --git a/server/files/entrypoint_nginx.sh b/server/files/entrypoint_nginx.sh index 6bb0495..3292db0 100755 --- a/server/files/entrypoint_nginx.sh +++ b/server/files/entrypoint_nginx.sh @@ -189,5 +189,38 @@ if [[ "$WARNING53" == true ]]; then echo "WARNING - WARNING - WARNING" fi -# Start NGINX -nginx -g 'daemon off;' +# can run fine in the background +update_misp_submodules() { + echo "updating submodules. The first time will take a while." + # wait 5 seconds for nginx start up + sleep 5s + # request is needed because misp will not update itself without request + curl -s http://localhost/users/login > /dev/null + curl -s --insecure https://localhost/users/login > /dev/null + + # only on init and admin password variable not blank + if [ -n "$ADMIN_PASSWORD" ]; then + echo "setting new admin password" + /var/www/MISP/app/Console/cake Password admin@admin.test "$ADMIN_PASSWORD" + fi + + echo "Update Taxonomies" + /var/www/MISP/app/Console/cake Admin updateTaxonomies + echo "Update WarningLists" + /var/www/MISP/app/Console/cake Admin updateWarningLists + echo "Update NoticeLists" + /var/www/MISP/app/Console/cake Admin updateNoticeLists + echo "Update ObjectTemplates" + /var/www/MISP/app/Console/cake Admin updateObjectTemplates + echo "Update Galaxies" + # bug issue (https://github.com/MISP/MISP/issues/6921) | only succeeds after loading the webpage once + /var/www/MISP/app/Console/cake Admin updateGalaxies + echo "done updating" +} + +if [[ "$INIT" == true ]]; then + update_misp_submodules & +fi + +echo "starting nginx" +nginx -g 'daemon off;' \ No newline at end of file