[Compose] Allow to disable IPv6

master
andre.peters 2018-02-01 21:45:49 +01:00
parent 631214d601
commit 6be0577638
3 changed files with 45 additions and 0 deletions

View File

@ -10,6 +10,8 @@ services:
volumes: volumes:
- ./data/conf/unbound/unbound.conf:/etc/unbound/unbound.conf:ro - ./data/conf/unbound/unbound.conf:/etc/unbound/unbound.conf:ro
restart: always restart: always
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
networks: networks:
mailcow-network: mailcow-network:
ipv4_address: ${IPV4_NETWORK}.254 ipv4_address: ${IPV4_NETWORK}.254
@ -30,6 +32,8 @@ services:
restart: always restart: always
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
networks: networks:
mailcow-network: mailcow-network:
aliases: aliases:
@ -44,6 +48,8 @@ services:
- TZ=${TZ} - TZ=${TZ}
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
networks: networks:
mailcow-network: mailcow-network:
ipv4_address: ${IPV4_NETWORK}.249 ipv4_address: ${IPV4_NETWORK}.249
@ -61,6 +67,8 @@ services:
- ./data/conf/clamav/:/etc/clamav/ - ./data/conf/clamav/:/etc/clamav/
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
networks: networks:
mailcow-network: mailcow-network:
aliases: aliases:
@ -82,6 +90,8 @@ services:
- dkim-vol-1:/data/dkim - dkim-vol-1:/data/dkim
- rspamd-vol-1:/var/lib/rspamd - rspamd-vol-1:/var/lib/rspamd
restart: always restart: always
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
hostname: rspamd hostname: rspamd
@ -121,6 +131,8 @@ services:
- SMTPS_PORT=${SMTPS_PORT:-465} - SMTPS_PORT=${SMTPS_PORT:-465}
- SMTP_PORT=${SMTP_PORT:-25} - SMTP_PORT=${SMTP_PORT:-25}
restart: always restart: always
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
networks: networks:
@ -141,6 +153,8 @@ services:
volumes: volumes:
- ./data/conf/sogo/:/etc/sogo/ - ./data/conf/sogo/:/etc/sogo/
restart: always restart: always
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
networks: networks:
@ -180,6 +194,8 @@ services:
hard: 40000 hard: 40000
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
hostname: ${MAILCOW_HOSTNAME} hostname: ${MAILCOW_HOSTNAME}
networks: networks:
mailcow-network: mailcow-network:
@ -209,6 +225,8 @@ services:
restart: always restart: always
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
hostname: ${MAILCOW_HOSTNAME} hostname: ${MAILCOW_HOSTNAME}
networks: networks:
mailcow-network: mailcow-network:
@ -218,6 +236,8 @@ services:
memcached-mailcow: memcached-mailcow:
image: memcached:alpine image: memcached:alpine
restart: always restart: always
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
networks: networks:
@ -253,6 +273,8 @@ services:
- "${HTTPS_BIND:-0.0.0.0}:${HTTPS_PORT:-443}:${HTTPS_PORT:-443}" - "${HTTPS_BIND:-0.0.0.0}:${HTTPS_PORT:-443}:${HTTPS_PORT:-443}"
- "${HTTP_BIND:-0.0.0.0}:${HTTP_PORT:-80}:${HTTP_PORT:-80}" - "${HTTP_BIND:-0.0.0.0}:${HTTP_PORT:-80}:${HTTP_PORT:-80}"
restart: always restart: always
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
networks: networks:
@ -266,6 +288,8 @@ services:
- mysql-mailcow - mysql-mailcow
image: mailcow/acme:1.28 image: mailcow/acme:1.28
build: ./data/Dockerfiles/acme build: ./data/Dockerfiles/acme
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
environment: environment:
@ -304,6 +328,8 @@ services:
- IPV4_NETWORK=${IPV4_NETWORK} - IPV4_NETWORK=${IPV4_NETWORK}
- SNAT_TO_SOURCE=${SNAT_TO_SOURCE:-n} - SNAT_TO_SOURCE=${SNAT_TO_SOURCE:-n}
network_mode: "host" network_mode: "host"
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
dns: dns:
- ${IPV4_NETWORK}.254 - ${IPV4_NETWORK}.254
volumes: volumes:
@ -314,6 +340,8 @@ services:
# Debug # Debug
#command: /watchdog.sh #command: /watchdog.sh
build: ./data/Dockerfiles/watchdog build: ./data/Dockerfiles/watchdog
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
volumes: volumes:
- vmail-vol-1:/vmail:ro - vmail-vol-1:/vmail:ro
restart: always restart: always
@ -335,6 +363,8 @@ services:
image: mailcow/dockerapi:1.7 image: mailcow/dockerapi:1.7
restart: always restart: always
build: ./data/Dockerfiles/dockerapi build: ./data/Dockerfiles/dockerapi
sysctls:
- net.ipv6.conf.all.disable_ipv6=${SYSCTL_IPV6_DISABLED:-0}
oom_score_adj: -10 oom_score_adj: -10
environment: environment:
- TZ=${TZ} - TZ=${TZ}

View File

@ -108,6 +108,11 @@ IPV4_NETWORK=172.22.1
# Internal IPv6 subnet in fc00::/7 # Internal IPv6 subnet in fc00::/7
IPV6_NETWORK=fd4d:6169:6c63:6f77::/64 IPV6_NETWORK=fd4d:6169:6c63:6f77::/64
# Disable IPv6
# mailcow-network will still be created as IPv6 enabled, all containers will be created
# without IPv6 support.
# Use 1 for disabled, 0 for enabled
SYSCTL_IPV6_DISABLED=0
EOF EOF

View File

@ -46,6 +46,7 @@ CONFIG_ARRAY=(
"IPV6_NETWORK" "IPV6_NETWORK"
"LOG_LINES" "LOG_LINES"
"SNAT_TO_SOURCE" "SNAT_TO_SOURCE"
"SYSCTL_IPV6_DISABLED"
) )
sed -i '$a\' mailcow.conf sed -i '$a\' mailcow.conf
@ -55,6 +56,15 @@ for option in ${CONFIG_ARRAY[@]}; do
echo "Adding new option \"${option}\" to mailcow.conf" echo "Adding new option \"${option}\" to mailcow.conf"
echo "${option}=" >> mailcow.conf echo "${option}=" >> mailcow.conf
fi fi
if [[ ${option} == "SYSCTL_IPV6_DISABLED" ]]; then
if ! grep -q ${option} mailcow.conf; then
echo "Adding new option \"${option}\" to mailcow.conf"
echo "# Disable IPv6" >> mailcow.conf
echo "# mailcow-network will still be created as IPv6 enabled, all containers will be created" >> mailcow.conf
echo "# without IPv6 support." >> mailcow.conf
echo "# Use 1 for disabled, 0 for enabled" >> mailcow.conf
echo "SYSCTL_IPV6_DISABLED=0" >> mailcow.conf
fi
elif [[ ${option} == "COMPOSE_PROJECT_NAME" ]]; then elif [[ ${option} == "COMPOSE_PROJECT_NAME" ]]; then
if ! grep -q ${option} mailcow.conf; then if ! grep -q ${option} mailcow.conf; then
echo "Adding new option \"${option}\" to mailcow.conf" echo "Adding new option \"${option}\" to mailcow.conf"