Mail サーバー : Postfix インストール2025/12/02 |
|
Postfix をインストールして SMTP サーバーを構築します。 |
|
| [1] | Postfix をインストールします。 |
|
mail:~ # zypper -n install postfix
|
| [2] | メール不正中継防止のため、後述の Dovecot の SASL 機能を利用して、送信にも認証を要求するように Postfix を設定します。 |
|
mail:~ #
vi /etc/postfix/main.cf # 106行目 : コメント解除しホスト名指定 myhostname = mail.srv.world # 114行目 : コメント解除しドメイン名指定 mydomain = srv.world # 130行目 : コメント解除 myorigin = $mydomain # 451行目 : コメント解除し Maildir 形式へ移行 home_mailbox = Maildir/ # 714行目 : 変更 inet_interfaces = all # 715行目 : IPv4, IPv6 両方をリスンする場合は変更 inet_protocols = all # 719行目 : 追記 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain # 734行目 : 1 メールのサイズを制限する場合は変更 # 下例は 10M バイト message_size_limit = 10240000 # 746行目 : 追記 smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination # 765行目 : 以下のように変更 smtp_sasl_auth_enable = no smtp_sasl_security_options = smtp_sasl_password_maps = smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth # 812行目 : コメント化 #relay_domains = $mydestination, lmdb:/etc/postfix/relaymail:~ # systemctl enable --now postfix |
| [3] | Firewalld を有効にしている場合は、SMTP サービスの許可が必要です。 SMTP は [25/TCP] を使用します。 |
|
mail:~ # firewall-cmd --add-service=smtp success mail:~ # firewall-cmd --runtime-to-permanent success |
| Sponsored Link |
|
|