質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Postfix

Postfixは、電子メールサーバソフトウェアで、 メールを配送するシステムMTAの一種です。

Q&A

解決済

2回答

5079閲覧

luser_relay にてメール転送する際の問題

kodiack

総合スコア13

Postfix

Postfixは、電子メールサーバソフトウェアで、 メールを配送するシステムMTAの一種です。

0グッド

0クリップ

投稿2019/04/02 16:30

編集2019/04/03 16:34

前提・実現したいこと

/etc/postfix/main.cf上でluser_relayを設定していますが、
うまく転送がおこなわれません。この問題を解決して転送がされるようにしたい。

ここに質問の内容を詳しく書いてください:

現在Postfixにて1つのドメイン(@example.jp)を利用し以下の3つのメールアドレスを
用いて運用しているとします。現在以下の3つのメールアドレスでは正常に通常のメールは送受信出来ております。

abc@example.jp
123@example.jp
user1@example.jp

今回Postfix上に登録のないメールアドレス宛(たとえば test@example.com)にメールが
送信された際、これらのメールをすべてuser1@example.jpに転送したいと考えております。

これを実現するために、/etc/postfix/main.cf上で以下の項目を設定しました。

# unknown_local_recipient_reject_code = 550 luser_relay = user1@example.jp local_recipient_maps =

設定後、postfixやsaslの再起動、サーバの再起動を行ってみましたが、
test@example.jp宛てにメールを送ると以下の宛先不明のメッセージが返ってきてしまい、
設定されているuser1@example.jpにはメールが転送されません。

Address not found
Your message wasn't delivered to test@example.jp because the address couldn't be found, or is unable to receive mail.
The response from the remote server was:
550 5.1.1 test@example.jp: Recipient address rejected: User unknown in virtual mailbox table

[unknown_local_recipient_reject_code = 550]の設定はコメントアウトされているのに
このような宛先不明のメッセージが返ってくるという問題と、 luser_relayが指定されているにも関わらず、
メールが転送されないという2つの問題が発生しているように見えます。

また、この際 /var/log/maillogを確認してみると以下のようなログが出力されています。
(この例では test-test@gmail.comという確認用のGmailメールアカウントより
test@example.jpにテストメールが送信されています。)

Apr 3 11:25:15 server postfix/smtpd[4768]: connect from mail-lf1-f46.google.com[209.85.167.46]
Apr 3 11:25:16 server postfix/smtpd[4768]: Anonymous TLS connection established from mail-lf1-f46.google.com[209.85.167.46]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Apr 3 11:25:17 server postfix/smtpd[4768]: NOQUEUE: reject: RCPT from mail-lf1-f46.google.com[209.85.167.46]: 550 5.1.1 test@example.jp: Recipient address rejected: User unknown in virtual mailbox table; from=test-test@gmail.com to=test@example.jp proto=ESMTP helo=<mail-lf1-f46.google.com>
Apr 3 11:25:18 server postfix/smtpd[4768]: disconnect from mail-lf1-f46.google.com[209.85.167.46] ehlo=2 starttls=1 mail=1 rcpt=0/1 data=0/1 quit=1 commands=5/7

現在までのmain.cfの変更箇所は、設定をちょこちょこ変えているので変更した箇所のみの抜粋が難しいですが
念のため、現在のmain.cfでコメントアウト部分を抜いた設定情報を以下に記します。

root@server:/# cat /etc/postfix/main.cf queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/lib/postfix/sbin data_directory = /var/lib/postfix mail_owner = postfix sendmail_path = /usr/sbin/sendmail newaliases_path = /usr/bin/newaliases mailq_path = /usr/bin/mailq setgid_group = postdrop debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 debug_peer_level = 2 luser_relay = user1@example.jp local_recipient_maps = biff = no swap_bangpath = no allow_percent_hack = no allow_min_user = no disable_vrfy_command = yes inet_protocols = all inet_interfaces = all smtpd_tls_protocols = !SSLv2 !SSLv3 smtpd_tls_mandatory_protocols = !SSLv2 !SSLv3 smtp_tls_protocols = !SSLv2 !SSLv3 smtp_tls_mandatory_protocols = !SSLv2 !SSLv3 lmtp_tls_protocols = !SSLv2 !SSLv3 lmtp_tls_mandatory_protocols = !SSLv2 !SSLv3 smtpd_tls_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA smtpd_tls_dh512_param_file = /etc/ssl/dh512_param.pem smtpd_tls_dh1024_param_file = /etc/ssl/dh2048_param.pem tls_random_source = dev:/dev/urandom smtp_tls_loglevel = 1 smtpd_tls_loglevel = 1 smtpd_tls_security_level = may smtp_tls_security_level = may smtp_tls_CApath = /etc/ssl/certs smtp_tls_CAfile = $smtpd_tls_CAfile smtp_tls_note_starttls_offer = yes enable_long_queue_ids = yes smtpd_reject_unlisted_recipient = yes smtpd_reject_unlisted_sender = yes header_checks = pcre:/etc/postfix/header_checks body_checks = pcre:/etc/postfix/body_checks.pcre smtpd_command_filter = pcre:/etc/postfix/command_filter.pcre smtpd_helo_required = yes smtpd_helo_restrictions = permit_mynetworks permit_sasl_authenticated check_helo_access pcre:/etc/postfix/helo_access.pcre reject_non_fqdn_helo_hostname reject_unknown_helo_hostname smtpd_sender_restrictions = reject_unknown_sender_domain reject_non_fqdn_sender reject_unlisted_sender permit_mynetworks permit_sasl_authenticated check_sender_access pcre:/etc/postfix/sender_access.pcre smtpd_recipient_restrictions = reject_non_fqdn_recipient reject_unlisted_recipient check_policy_service inet:127.0.0.1:7777 permit_mynetworks permit_sasl_authenticated reject_unauth_destination smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:7777 smtpd_data_restrictions = reject_unauth_pipelining proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions $sender_dependent_relayhost_maps enable_original_recipient = no virtual_minimum_uid = 2000 virtual_uid_maps = static:2000 virtual_gid_maps = static:2000 virtual_mailbox_base = /var/vmail relayhost = [MAIL.PROVIDER.SERVER.NAME.COM]:587 smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/saslpass smtp_sasl_tls_security_options = noanonymous smtp_sasl_mechanism_filter = plain myhostname = server.example.jp myorigin = server.example.jp mydomain = example.jp mynetworks = 127.0.0.1 [::1] mydestination = $myhostname, localhost, localhost.localdomain alias_maps = hash:/etc/postfix/aliases alias_database = hash:/etc/postfix/aliases message_size_limit = 20971520 recipient_delimiter = + compatibility_level = 2 transport_maps = proxy:pgsql:/etc/postfix/pgsql/transport_maps_user.cf proxy:pgsql:/etc/postfix/pgsql/transport_maps_maillist.cf proxy:pgsql:/etc/postfix/pgsql/transport_maps_domain.cf sender_dependent_relayhost_maps = proxy:pgsql:/etc/postfix/pgsql/sender_dependent_relayhost_maps.cf smtpd_sender_login_maps = proxy:pgsql:/etc/postfix/pgsql/sender_login_maps.cf virtual_mailbox_domains = proxy:pgsql:/etc/postfix/pgsql/virtual_mailbox_domains.cf relay_domains = $mydestination proxy:pgsql:/etc/postfix/pgsql/relay_domains.cf virtual_mailbox_maps = proxy:pgsql:/etc/postfix/pgsql/virtual_mailbox_maps.cf virtual_alias_maps = proxy:pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf proxy:pgsql:/etc/postfix/pgsql/domain_alias_maps.cf proxy:pgsql:/etc/postfix/pgsql/catchall_maps.cf proxy:pgsql:/etc/postfix/pgsql/domain_alias_catchall_maps.cf sender_bcc_maps = proxy:pgsql:/etc/postfix/pgsql/sender_bcc_maps_user.cf proxy:pgsql:/etc/postfix/pgsql/sender_bcc_maps_domain.cf recipient_bcc_maps = proxy:pgsql:/etc/postfix/pgsql/recipient_bcc_maps_user.cf proxy:pgsql:/etc/postfix/pgsql/recipient_bcc_maps_domain.cf postscreen_greet_action = drop postscreen_blacklist_action = drop postscreen_dnsbl_action = drop postscreen_dnsbl_threshold = 2 postscreen_dnsbl_sites = zen.spamhaus.org=127.0.0.[2..11]*3 b.barracudacentral.org=127.0.0.2*2 postscreen_dnsbl_reply_map = texthash:/etc/postfix/postscreen_dnsbl_reply postscreen_access_list = permit_mynetworks cidr:/etc/postfix/postscreen_access.cidr postscreen_dnsbl_whitelist_threshold = -2 smtpd_sasl_type = dovecot smtpd_sasl_path = private/dovecot-auth virtual_transport = dovecot dovecot_destination_recipient_limit = 1 mlmmj_destination_recipient_limit = 1

どのような事が問題となっている可能性があるか、ご存じの方がいらっしゃいましたらご教授頂けると幸いです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

scsi

2019/04/02 22:20

abc@example.jpへはメールが届く状態ですか?
kodiack

2019/04/03 10:35 編集

ご質問内容の回答とともに、質問本文を更新させて頂きました。 基本的に一般的なメールの送受信では問題はなく 作成したアカウントではメールの利用が出来ております。 (今回のluser_relay以外の設定部分に関してはすべて問題なく動いているように見えます。)
scsi

2019/04/03 14:35

virtual mailbox tableのルールが適用されているのですね。main.cfの編集した箇所を全て書いて貰えますか?
kodiack

2019/04/03 16:26

ご回答ありがとうございます、編集箇所のみの抜粋が困難であったため、 コメントアウト箇所を削除した形のmain.cfをアップロード致しました。 ご確認お願い致します。
kodiack

2019/04/04 01:17

再度のご回答ありがとうございました。またvirtual_alias_mapsの設定のご提案ありがとうございます。 luserがvirtual domainに対して利用出来ないと言うのは完全に盲点でした。 実はここまで至るまでにvirtual_alias_mapsを利用した設定も検討したのですが、メールドメインを複数のユーザーで利用しているため、コンプライアンスの観点から全メールを単一のアカウントに配送する設定は躊躇しておりました。virtualドメインにおいて宛先不明のメールだけを転送出来る設定が出来れば一番良いのですが...。
guest

回答2

0

ベストアンサー

ぱっと調べたところluser_relayはvirtualドメインを使用した環境では使用できないようです。

luser_relayではなくvirtual_alias_mapsの最後にregxpで全てのメールをuser1@example.jp宛に配送するルールを追加するのが良いと思います。

投稿2019/04/03 21:54

scsi

総合スコア2840

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

この質問の「実現したい事」として「luser_relayの問題を解消する」とさせて頂きました。scsiさんよりの回答はluser_relayを有効にするためにはvirtual上のユーザーでなく、ローカルのユーザーを利用する必要があると読み換える事が出来ますので、こちらの回答で解決とし、ベストアンサーとさせて頂きたいと思います。

投稿2019/04/04 01:25

kodiack

総合スコア13

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問