refactor: Internal HOSTNAME and DOMAINNAME configuration#2280
refactor: Internal HOSTNAME and DOMAINNAME configuration#2280polarathene merged 11 commits intodocker-mailserver:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Better logical flow, handling and inline documentation. Rather than using the bash regex stripping for `DOMAINNAME` or conditional checks opted for a condition that checks DNS labels and splits by `cut`.
Despite the verbosity, it's better to make this visible here for maintenance and debugging purposes than trying to dig through issue/PR or commit history for it.
001b02b to
5f3290b
Compare
Full summaryMostly useful as a reference for myself, but making it public here to associate it with the relevant PR, and the hopefully unlikely event that some poor maintainer in the future needs to wade through history about these changes/decisions 😅 This PR is an iteration improvement of a recent refactor of the same hostname/domainname handling logic (#2175). While there was plenty of discussion and iteration in the original version of this PR (#2245), anything relevant to this change is now covered in this PR thread, all other changes in the original have been extracted and reference it as well (thus available at the end of the thread prior to closing), but were catering to unrelated concerns. Anyone reading this comment should not need to wade through the original thread 🎉 Direct links to comments on it that are potentially worthwhile are linked below, in addition to the commit message history and inline comments of this PR for changes it applies. I don't consider the following as blocking for merge of this PR (no regressions are introduced AFAIK), but they are relevant context wise, referencing my comments from the original PR discussion thread/review. Including here for traceability for myself and future maintainers:
Future work:
When looking into these changes, this comment itself provides ample reference for insights in doing so. In addition, That resource can be revised with the next iteration and added to maintainer docs, which in combination with an improved test suite will help avoid this area becoming problematic in future contributions. Additional note about current behaviour, if you don't use a bare domain (two label FQDN), then we implicitly do remove the 1st (left-most) label from the derived FQDN and use the rest as |
Co-authored-by: Casper <[email protected]>
georglauterbach
left a comment
There was a problem hiding this comment.
LGTM, just this one comment :)
| # TODO: `OVERRIDE_HOSTNAME` was introduced for non-Docker runtimes that could not configure an explicit hostname. | ||
| # k8s was the particular runtime in 2017. This does not update `/etc/hosts` or other locations, thus risking | ||
| # inconsistency with expected behaviour. Investigate if it's safe to remove support. (--net=host also uses this as a workaround) | ||
| export HOSTNAME="${OVERRIDE_HOSTNAME:-$(hostname -f)}" |
There was a problem hiding this comment.
I would not like to see OVERRIDE_HOSTNAME being removed as is without introducing another variable, maybe for K8s, that does an equal job. I'd be very hesitant to remove this. Maybe adjust the comment, or remove it at all?
There was a problem hiding this comment.
Maybe adjust the comment, or remove it at all?
The comment stays. It makes it rather clear what the concern is and what needs to be done for it to be considered for removal:
- Introduced for non-Docker runtimes that could not configure an explicit hostname (k8s was the particular runtime in 2017).
--net=hostalso uses this as a workaround. - This does not update
/etc/hostsor other locations, thus risking inconsistency with expected behaviour. - Investigate if it's safe to remove support.
I'm likely one of the only ones who will investigate it, and that will be a while off as it requires big adjustments to the test suite that I'm slowly chipping away at.
If you can confirm that in almost 2022, this remains a requirement for k8s that is helpful :)
I would not like to see
OVERRIDE_HOSTNAMEbeing removed as is without introducing another variable
I know of one case with --network=host where it is currently required, but I don't consider the workaround satisfactory due to the lack of /etc/hosts parity.
What is likely to happen is the tests should show if the /etc/hosts addition matters at all, other than hostname -f or similar commands or if we can shift away from hostname/domainname config and have all scenarios unify on a common ENV instead.
If that makes sense to do, it can't be done confidently AFAIK without the test matrix run I want to be able to perform 😅
The only way OVERRIDE_HOSTNAME will get removed or replaced is via PR anyway, I see no harm in the comment, only additional clarification to future maintainers :)
There was a problem hiding this comment.
Alright, we keep the comment, this is fine with me :) Just wanted to make sure we're all on the same page about this variable. Although I just found out that it is not strictly required, I still wanted to mention it :)
As per review feedback
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Not relevant to this PR, open a discussion for personal support requests. Short answer is you can't do anything about that. The IP provider controls rDNS entries, you need a static IP that they agree to change rDNS entry for. Changing your hostname to the rDNS record makes no sense when you don't own that domain. You don't need the rDNS, if you're concerned about delivery reputation / success relay through a service like SendGrid. |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
You're not getting the point. It's not a Postfix issue; it's a DNS issue. Please use the discussions for this kind of question. |
This is still the kind of support questions that belong in Discussions, not our pull requests. The check you're referring to varies by MTA AFAIK, with Postfix it is likely It is not as strict of a requirement as you are seeking with rDNS exact match. I don't think that needs to be that strict, so you should be fine. |
Description
This has been extracted from #2245 to simplify review.
These changes are the main focus of the original PR where the bulk of the discussion and investigation was oriented around.
Originally reworked by @NorseGaud with heavy refactoring by me afterwards.
Commits have been scoped with context via commit messages for ease of reviewing.
Summary of changes:
$HOSTNAMEis misconfigured.SRS_DOMAINNAMEtest should use--domainnamenot ENVDOMAINNAME(reverted this fallback that was added from the PR that originally introduced_obtain_hostname_and_domainname)There was discussion to consider dropping config ENV
OVERRIDE_HOSTNAMEand the internalDOMAINNAMEin future, and rename ourHOSTNAMEvar toDMS_FQDN. Before that happens tests need to be overhauled to more easily perform matrix testing (different base configs where we can verify tests pass for various scenarios) to establish confidence in what may likely be a breaking change when introduced. As such that's delayed to a future PR.Type of change
Checklist: