Update set_up_proxy(), add DEBUG envar, minor fixes (#71)

* added missing PROXY_ENABLE envar to docker-compose.yml

add default value of false is PROXY_ENABLE unset

altered set_up_proxy() in configure_misp.sh to use json-based config system

fixed MISP.ca_path setting to use --force, since doesn't end in .pem

* Add DEBUG envar

Works in both config.php and system_settings table.
pull/75/head
UFOSmuggler 2024-06-11 21:36:39 +10:00 committed by GitHub
parent da3e3ae4f5
commit 261c541749
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 40 additions and 12 deletions

View File

@ -13,6 +13,8 @@ source /utilities.sh
[ -z "$OIDC_ENABLE" ] && OIDC_ENABLE="false"
[ -z "$LDAP_ENABLE" ] && LDAP_ENABLE="false"
[ -z "$ENABLE_DB_SETTINGS" ] && ENABLE_DB_SETTINGS="false"
[ -z "$PROXY_ENABLE" ] && PROXY_ENABLE="false"
[ -z "$DEBUG" ] && DEBUG=0
# We now use envsubst for safe variable substitution with pseudo-json objects for env var enforcement
# envsubst won't evaluate anything like $() or conditional variable expansion so lets do that here
@ -202,18 +204,12 @@ set_up_aad() {
}
set_up_proxy() {
if [[ "$PROXY_ENABLE" != "true" ]]; then
if [[ "$PROXY_ENABLE" == "true" ]]; then
echo "... configuring proxy settings"
init_settings "proxy"
else
echo "... Proxy disabled"
return
fi
echo "... configuring proxy settings"
sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q "Proxy.host" "$PROXY_HOST"
sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q "Proxy.port" "$PROXY_PORT"
sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q "Proxy.method" "$PROXY_METHOD"
sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q "Proxy.user" "$PROXY_USER"
sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q "Proxy.password" "$PROXY_PASSWORD"
}
apply_updates() {
@ -468,4 +464,4 @@ echo "MISP | Set Up AAD ..." && set_up_aad
echo "MISP | Set Up Proxy ..." && set_up_proxy
echo "MISP | Mark instance live"
sudo -u www-data /var/www/MISP/app/Console/cake Admin live 1
sudo -u www-data /var/www/MISP/app/Console/cake Admin live 1

View File

@ -21,7 +21,8 @@
"default_value": false
},
"MISP.ca_path": {
"default_value": "/etc/ssl/certs/ca-certificates.crt"
"default_value": "/etc/ssl/certs/ca-certificates.crt",
"command_args": "-f"
},
"MISP.menu_custom_right_link": {
"default_value": ""

View File

@ -1,4 +1,8 @@
{
"debug": {
"default_value": "${DEBUG}",
"command_args": "-f"
},
"MISP.baseurl": {
"default_value": "${BASE_URL}"
},

View File

@ -0,0 +1,17 @@
{
"Proxy.host": {
"default_value": "${PROXY_HOST}"
},
"Proxy.port": {
"default_value": "${PROXY_PORT}"
},
"Proxy.method": {
"default_value": "${PROXY_METHOD}"
},
"Proxy.user": {
"default_value": "${PROXY_USER}"
},
"Proxy.password": {
"default_value": "${PROXY_PASSWORD}"
}
}

View File

@ -131,6 +131,7 @@ services:
- "AAD_MISP_SITEADMIN=${AAD_MISP_SITEADMIN}"
- "AAD_CHECK_GROUPS=${AAD_CHECK_GROUPS}"
# Proxy settings
- "PROXY_ENABLE=${PROXY_ENABLE}"
- "PROXY_HOST=${PROXY_HOST}"
- "PROXY_PORT=${PROXY_PORT}"
- "PROXY_METHOD=${PROXY_METHOD}"
@ -153,6 +154,8 @@ services:
- "MYSQL_USER=${MYSQL_USER:-misp}"
- "MYSQL_PASSWORD=${MYSQL_PASSWORD:-example}"
- "MYSQL_DATABASE=${MYSQL_DATABASE:-misp}"
# Debug setting
- "DEBUG=${DEBUG}"
misp-modules:
image: ghcr.io/misp/misp-docker/misp-modules:latest

View File

@ -142,3 +142,10 @@ SYNCSERVERS_1_KEY=
# PROXY_METHOD=
# PROXY_USER=
# PROXY_PASSWORD=
# Enable debugging
# ALWAYS SET THIS TO 0 IN PRODUCTION
# 0 - Debug off (default)
# 1 - Debug on
# 2 - Debug on + SQL dump
# DEBUG=