letsencryptアップデート後のメール受信者ログエラー

Continuing the discussion from Self-hosted mail-receiver update following Let's Encrypt root certificate change:

After updating mail-receiver to latest ./launcher logs mail-receiver errors out after

postfix/postfix-script: warning: symlink leaves directory: /etc/postfix/./makedefs.out
<20>Oct  1 06:10:33 postfix/postfix-script[86]: warning: symlink leaves directory: /etc/postfix/./makedefs.outStarting Postfix

and doesn’t show any other events (incoming emails, rejected emails, …).

I’ve encountered some issues with custom postfix settings (which worked flawlessly prior to recent update) and need to debug, which is difficult without logs.

have you tried these steps

「いいね!」 1

I do see the same errors warnings but Postfix is happily running and accepting mails after that.

Sometimes the logs don’t seem to flush immediately so you might need to wait for a while before you get some output. But that’s unrelated to the warnings.

So is it actually crashing for you?

Ditto, with vanilla settings. But I had to temporarily disable additional postfix rule

  POSTCONF_smtpd_client_restrictions: 'regexp:/etc/postfix/shared/client_access_regex'

which worked perfectly before the upgrade (uses regex rules to reject spammers). The real issue is that with this setting enabled, postfix starts rejecting all incoming email, but I can’t see why from the logs!

A while maybe, but it’s been hours and still nothing in logs (neither accepted nor rejected emails are shown, and there is inbound traffic).

You were right, there are other log entries in the output, but the output itself is garbled:

./launcher logs mail-receiver output begins with a <HEAD>:

/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Operating environment:
HOSTNAME=discourse-mail-receiver
LANGUAGE=en_US.UTF-8
MAIL_DOMAIN=...
...
...
Setting smtpd_tls_security_level to 'may'
postfix/postfix-script: warning: symlink leaves directory: /etc/postfix/./makedefs.out

followed by a single line of log entries, and ending with the <HEAD> repeated six more times:

<HEAD>
Single line of log entries without line breaks..............................................................................................................................................................................................
<HEAD>
<HEAD>
<HEAD>
<HEAD>
<HEAD>
<HEAD>

I was only looking at the end of the output, and there was always seemingly just the <HEAD> without any other entries.

Definitely something wrong with the rendering of the log via ./launcher logs mail-receiver.

I believe I figured this one out, there is a maillog_file line missing in the Dockerfile. Temp fix: added

  POSTCONF_maillog_file: '/dev/stdout'

to mail-receiver.yml and rebuilt, but this should probably be fixed in the docker image

RUN >/etc/postfix/main.cf \
+	&& postconf -e maillog_file=/dev/stdout \
	&& postconf -e smtputf8_enable=no \
...

So after adding this, the error is gone, and the logs are working? If so, would you mind submitting a PR to make that change?

「いいね!」 1

https://github.com/discourse/mail-receiver/pull/12

@md-miskoさん、ありがとうございます。PRをマージし、Dockerhubのdiscourse/mail-reciever:releaseタグを更新しました。

ご存知かと思いますが、もし他にこのトピックを見つけた方がいらっしゃいましたら、以下のコマンドを実行してメール受信機のバージョンを更新できます。

docker pull discourse/mail-receiver:release
cd /var/discourse
./launcher rebuild mail-receiver
「いいね!」 3

現在実行中のイメージが最新バージョンを実行していることをテストする方法について、何かアイデアはありますか?

少し複雑ですが、これで機能するはずです。

# まず、最新のベースイメージがローカルにあることを確認します
docker pull discourse/mail-receiver:release

# ベースイメージのトップレイヤーを取得します
BASE_IMAGE_HASH=$(docker history discourse/mail-receiver:release -q | head -n 1)

# **実行中**バージョンのレイヤーを取得します
RUNNING_IMAGE_HASH=$(docker container inspect mail-receiver -f "{{.Image}}")
RUNNING_IMAGE_LAYERS=$(docker history $RUNNING_IMAGE_HASH -q)

# 実行中のイメージレイヤーに現在のベースイメージが含まれているか確認します:
[[ "$RUNNING_IMAGE_LAYERS" == *"$BASE_IMAGE_HASH"* ]] && echo "Up to date"

これにより、最新の状態であれば「Up to date」と表示されます。それ以外の場合は、最後の行は何も表示せず、ゼロ以外のステータスで終了します。

「いいね!」 2

おお。それは素晴らしいですね。以前は一点限りの解決策しか見つけられなかった一般的な解決策のようです。それを理解するにはしばらく時間がかかったでしょう。私が探すべきだと知らなかったのは RUNNING_IMAGE_LAYERS です。

アップグレードされたインスタンスとそうでないインスタンスでテストしましたが、期待どおりに動作するようです。

本当にありがとうございます!

「いいね!」 3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.