広告

IDCF ubuntu

postfixの設定

postfixの設定

$ sudo vi /etc/postfix/main.cf
# 59行目:コメント解除
mail_owner = postfix
 
# 76行目:コメント解除しホスト名指定★
myhostname = mail.heart-net.biz
 
# 83行目:コメント解除しドメイン名指定
mydomain = heart-net.biz

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

# 118行目:コメント解除
inet_interfaces = all

# 166行目:コメント解除
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# 209行目:コメント解除
local_recipient_maps = unix:passwd.byname $alias_maps

# 268行目:自ネットワーク追記(ifconfigコマンドでeth0のinetアドレスが10.0.2.15だったので10.0.0.0/24を追記)
mynetworks = 127.0.0.0/8, 10.0.0.0/24

# 388行目:コメント解除
alias_maps = hash:/etc/aliases

# 399行目:コメント解除
alias_database = hash:/etc/aliases

# 421行目:コメント解除 ( Maildir形式へ移行 )
home_mailbox = Maildir/

# 557行目:コメントにしてその下に追記
#smtpd_banner = $myhostname ESMTP $mail_name (@@DISTRO@@)
smtpd_banner = $myhostname ESMTP

# 632行目:追記
sendmail_path = /usr/sbin/postfix

# 637行目:追記
newaliases_path = /usr/bin/newaliases

# 642行目:追記
mailq_path = /usr/bin/mailq

# 648行目:追記
setgid_group = postdrop

# 652行目:コメント化
#html_directory =

# 656行目:コメント化
#manpage_directory =

# 661行目:コメント化
#sample_directory =

# 665行目:コメント化
#readme_directory =

# 最終行へ追記:送受信メールサイズを10Mに制限
message_size_limit = 10485760
# メールボックスサイズを1Gに制限
mailbox_size_limit = 1073741824

# 以下SMTP-Auth用
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = no
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject

# sendgrid設定
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:snedgriduserid:sendgridpassword
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587

$ sudo /etc/init.d/postfix restart

SSL(Lets Encrypt)追加

smtpd_tls_cert_file = /etc/letsencrypt/live/www.heart-net.biz/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/www.heart-net.biz/privkey.pem
smtpd_use_tls=yes
smtp_tls_security_level = may
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtp_sasl_auth_enable = no
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject_unauth_destination

master.cfの修正

smtps     inet  n       -       y       -       -       smtpd
#  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject

 

Hits: 23

広告

  • この記事を書いた人

higa

システムエンジニアをやっています。 Linux,macOS好き。おもにシステム管理たまに豆柴こてつの話。 最近はスマートホームを推進中。

-IDCF, ubuntu