Xserver VPSでDebianサーバ構築/SMTPサーバ設定

提供: Medeshima wiki
ナビゲーションに移動 検索に移動

概要

次の表のとおりである。

メールサーバ Postfix

設定

証明書

$ sudo certbot certonly --webroot --webroot-path /var/www/html -d www.example.com

または

$ sudo certbot certonly --standalone -d www.example.com

Postfix設定

次のコマンドを実行し、以下の表の設定を行う。

$ sudo apt install postfix libsasl2-modules

※再設定する場合

$ sudo dpkg-reconfigure postfix

メール設定の一般形式 インターネットサイト
システムメール名 example.com
root と postmaster のメール受け取りユーザ mede
メールを受け取るほかの宛先 (なければ空) example.com, HOST, localhost, localhost.localdomain
メールキューの同期更新を強制しますか? いいえ
ローカルネットワーク 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
メールボックスのサイズの制限 (バイト) 0
ローカルアドレス拡張文字 +
利用するインターネットプロトコル すべて

myhostname

  • /etc/postfix/main.cf
myhostname = mail.example.com

その他の設定

  • /etc/postfix/main.cf
smtpd_tls_cert_file=/etc/letsencrypt/live/mail.example.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/mail.example.com/privkey.pem

home_mailbox = Maildir/

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

  • /etc/postfix/master.cf
smtps     inet  n       -       y       -       -       smtpd

  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes

  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject

e-mail message submission

submission inet n       -       y       -       -       smtpd

  -o smtpd_sasl_auth_enable=yes

  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject

設定反映

次のコマンドを実行し、設定を反映する。

$ sudo systemctl reload postfix