scripts: improve custom user-supplied Postfix configuration (#2598)

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
This commit is contained in:
Georg Lauterbach 2022-06-06 09:30:10 +02:00 committed by GitHub
parent 1f3e672018
commit 0010786d18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 34 deletions

View file

@ -2,33 +2,34 @@
title: 'Override the Default Configs | Postfix'
---
The Postfix default configuration can easily be extended by providing a `docker-data/dms/config/postfix-main.cf` in postfix format.
This can also be used to add configuration that is not in our default configuration.
[Our default Postfix configuration](https://github.com/docker-mailserver/docker-mailserver/blob/master/target/postfix/main.cf) can easily be extended to add parameters or modify existing ones by providing a `docker-data/dms/config/postfix-main.cf`. This file uses the same format as Postfix `main.cf` does ([See official docs](http://www.postfix.org/postconf.5.html) for all parameters and syntax rules).
For example, one common use of this file is for increasing the default maximum message size:
```cf
# increase maximum message size
message_size_limit = 52428800
```
That specific example is now supported and can be handled by setting `POSTFIX_MESSAGE_SIZE_LIMIT`.
!!! note
[Postfix documentation](http://www.postfix.org/documentation.html) remains the best place to find configuration options.
Each line in the provided file will be loaded into postfix.
In the same way it is possible to add a custom `docker-data/dms/config/postfix-master.cf` file that will override the standard `master.cf`. Each line in the file will be passed to `postconf -P`. The expected format is `<service_name>/<type>/<parameter>`, for example:
!!! example "Example"
One can easily increase the [backwards-compatibility level](http://www.postfix.org/postconf.5.html#compatibility_level) and set new Postscreen options:
```cf
# increase the compatibility level from 2 (default) to 3
compatibility_level = 3
# set a threshold value for Spam detection
postscreen_dnsbl_threshold = 4
```
!!! help "How are your changes applied?"
The custom configuration you supply is appended to the default configuration located at `/etc/postfix/main.cf`, and then `postconf -nf` is run to remove earlier duplicate entries that have since been replaced. This happens early during container startup before Postfix is started.
---
Similarly, it is possible to add a custom `docker-data/dms/config/postfix-master.cf` file that will override the standard `master.cf`. **Note**: Each line in this file will be passed to `postconf -P`, i.e. **the file is not appended as a whole** to `/etc/postfix/master.cf` like `docker-data/dms/config/postfix-main.cf`! The expected format is `<service_name>/<type>/<parameter>`, for example:
```cf
# adjust the submission "reject_unlisted_recipient" option
submission/inet/smtpd_reject_unlisted_recipient=no
```
Run `postconf -P` in the container without arguments to see the active master options.
!!! note
!!! attention
There should be no space between the parameter and the value.
Have a look at the code for more information.
Run `postconf -Mf` in the container without arguments to see the active master options.