chore: Remove the wrapper script for Postfix (and disable chroot in master.cf)#3033
Conversation
Postfix can run in foreground mode now, so long as it is not within a `chroot` jail, which is not necessary for a Docker container.
|
I still need to look into if logging changes need to be handled as well, so this PR is not entirely complete. Would be good to review / discuss the current proposed change though 👍 |
|
Looks very good to me! If you need help investigating the test failure; let me know. I think the changes proposed here make sense and we should go ahead with them. |
The current failure in CI I think I can resolve, but it's odd that it can timeout after 60 seconds, but sometimes does pass (at least locally). Another random failure was with an rspamd test: I'm not sure if that's related to this PR change, it looks like a potential race condition as there seems to be two emails in those logs. The message ID between the mail stored in Dovecot Inbox and the one with the detected virus differ. It would seem that filtering on the message ID would be more reliable? |
This comment was marked as resolved.
This comment was marked as resolved.
b5bf8b0 to
3921c62
Compare
|
The CI failure with Amavis tests has been fixed and extracted out to a separate PR. When that's merged, and this PR updated to it, tests should pass 👍 |
|
I will provide a fix for the Rspamd test. UPDATE: I will put that fix into #3026. UPDATE2: @polarathene you mentioned filtering by ID, which lead me to integrating a solution that goes beyond just Rspamd adjustments. I hope this is fine as the adjustments for Rspamd are minimal. |
This was not planned, but as @polarthene mentioned in #3033 (comment) , filtering the mail log by email ID would be (the only) correct approach for the Rspamd test (to eliminate race conditions). I asserted the currect state, and came to the conclusion that this might (or actually is) something we want in more than one place. So I went ahead and implemented a solution. The solution for acquiring the ID is a bit slower because it ensures the mail queue is empty _before_ and _after_ the mail is sent. This is the tradeoff one has to make if they want to send multiple emails in one test file and get their IDs. I hope you like this approach. I will provide another PR that adjusts our current tests to use these new functions.
This was not planned, but as @polarthene mentioned in #3033 (comment) , filtering the mail log by email ID would be (the only) correct approach for the Rspamd test (to eliminate race conditions). I asserted the currect state, and came to the conclusion that this might (or actually is) something we want in more than one place. So I went ahead and implemented a solution. The solution for acquiring the ID is a bit slower because it ensures the mail queue is empty _before_ and _after_ the mail is sent. This is the tradeoff one has to make if they want to send multiple emails in one test file and get their IDs. I hope you like this approach. I will provide another PR that adjusts our current tests to use these new functions.
* add functionality for filtering mail log by ID This was not planned, but as @polarthene mentioned in #3033 (comment) , filtering the mail log by email ID would be (the only) correct approach for the Rspamd test (to eliminate race conditions). I asserted the currect state, and came to the conclusion that this might (or actually is) something we want in more than one place. So I went ahead and implemented a solution. The solution for acquiring the ID is a bit slower because it ensures the mail queue is empty _before_ and _after_ the mail is sent. This is the tradeoff one has to make if they want to send multiple emails in one test file and get their IDs. I hope you like this approach. I will provide another PR that adjusts our current tests to use these new functions. * added note about our helper functions in the docs I think our work for our custom test framework should be noted in the docs for newcomers to better understand what they should do. * adjust Rspamd test to use new helpers for sending * improve filter helpers further * add sanity check when acquiring mail ID * re-add `refute_output` to test which should now work well
|
For reference, the It should be safe to remove the |
Description
sleepusage.supervisordseems to be possible now, provided we drop the chroot jail config inmaster.cf.changedetectorservice in the next release switches topostfix reloadinstead of having the process killed to restart it fully.This change seems to be fine from what I can assess :)
Mailu
master.cfand mailcowmaster.cfboth are configured to not use chroot.DMS history for current config
master.cfconfig for Postfix in this image has been using the chroot N default since April 2015 from an Ubuntu base image. In May 2017, this was changed to chroot Y for most services, but an explicitnfor Amavis which seems to be what motivated the change.supervisord.A discussion between maintainers in June 2022 referenced the following:
Additional info regarding
chrootand Postfix / Dockermaster.cfto disabled a while back (changed introduced upstream in 2014, link provides some hints as to why).postfix-nochrootpackage intended for Debian systems. The package author has a detailed blogpost from 2008 that details why they ran Postfix without a chroot, stating that it reduced security in an SE Linux environment.postfix start-fgisn't compatible with running a chroot jail (or doesn't configure one by default on Debian, as appears to happen withpostfix start?). This can lead to errors like mapping services to ports, and resolving DNS queries.main.cf'chroot' mentions to likewise be mindful of.chrootis not a security measure describes how daemons have usedchrootin the past but exploits that can break out of it.Differences between
master.cffiles upstreamCurrent master branch of Postfix
master.cfis the same as what current Alpine ships with Postfix 3.7.4, with the exception of thelocal_header_rewrite_clients=static:alllines.Debian Bullseye differs in restrictions options for Port 587 + 465 services (submission(s)) and stripping comments, in addition to explicitly configuring
yfor the chroot column (and setting up chroot jail somewhere for Postfix).Debian Bullseye default Postfix master.cf
Our own
master.cfdiffers a bit more and probably could do with a sync/revisit in future.Type of change
Technically a breaking change. Although I don't expect this to cause any notable breakage, unless someone is using a custom / modified
master.cf.Checklist: