mailcow-dockerized icon indicating copy to clipboard operation
mailcow-dockerized copied to clipboard

Fix generate_config.sh premature termination on IPv6 decline

Open Copilot opened this issue 4 months ago • 1 comments

Contribution Guidelines

What does this PR include?

Short Description

generate_config.sh terminates with exit 1 when user declines IPv6 Docker configuration, leaving an empty mailcow.conf. The script should continue with IPv6 disabled instead.

Root cause: docker_daemon_edit() calls exit 1 when user declines daemon.json modification, killing the entire installation process.

Changes:

  • Replace exit 1 with return 1 in docker_daemon_edit() (2 locations)
  • Add return value check in configure_ipv6() to handle decline gracefully
  • Set ENABLE_IPV6=false and continue installation when declined
  • Preserve informative messages showing users what Docker daemon settings they need if they change their mind later
# Before: Script dies here
echo "n" | ./generate_config.sh  # Creates empty mailcow.conf, exits

# After: Script continues with helpful messages
echo "n" | ./generate_config.sh  # Creates full mailcow.conf with ENABLE_IPV6=false
                                  # Shows Docker daemon settings for manual configuration

When users decline Docker daemon configuration, they now see:

  • Clear message that IPv6 will be disabled for mailcow
  • Docker version-specific settings they can manually add if they change their mind later
  • The ${MISSING[*]} array showing required daemon.json settings (when updating existing file)

Handles both generate_config.sh (exports IPV6_BOOL=false) and update.sh (modifies existing mailcow.conf) scenarios.

Affected Containers

None. Shell script changes only.

Did you run tests?

What did you tested?

  • User declining IPv6 configuration during fresh install
  • Resulting mailcow.conf completeness and correctness
  • Script continuation through certificate generation
  • Both generate_config.sh and update.sh code paths
  • Informative messages displayed when user declines Docker daemon configuration
  • Script continues without exit (returns instead)

What were the final results? (Awaited, got)

Awaited: Script completes successfully with ENABLE_IPV6=false in generated config, shows helpful manual configuration guidance.

Got:

  • Script completes successfully, generates valid 11KB+ mailcow.conf with 57 configuration entries
  • ENABLE_IPV6=false correctly set
  • Users see informative messages about manual Docker daemon configuration options
  • Installation proceeds without premature termination
Original prompt

This section details on the original issue you should resolve

<issue_title>installer ./generate_config.sh canceled after asking for docker ipv6</issue_title> <issue_description>### Contribution guidelines

Checklist prior issue creation

  • [x] I understand that failure to follow below instructions may cause this issue to be closed.
  • [x] I understand that vague, incomplete or inaccurate information may cause this issue to be closed.
  • [x] I understand that this form is intended solely for reporting software bugs and not for support-related inquiries.
  • [x] I understand that all responses are voluntary and community-driven, and do not constitute commercial support.
  • [x] I confirm that I have reviewed previous issues to ensure this matter has not already been addressed.
  • [x] I confirm that my environment meets all prerequisite requirements as specified in the official documentation.

Description

When running a fresh installation of mailcow-dockerized, the configuration generator (./generate_config.sh) cancels prematurely as soon as the IPv6 question is answered with “N”. After termination, the file mailcow.conf is created but completely empty.

This behaviour persists on a clean environment and makes it impossible to proceed with the installation unless the user manually edits or recreates the configuration.

Steps to reproduce:

Fresh Debian/Ubuntu server

Clone mailcow-dockerized repository

git clone https://github.com/mailcow/mailcow-dockerized cd mailcow-dockerized

Run the configuration generator:

./generate_config.sh

When prompted “Do you want to enable IPv6 for Docker? [Y/n]” → answer “N”

Script terminates immediately

Result: mailcow.conf exists but is completely empty

Logs:

currently no

Which branch are you using?

master (stable)

Which architecture are you using?

x86_64

Operating System:

Ubuntu Server 22.04

Server/VM specifications:

16,8

Is Apparmor, SELinux or similar active?

n

Virtualization technology:

KVM

Docker version:

29.1.1

docker-compose version or docker compose version:

Docker Compose version v2.40.3

mailcow version:

2025-10a

Reverse proxy:

no

Logs of git diff:


Logs of iptables -L -vn:

Chain INPUT (policy DROP 229 packets, 9508 bytes)
 pkts bytes target     prot opt in     out     source               destination
 2644  626K MAILCOW    all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* mailcow */
 2837  643K ufw-before-logging-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0
 2837  643K ufw-before-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  389 22468 ufw-after-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  389 22468 ufw-after-logging-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  389 22468 ufw-reject-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  389 22468 ufw-track-input  all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
 4007 6127K MAILCOW    all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* mailcow */
 4011 6130K DOCKER-USER  all  --  *      *       0.0.0.0/0            0.0.0.0/0
 4011 6130K DOCKER-FORWARD  all  --  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 ufw-before-logging-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 ufw-before-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 ufw-after-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 ufw-after-logging-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 ufw-reject-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 ufw-track-forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain OUTPUT (policy ACCEPT 4 packets, 160 bytes)
 pkts bytes target     prot opt in     out     source               destination
 3433 2919K ufw-before-logging-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0
 3433 2919K ufw-before-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  172 13648 ufw-after-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  172 13648 ufw-after-logging-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  172 13648 ufw-reject-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0
  172 13648 ufw-track-output  all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain DOCKER (2 references)
 pkts bytes target     prot opt in     out     source    ...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes mailcow/mailcow-dockerized#6932

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Copilot avatar Dec 10 '25 08:12 Copilot

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • asn-check.mailcow.email
    • Triggering command: /usr/bin/curl curl --connect-timeout 15 --max-time 30 -s -o /dev/null -w %{http_code} REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot avatar Dec 10 '25 08:12 Copilot