Fedora 37
Sponsored Link

Mail サーバー : Postfix インストール2022/11/25

 
Postfix をインストールして SMTP サーバーを構築します。
[1] Postfix をインストールします。
[root@mail ~]#
dnf -y install postfix
[2] メール不正中継防止のため、後述の Dovecot の SASL 機能を利用して、送信にも認証を要求するように Postfix を設定します。
[root@mail ~]#
vi /etc/postfix/main.cf
# 98行目 : コメント解除しホスト名指定
myhostname = mail.srv.world

# 106行目 : コメント解除しドメイン名指定
mydomain = srv.world

# 122行目 : コメント解除
myorigin = $mydomain

# 139行目 : 変更
inet_interfaces = all

# 142行目 : IPv4 のみをリスンする場合は変更
inet_protocols = ipv4

# 187行目 : 追記
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# 290行目 : コメント解除し自ネットワーク追記
mynetworks = 127.0.0.0/8, 10.0.0.0/24

# 447行目 : コメント解除し Maildir 形式へ移行
home_mailbox = Maildir/

# 602行目 : 追記
smtpd_banner = $myhostname ESMTP

# 以下 最終行へ追記
# SMTP VRFY コマンドは無効にする
disable_vrfy_command = yes

# クライアントに対して HELO コマンドを要求する
smtpd_helo_required = yes

# 1 メールのサイズを制限する
# 下例は 10M バイト
message_size_limit = 10240000

# SMTP-Auth 設定
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject

[root@mail ~]#
systemctl enable --now postfix

[3] Firewalld を有効にしている場合は、SMTP サービスの許可が必要です。 SMTP は [25/TCP] を使用します。
[root@mail ~]#
firewall-cmd --add-service=smtp

success
[root@mail ~]#
firewall-cmd --runtime-to-permanent

success
関連コンテンツ