File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed
Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -467,6 +467,14 @@ update_ca_certificates() {
467467 fi
468468}
469469
470+ configure_misp_guard_ca () {
471+ if [[ " $COMPOSE_PROFILES " = " misp-guard" ]]; then
472+ echo " ... configuring misp-guard CA certificate"
473+ chown www-data:www-data /usr/local/share/ca-certificates/misp_guard/mitmproxy-ca.pem
474+ sudo -u www-data /var/www/MISP/app/Console/cake Admin setSetting -q " MISP.ca_path" " /usr/local/share/ca-certificates/misp_guard/mitmproxy-ca.pem"
475+ fi
476+ }
477+
470478create_sync_servers () {
471479 if [ -z " $ADMIN_KEY " ]; then
472480 echo " ... admin key auto configuration is required to configure sync servers"
@@ -632,5 +640,7 @@ echo "MISP | Set Up Proxy ..." && set_up_proxy
632640
633641echo " MISP | Create default Scheduled Tasks ..." && create_default_scheduled_tasks
634642
643+ echo " MISP | Configure misp-guard CA certificate ..." && configure_misp_guard_ca
644+
635645echo " MISP | Mark instance live" && print_version
636646sudo -u www-data /var/www/MISP/app/Console/cake Admin live 1
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ services:
126126 - " ./files/:/var/www/MISP/app/files/:Z"
127127 - " ./ssl/:/etc/nginx/certs/:Z"
128128 - " ./gnupg/:/var/www/MISP/.gnupg/:Z"
129+ - " misp_guard_ca:/usr/local/share/ca-certificates/misp_guard:Z"
129130 # customize by replacing ${CUSTOM_PATH} with a path containing 'files/customize_misp.sh'
130131 # - "${CUSTOM_PATH}/:/custom/:Z"
131132 # mount custom ca root certificates
@@ -305,6 +306,8 @@ services:
305306 - " HSTS_MAX_AGE=${HSTS_MAX_AGE}"
306307 - " X_FRAME_OPTIONS=${X_FRAME_OPTIONS}"
307308 - " CONTENT_SECURITY_POLICY=${CONTENT_SECURITY_POLICY}"
309+ # compose profiles
310+ - " COMPOSE_PROFILES=${COMPOSE_PROFILES}"
308311
309312 misp-modules :
310313 image : ghcr.io/misp/misp-docker/misp-modules:${MODULES_RUNNING_TAG:-latest}
@@ -348,6 +351,7 @@ services:
348351 - " GUARD_ARGS=${GUARD_ARGS}"
349352 volumes :
350353 - ./guard/config.json:/config.json:ro
354+ - misp_guard_ca:/misp_guard_ca
351355 healthcheck :
352356 test : " /bin/bash -c '</dev/tcp/localhost/${GUARD_PORT:-8888}'"
353357 interval : 2m
@@ -358,3 +362,4 @@ services:
358362volumes :
359363 mysql_data :
360364 cache_data :
365+ misp_guard_ca :
Original file line number Diff line number Diff line change @@ -24,4 +24,21 @@ jq --arg ip "$MISP_IP" \
2424 ' .instances.misp_container.ip = $ip' \
2525 /config.json > /srv/misp-guard/src/config.json
2626
27- exec mitmdump -s mispguard.py -p ${GUARD_PORT:- 8888} ${GUARD_ARGS: +$GUARD_ARGS } --set config=config.json
27+ # start mitmdump in background
28+ mitmdump \
29+ -s mispguard.py \
30+ -p " ${GUARD_PORT:- 8888} " \
31+ ${GUARD_ARGS: +$GUARD_ARGS } \
32+ --set config=config.json &
33+
34+ MITM_PID=$!
35+
36+ # wait for mitmproxy CA to exist
37+ while [ ! -f /root/.mitmproxy/mitmproxy-ca.pem ]; do
38+ sleep 1
39+ done
40+
41+ # copy mitmproxy CA to shared volume for misp-core to use
42+ cp /root/.mitmproxy/mitmproxy-ca.pem /misp_guard_ca/mitmproxy-ca.pem
43+
44+ wait " $MITM_PID "
You can’t perform that action at this time.
0 commit comments