LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 5 years have passed since last update.

自分がなったメール構築の際の注意点メモ

Last updated at Posted at 2017-01-12

個人的なメモ
postfixadmin元のページ

mailコマンドで送れなかった。

/var/spool/virtual/domain.ltd/user/newへ配送されなかった。
実行したコマンドは#mail hostmaster@domain.ltd

maillogを確認すると、「unknown user」と表記されていた。
postfixadminのほうでhostmasterユーザーを追加しようとすると、「すでに追加されています。」と表記される。mysqlのmailboxテーブルのほうを確認してみると確かにユーザーがいない。

・対処
一旦、postfixadminのほうで転送の中にあるhostmaster@domain.ltdを削除して
アドレスの追加でhostmaster@domain.ltdを追加する。

メールが外部に送れなかった。

#losf -i:25で使われているポート番号の確認したらSMTPがなかった。またはlocalhostだけLISTENになっていた。

・対処

下記のものがコメントされていた。
(デフォルトだとコメントは外されています。なぜ私はコメントしてたのでしょう(笑))

/etc/postfix/master.cf
smtp      inet  n       -       n       -       -       smtpd

後者はinet_interfacesがlocalhostになっていた。

/etc/postfix/main.cf
inet_interfaces = all

外部への送信しても相手側が受け取ってくれなかった。

route53へSPFレコードが書き込まれていなかったのが原因。
SPF正規のメールサーバーかどうかを判断してくれるものらしい。

route53のコンソールでレコードを作成
typeはTXTにしてValueのところに「v=spf1 ip4:1.1.1.1 -all」と記述。(1.1.1.1はメールサーバーのIPアドレス)

参考サイト
https://blog.apar.jp/linux/737/

その他

route53に下記のものを登録

postfixadminにドメインでアクセスできるように設定

name : mail.domain.ltd
type : A
value : 1.1.1.1

MXレコードを設定
(最後にピリオド忘れずに)

name : 空白
type : MX
value : 10 mail.domain.ltd.

参考サイト

ポートセキュリティ

port.PNG

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up