Postfix

提供: fukudat.net
2020年6月3日 (水) 16:55時点におけるFukudat (トーク | 投稿記録)による版 (→‎Configure)
ナビゲーションに移動検索に移動

Ubuntu上でMail Transfer Agent (MTA) サービスを postfix で作成する覚書。

Install

$ sudo apt-get install -y postfix

configurator が走るので、

  • メール設定の一般形式 = インターネットサイト
  • システムメール名 = fukudat.net

としておく。

SASL認証のために dovecot (POP3/IMAP サーバー)を入れる。

$ sudo apt-get install -y dovecot-core

でも POP3/IMAP は使わない。

Configure

/etc/postfix にある main.cf を編集して、以下の変更を加える。

mail_owner = postfix
myhostname = fukudat.net
mydomain = fukudat.net
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
local_recipient_maps = unix:passwd.byname $alias_maps
alias_maps = hash:/etc/aliases
smtpd_banner = $myhostname ESMTP
sendmail_path = /usr/sbin/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
#html_directory =
#manpage_directory =
#sample_directory =
#readme_directory =
message_size_limit = 10485760
mailbox_size_limit = 1073741824
disable_vrfy_command = yes
smtpd_banner = $myhostname ESMTP
smtpd_helo_required = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
smtpd_relay_restrictions = permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination
smtpd_use_tls = yes                               
smtpd_tls_cert_file = /etc/ssl/certs/fukudat.net.crt     # SSL Certificate
smtpd_tls_key_file = /etc/ssl/private/fukudat.net.key # SSL Private Key

同じディレクトリの master.cf を編集して以下のような変更を加える。

submission inet n       -       y       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
smtps     inet  n       -       y       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

参考文献

脚注