2021-1-10現在の情報です。現時点でのテストは二つのドメインの内、kinryo.netに関してはほぼテストが終了していますが、kinryokai.netに関してはローカルネットワーク内でのテストのみが終了していますが、グローバルからのテストはまだ出来て居ません。というのも、このドメインは現時点で全く別のホストで現行のメールサーバーが稼働しており、DNSの設定を変更しないとならないのですが、過去のメールのデーターを移し変えていないからです。
postfixはvirtualで複数のメールサーバーを稼動させます。下記に postconf -n の結果を記します。(ご存じだと思いますが、これはデフォルトの設定から変更した部分のみを表示しています)この設定はメイルボックスはMaildir形式(一つのメールが一つのファイル)、ipv6は使はない、スパムやウィルスチェックは centossrv.comを参考に設定、sasl authを導入、その認証は dovecotに委せる(dovecotの設定で出てきますが、認証はmysql(mariadb)を使う)、メールの暗号化は letsencrypt を使う、メイルデーターの保存場所は /Mail (これは移設を簡単にするために、新たに専用の領域を作った。又、新規ユーザーとしてvmailを作成しそのUID、GIDを10000にした。又 /mail以下の所有者をvmailにした。)、バーチャルドメインやバーチャルメイルボックスにはmysql(mariadb)を使う。IPアドレスは伏せ字。
# posyconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
disable_vrfy_command = yes
header_checks = regexp:/etc/postfix/header_checks
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = ipv4
local_recipient_maps =
local_transport = virtual
luser_relay = unknown_user@localhost
mail_owner = postfix
mailbox_command = /usr/bin/procmail
mailbox_size_limit = 9663676416
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 52428800
milter_command_timeout = 150
milter_default_action = tempfail
milter_mail_macros = {auth_author} {auth_type} {auth_authen}
milter_protocol = 6
mydestination =
mydomain = kinryo.net
myhostname = mail.kinryo.net
mynetworks = 192.168.X.X/24, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_tls_ciphers = high
smtp_tls_mandatory_protocols = !SSLv2,!SSLv3
smtp_tls_protocols = !SSLv2,!SSLv3
smtp_tls_security_level = may
smtpd_banner = $myhostname ESMTP unknown
smtpd_client_restrictions = permit_mynetworks, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_client, reject_rbl_client all.rbl.jp, reject_rbl_client zen.spamhaus.org, permit
smtpd_helo_required = yes
smtpd_milters = unix:/var/run/milter-manager/milter-manager.sock
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = reject_unknown_sender_domain, reject_non_fqdn_sender
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.kinryo.net/fullchain.pem
smtpd_tls_ciphers = high
smtpd_tls_key_file = /etc/letsencrypt/live/mail.kinryo.net/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_ciphers = high
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3
smtpd_tls_protocols = !SSLv2,!SSLv3
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
tls_high_cipherlist = kEECDH:+kEECDH+SHA:kEDH:+kEDH+SHA:+kEDH+CAMELLIA:kECDH:+kECDH+SHA:kRSA:+kRSA+SHA:+kRSA+CAMELLIA:!aNULL:!eNULL:!SSLv2:!RC4:!MD5:!DES:!EXP:!SEED:!IDEA:!3DES
unknown_local_recipient_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:10000
virtual_mailbox_base = /Mail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 9663676416
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_transport = virtual
virtual_uid_maps = static:10000
尚、smtpd_client_restrictions, smtpd_sender_restrictions, smtpd_recipient_restrictions, は同じような設定が出来るが、勘違いしやすいので、https://www.netmarvs.com/archives/3808 を参考にすると良い。
/etc/postfix/master.cf は
smtp inet n – n – – smtpd
smtps inet n – n – – smtpd
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
pickup unix n – n 60 1 pickup
cleanup unix n – n – 0 cleanup
qmgr unix n – n 300 1 qmgr
tlsmgr unix – – n 300 1 tlsmgr
rewrite unix – – n – – trivial-rewrite
bounce unix – – n – 0 bounce
defer unix – – n – 0 bounce
trace unix – – n – 0 bounce
verify unix – – n – 1 verify
flush unix n – n 1000? 0 flush
proxymap unix – – n – – proxymap
proxywrite unix – – n – 1 proxymap
smtp unix – – n – – smtp
relay unix – – n – – smtp
showq unix n – n – – showq
error unix – – n – – error
retry unix – – n – – error
discard unix – – n – – discard
local unix – n n – – local
virtual unix – n n – – virtual
lmtp unix – – n – – lmtp
anvil unix – – n – 1 anvil
scache unix – – n – 1 scache
mysql(mariadb)関連。尚、postfixadminのdatabase名:postfix, user名:postfixadmin, パスワードは伏せ字
# cat /etc/postfix/mysql_virtual_alias_maps.cf
user = postfixadmin
password = XXXXXX
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address
# cat /etc/postfix/mysql_virtual_domains_maps.cf
user = postfixadmin
password = XXXXXX
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and active = ‘1’
# cat /etc/postfix/mysql_virtual_mailbox_maps.cf
user = postfixadmin
password = XXXXXX
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username