Email notifications not sent if TLS is enabled ("may") in Postfix?

Added by Peter Kukla 6 months ago

I have migrated a Redmine server from CentOS (Redmine 3.4.6.stable) to Ubuntu (Redmine 4.0.6.stable). The new server runs both Redmine and Postfix.

Notification emails are no longer sent from Redmine in the new environment. If I send a test email, the following error is displayed:

An error occurred while sending mail (hostname "localhost" does not match the server certificate)

The emails are sent correctly if I change the postfix main.cf configuration from:

smtpd_tls_security_level=may

to:

smtpd_tls_security_level=

...but I would prefer not to disable TLS in Postfix if I could disable it in Redmine, instead.

I have tried various combinations of settings in the config/configuration.yml's "email_delivery" section, focusing on the "openssl_verify_mode" and "enable_starttls_auto" settings without success.

The following is dumped to the /var/log/mail.log file when an email fails to send:

    Jan  6 21:19:57 criterion postfix/smtpd[99206]: connect from localhost[127.0.0.1]
    Jan  6 21:19:57 criterion postfix/smtpd[99206]: lost connection after STARTTLS from localhost[127.0.0.1]
    Jan  6 21:19:57 criterion postfix/smtpd[99206]: disconnect from localhost[127.0.0.1] ehlo=1 starttls=1 commands=2

Here are more details about the environment:

email_delivery:
delivery_method: :smtp
smtp_settings:
address: some.server.com
enable_starttls_auto: false
port: 25
Environment:
  Redmine version                4.0.6.stable
  Ruby version                   2.7.0-p0 (2019-12-25) [x86_64-linux-gnu]
  Rails version                  5.2.3
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            2.25.1
  Filesystem
Redmine plugins:
  redmine_agile                  1.6.2
  redmine_checklists             3.1.20
  redmine_image_clipboard_paste  3.3.0

Apache 2.4.41-4ubuntu3.8
MySQL 8.0
Ubuntu 20.04.3 LTS \n \l (a VM running under KVM)
Postfix 3.4.13-0ubuntu1.2

Any thoughts on how I can configure Redmine to get notifications working in this environment, or debug it further to determine the underlying cause of the problem?