docker-postfix icon indicating copy to clipboard operation
docker-postfix copied to clipboard

Fix: Prevent duplicate header entries in Postfix config

Open TWernthaler opened this issue 1 month ago • 3 comments

Fix: Prevents duplicate entries in Postfix configuration files

Background

Each time the container was restarted, configuration lines were written multiple times to /etc/postfix/header_checks.

Changes

  • Check for existing lines with grep -qxF
  • Only add if line does not exist
  • Structuring with variables for better maintainability

Test

  • Multiple container restarts → no duplicates
  • Functionality remains intact

Note

The method can be easily transferred to other configuration files.

TWernthaler avatar Nov 04 '25 14:11 TWernthaler

Hello Juan Luis Baptiste,

While using your project, I noticed that certain configuration lines are written multiple times to the Postfix files each time the system is restarted. This leads to duplicates and potential problems when sending emails.

I have adjusted the code accordingly so that the entries are only added if they do not already exist. The changes are documented in a pull request:

👉 https://github.com/juanluisbaptiste/docker-postfix/pull/129

If you have any feedback or would like to make any additions, I am happy to hear from you.

Thank you for your work on the project!

Best regards,
Thomas

TWernthaler avatar Nov 04 '25 14:11 TWernthaler

Hi @TWernthaler Thanks for your PR, I will review it and let you know.

juanluisbaptiste avatar Nov 11 '25 02:11 juanluisbaptiste

Your code is touching a lot more things than what this fix should do. Please redo it to only include the code meant for this PR.

juanluisbaptiste avatar Nov 11 '25 02:11 juanluisbaptiste