Skip to content

Use FQDN as REPORT_SENDER default value.#2487

Merged
casperklein merged 7 commits intodocker-mailserver:masterfrom
casperklein:report_sender
Mar 18, 2022
Merged

Use FQDN as REPORT_SENDER default value.#2487
casperklein merged 7 commits intodocker-mailserver:masterfrom
casperklein:report_sender

Conversation

@casperklein
Copy link
Copy Markdown
Member

@casperklein casperklein commented Mar 15, 2022

Description

With the merge of #2428, the default sender address was changed.

Let's take our example config:

hostname: mail
domainname: example.com

Before: Reports sender address was [email protected]
After: Reports sender address is [email protected]

This is wrong IMO.

The subject line of the reports are Logwatch for mail.example.com (Linux) and Postfix summary for mail.example.com. They correctly state the FQDN for which the reports are. The sender address should therefore also be mail.example.com.
mail.example.com is not necessary the same host as example.com, which is another reason for this change.

This PR uses the FQDN of the mailserver as default sender address.

Fixes #

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change that does improve existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@casperklein casperklein added this to the v11.0.0 milestone Mar 15, 2022
@casperklein casperklein requested a review from a team March 15, 2022 15:33
@casperklein casperklein self-assigned this Mar 15, 2022
Comment thread target/scripts/start-mailserver.sh Outdated
VARS[POSTMASTER_ADDRESS]="${POSTMASTER_ADDRESS:=postmaster@${DOMAINNAME}}"
VARS[REPORT_RECIPIENT]="${REPORT_RECIPIENT:=${POSTMASTER_ADDRESS}}"
VARS[REPORT_SENDER]="${REPORT_SENDER:=mailserver-report@${DOMAINNAME}}"
VARS[REPORT_SENDER]="${REPORT_SENDER:=mailserver-report@$(hostname -f)}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember this was HOSTNAME before. I think there also is a test you'll need to adjust.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, one test failed. I must have done something wrong yesterday, as my local tests passed successful 😕

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With my latest refactorings, _obtain_hostname_and_domainname runs beforehand. With this, we should be able to use DOMAINNAME or HOSTNAME instead of hostname -f, right?

Copy link
Copy Markdown
Member Author

@casperklein casperklein Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my last commit, locally the test now succeed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but here in start-mailserver.sh, we could also use the same env variable, right?

Copy link
Copy Markdown
Member Author

@casperklein casperklein Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-read your comment 😆 $HOSTNAME should also be fine.

PS; I find it very confusing, that we modify system variables. This is bad practice IMO. $HOSTNAME is set by docker.
If I bash into DMS and echo $HOSTNAME, just mail is returned, while in the start-mailserver.sh context $HOSTNAME is a FQDN:

root@mail:/# echo $HOSTNAME
mail
root@mail:/# source ./usr/local/bin/helpers/dns.sh
root@mail:/# _obtain_hostname_and_domainname
root@mail:/# echo $HOSTNAME
mail.example.com

Maybe in a future PR we should change that. Instead of modifying $HOSTNAME, we should use $DMS_HOSTNAME or something else to make the difference clear and avoid confusion.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this needs some reworking. I think @polarathene has this in his backlog somewhere :D

Copy link
Copy Markdown
Member

@polarathene polarathene Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS; I find it very confusing, that we modify system variables. This is bad practice IMO. $HOSTNAME is set by docker.

👍

I've already expressed this concern in the past, and there was talk to change to DMS_HOSTNAME / DMS_FQDN IIRC, but required tests to be adapted for running through some different configs for confidence in proceeding, as I believe dropping DOMAINNAME was also being considered.

@casperklein casperklein marked this pull request as draft March 15, 2022 17:45
@georglauterbach
Copy link
Copy Markdown
Member

GitHub has some problems ATM, therefore tests are failing.

@casperklein casperklein marked this pull request as ready for review March 15, 2022 18:39
@casperklein casperklein merged commit 1bfc6d9 into docker-mailserver:master Mar 18, 2022
@casperklein casperklein deleted the report_sender branch March 18, 2022 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants