Closed tardich closed 9 months ago
What does your main.cf
say? Could this be related to #168?
relayhost isn't defined in main.cf
I tried a different approach. Instead of setting the RELAYHOST environment variable, I have set relayhost in the config.postfix section to see if that changes anything
But I'm seeing something in the logs that may interfere. After I see that my relayhost is being applied in the logs:
‣ INFO Applying custom postfix setting: relayhost=[smtphm.sympatico.ca]:587
I'm seeing that postfix is being updated:
‣ NOTE Executing any found custom scripts...
running bash /docker-init.db/pcre-add.sh
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8786 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [12.7 kB]
Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [143 kB]
Fetched 9197 kB in 3s (3498 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
12 packages can be upgraded. Run 'apt list --upgradable' to see them.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
postfix postfix-lmdb
Suggested packages:
procmail postfix-mysql postfix-pgsql postfix-ldap postfix-sqlite resolvconf
postfix-cdb mail-reader postfix-mta-sts-resolver ufw postfix-doc
The following NEW packages will be installed:
postfix-pcre
The following packages will be upgraded:
postfix postfix-lmdb
2 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 2183 kB of archives.
After this operation, 403 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 postfix-lmdb amd64 3.7.10-0+deb12u1 [337 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 postfix amd64 3.7.10-0+deb12u1 [1508 kB]
Get:3 http://deb.debian.org/debian bookworm/main amd64 postfix-pcre amd64 3.7.10-0+deb12u1 [338 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 2183 kB in 0s (4628 kB/s)
(Reading database ... 10928 files and directories currently installed.)
Preparing to unpack .../postfix-lmdb_3.7.10-0+deb12u1_amd64.deb ...
Removing lmdb map entry from /etc/postfix/dynamicmaps.cf
Unpacking postfix-lmdb (3.7.10-0+deb12u1) over (3.7.9-0+deb12u1) ...
Preparing to unpack .../postfix_3.7.10-0+deb12u1_amd64.deb ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
Postfix Configuration
---------------------
Please select the mail server configuration type that best meets your needs.
No configuration:
Should be chosen to leave the current configuration unchanged.
Internet site:
Mail is sent and received directly using SMTP.
Internet with smarthost:
Mail is received directly using SMTP or by running a utility such
as fetchmail. Outgoing mail is sent using a smarthost.
Satellite system:
All mail is sent to another machine, called a 'smarthost', for
delivery.
Local only:
The only delivered mail is the mail for local users. There is no
network.
1. No configuration 3. Internet with smarthost 5. Local only
2. Internet Site 4. Satellite system
General mail configuration type:
Use of uninitialized value $_[1] in join or string at /usr/share/perl5/Debconf/DbDriver/Stack.pm line 111.
The 'mail name' is the domain name used to 'qualify' _ALL_ mail addresses
without a domain name. This includes mail to and from <root>: please do not
make your machine send out mail from root@example.org unless root@example.org
has told you to.
This name will also be used by other programs. It should be the single, fully
qualified domain name (FQDN).
..... and there's more lines....
Maybe this is where the issue comes from ?
OK I now kinda understand what's happening.
I created a scrit that I added in docker-init.db directory. It basically installs postfix-pcre module. I think what's happening is that there's a newer version of postfix available (compared to when I added this script in the beginning) which basically updates postfix, updating the main.cf with default values that overrides my relayhost, which..... remove the relay capability and leaves me with postfix trying to reachout to the MX record of the domain I'm trying to send mail to, which doesn't work...
I need to either avoid the postfix update to override the main.cf file, or "augmenting" the default docker image from yours, which I don't like as this requires me to maintain an image myself.... task that I'm trying to avoid
Confirmed, this is related to the script addition that was basically adding postfix-pcre which started some time ago to update postfix, which updated the main.cf after the fact without proper configs.
To avoid the issue and not having to manage a docker image myself, I changed the script to make sure an upcoming postfix upgrade would not cause an issue by setting:
export DEBIAN_FRONTEND=noninteractive ( to avoid interactive questions on installs )
And then started my script by upgrading postfix with:
apt install -y --no-install-recommends postfix ( to avoid main.cf updated from apt install postfix)
THEN, I can add modules, such as:
apt install postfix-pcre
Hello.
I'm using a helm chart for the deployment:
repoURL: https://bokysan.github.io/docker-postfix/ chart: mail revision: v4.1.0
Among the environment variables used, I have set RELAYHOST as per the documentation to set the relay to use, which is set to [smtphm.sympatico.ca]:587
When the pod starts, I can see that the variable is seen and interpreted correctly, from some of the starting logs:
NOTE Forwarding all emails to [smtphm.sympatico.ca]:587 using username christian.tardif@bell.net and password (redacted).
But later in the logs, I see that it tries to send mails to the MX record of the target domain (and timing out but that's not the point. It should not even try it):
2024-02-25T16:29:46.087863-05:00 INFO postfix/relay/smtp[879]: connect to servinfo-ca.mail.protection.outlook.com[52.101.192.0]:25: Connection timed out
I don't see any outgoing emails trying to use the relay as expected.
The image I'm using is boky/postfix:v4.1.0 (coming from the helm chart)
Any parameter I've missed?