diff --git a/core/files/configure_misp.sh b/core/files/configure_misp.sh index c566903..ea6e431 100755 --- a/core/files/configure_misp.sh +++ b/core/files/configure_misp.sh @@ -351,11 +351,18 @@ init_settings() { } update_components() { - sudo -u www-data /var/www/MISP/app/Console/cake Admin updateGalaxies - sudo -u www-data /var/www/MISP/app/Console/cake Admin updateTaxonomies - sudo -u www-data /var/www/MISP/app/Console/cake Admin updateWarningLists - sudo -u www-data /var/www/MISP/app/Console/cake Admin updateNoticeLists - sudo -u www-data /var/www/MISP/app/Console/cake Admin updateObjectTemplates "$CRON_USER_ID" + UPDATE_SUDO_CMD="sudo -u www-data" + if [ ! -z "${DB_ALREADY_INITIALISED}" ]; then + if [[ "$ENABLE_BACKGROUND_UPDATES" = "true" ]]; then + echo "... updates will run in the background" + UPDATE_SUDO_CMD="sudo -b -u www-data" + fi + fi + ${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateGalaxies + ${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateTaxonomies + ${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateWarningLists + ${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateNoticeLists + ${UPDATE_SUDO_CMD} /var/www/MISP/app/Console/cake Admin updateObjectTemplates "$CRON_USER_ID" } update_ca_certificates() { @@ -431,7 +438,7 @@ echo "MISP | Init default user and organization ..." && init_user echo "MISP | Resolve critical issues ..." && apply_critical_fixes -echo "MISP | Update components ..." && update_components +echo "MISP | Start component updates ..." && update_components echo "MISP | Resolve non-critical issues ..." && apply_optional_fixes diff --git a/core/files/entrypoint.sh b/core/files/entrypoint.sh index 4279010..3962cd1 100755 --- a/core/files/entrypoint.sh +++ b/core/files/entrypoint.sh @@ -30,6 +30,7 @@ export AUTOCONF_ADMIN_KEY=${AUTOCONF_ADMIN_KEY:-true} export OIDC_ENABLE=${OIDC_ENABLE:-false} export LDAP_ENABLE=${LDAP_ENABLE:-false} export ENABLE_DB_SETTINGS=${ENABLE_DB_SETTINGS:-false} +export ENABLE_BACKGROUND_UPDATES=${ENABLE_BACKGROUND_UPDATES:-false} export PROXY_ENABLE=${PROXY_ENABLE:-false} export DEBUG=${DEBUG:-0} diff --git a/core/files/entrypoint_nginx.sh b/core/files/entrypoint_nginx.sh index 49720af..e3e5b38 100755 --- a/core/files/entrypoint_nginx.sh +++ b/core/files/entrypoint_nginx.sh @@ -37,6 +37,7 @@ init_mysql(){ if [ $(isDBinitDone) -eq 0 ]; then echo "... database has already been initialized" + export DB_ALREADY_INITIALISED=true else echo "... database has not been initialized, importing MySQL scheme..." $MYSQLCMD < /var/www/MISP/INSTALL/MYSQL.sql diff --git a/docker-compose.yml b/docker-compose.yml index 3c918b8..0cb7ef5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -101,6 +101,7 @@ services: - "DISABLE_IPV6=${DISABLE_IPV6}" - "DISABLE_SSL_REDIRECT=${DISABLE_SSL_REDIRECT}" - "ENABLE_DB_SETTINGS=${ENABLE_DB_SETTINGS}" + - "ENABLE_BACKGROUND_UPDATES=${ENABLE_BACKGROUND_UPDATES}" - "ENCRYPTION_KEY=${ENCRYPTION_KEY}" # standard settings - "ADMIN_EMAIL=${ADMIN_EMAIL}" diff --git a/template.env b/template.env index 8118616..6f4e257 100644 --- a/template.env +++ b/template.env @@ -49,6 +49,8 @@ BASE_URL= ENABLE_DB_SETTINGS= # encryption key. defaults to empty string ENCRYPTION_KEY= +# enable background updates. defaults to false +ENABLE_BACKGROUND_UPDATES= # defines the FQDN of the mail sub-system (defaults to 'mail') # SMTP_FQDN=