Add option to disable IPv6 completely (#29)

pull/1/head
Stefano Ortolani 2023-09-25 21:40:13 +01:00 committed by GitHub
parent 969c131c84
commit 8ef11e85a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -62,6 +62,7 @@ services:
environment: environment:
- "HOSTNAME=${HOSTNAME}" - "HOSTNAME=${HOSTNAME}"
- "CRON_USER_ID=${CRON_USER_ID}" - "CRON_USER_ID=${CRON_USER_ID}"
- "DISABLE_IPV6=${DISABLE_IPV6}"
# standard settings # standard settings
- "ADMIN_EMAIL=${ADMIN_EMAIL}" - "ADMIN_EMAIL=${ADMIN_EMAIL}"
- "ADMIN_PASSWORD=${ADMIN_PASSWORD}" - "ADMIN_PASSWORD=${ADMIN_PASSWORD}"

View File

@ -16,6 +16,7 @@ trap term_proc SIGTERM
[ -z "$MYSQLCMD" ] && export MYSQLCMD="mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -P $MYSQL_PORT -h $MYSQL_HOST -r -N $MYSQL_DATABASE" [ -z "$MYSQLCMD" ] && export MYSQLCMD="mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -P $MYSQL_PORT -h $MYSQL_HOST -r -N $MYSQL_DATABASE"
[ -z "$CRON_USER_ID" ] && export CRON_USER_ID="1" [ -z "$CRON_USER_ID" ] && export CRON_USER_ID="1"
[ -z "$HOSTNAME" ] && export HOSTNAME="https://localhost" [ -z "$HOSTNAME" ] && export HOSTNAME="https://localhost"
[ -z "$DISABLE_IPV6" ] && export DISABLE_IPV6=false
init_mysql(){ init_mysql(){
# Test when MySQL is ready.... # Test when MySQL is ready....
@ -188,6 +189,9 @@ init_nginx() {
# Testing for files also test for links, and generalize better to mounted files # Testing for files also test for links, and generalize better to mounted files
if [[ ! -f "/etc/nginx/sites-enabled/misp80" ]]; then if [[ ! -f "/etc/nginx/sites-enabled/misp80" ]]; then
echo "... enabling port 80 redirect" echo "... enabling port 80 redirect"
if [[ "$DISABLE_IPV6" = "true" ]]; then
sed -i "/\[::\]/d" /etc/nginx/sites-available/misp80
fi
ln -s /etc/nginx/sites-available/misp80 /etc/nginx/sites-enabled/misp80 ln -s /etc/nginx/sites-available/misp80 /etc/nginx/sites-enabled/misp80
else else
echo "... port 80 already configured" echo "... port 80 already configured"
@ -196,6 +200,9 @@ init_nginx() {
# Testing for files also test for links, and generalize better to mounted files # Testing for files also test for links, and generalize better to mounted files
if [[ ! -f "/etc/nginx/sites-enabled/misp" ]]; then if [[ ! -f "/etc/nginx/sites-enabled/misp" ]]; then
echo "... enabling port 443" echo "... enabling port 443"
if [[ "$DISABLE_IPV6" = "true" ]]; then
sed -i "/\[::\]/d" /etc/nginx/sites-available/misp
fi
ln -s /etc/nginx/sites-available/misp /etc/nginx/sites-enabled/misp ln -s /etc/nginx/sites-available/misp /etc/nginx/sites-enabled/misp
else else
echo "... port 443 already configured" echo "... port 443 already configured"

View File

@ -67,3 +67,6 @@ SYNCSERVERS_1_KEY=
# Enable admin (user #1) API key autogeneration # Enable admin (user #1) API key autogeneration
# if ADMIN_KEY is not set above (default true) # if ADMIN_KEY is not set above (default true)
# AUTOGEN_ADMIN_KEY=true # AUTOGEN_ADMIN_KEY=true
# Disable IPv6 completely (this setting will persist until the container is removed)
# DISABLE_IPV6=true