"I am attempting to implement custom Postfix restrictions (restricting specific internal users to specific external domains for sending/receiving). I have exhausted all standard and advanced troubleshooting steps, and the issue appears to be with the postfix-mailcow container’s inability to apply POSTFIX_MASTER_SETTINGS_PARTX variables.
My Setup:
Mailcow (version, if known)
Host OS (e.g., Ubuntu 20.04)
Docker/Docker Compose version (e.g., docker –version, docker compose version)
My Configuration Steps (Leading to the Problem):
Created data/conf/postfix/restricted_users.map (e.g., user@az-neo.com restricted_outgoing_policy) and data/conf/postfix/allowed_domains.map. Ran postmap successfully.
Removed all other custom Postfix configuration attempts (extra.conf contents, master.cf modifications, old policy scripts).
Modified mailcow.conf to remove a single POSTFIX_MASTER_SETTINGS line and instead added:
POSTFIX_MASTER_SETTINGS_PART1=“…”
POSTFIX_MASTER_SETTINGS_PART2=“…”
POSTFIX_MASTER_SETTINGS_PART3=“…”
POSTFIX_MASTER_SETTINGS_PART4=“…”
(As per the values we constructed, paste those exact lines.)
Created data/conf/postfix/postfix-custom-env.env with these exact four POSTFIX_MASTER_SETTINGS_PARTX lines.
Modified docker-compose.override.yml to instruct postfix-mailcow service to load this env_file:
YAML
services:
postfix-mailcow:
env_file:
- ./data/conf/postfix/postfix-custom-env.env
Performed a full Mailcow restart: docker compose down –volumes –remove-orphans && docker compose up -d.
Observed Problem (Critical Diagnostics):
docker inspect mailcowdockerized-postfix-mailcow-1 | grep POSTFIX_MASTER_SETTINGS_PARTX (for all 4 parts):
Output: (Paste the exact output you got, showing the variables are passed).
This confirms Docker Compose is doing its job and passing the variables to the container’s environment.
docker compose exec postfix-mailcow bash -c “postconf -n”:
Output: (State that the output does NOT contain restricted_users_map, allowed_domains_map, restricted_outgoing_policy, restricted_incoming_policy, or the modified smtpd_recipient_restrictions.)
This confirms Postfix is NOT picking up these settings from the environment.
Conclusion:
The environment variables are correctly passed to the postfix-mailcow container, but Postfix’s active configuration (postconf -n) does not reflect them. This indicates a failure within the postfix-mailcow container’s internal startup script that is responsible for applying POSTFIX_MASTER_SETTINGS_PARTX variables to Postfix.
Could you please advise on how to diagnose or resolve this issue?
Thank you for your assistance."