さくらのVPSでPostfix
さくらのVPSにPostfixをインストール
さくらのVPSにPostfixをインストールしてみた。
# aptitude install postfix
インストールが始まるとeximを削除するかどうか聞いてくる。
The following NEW packages will be installed:
postfix{b}
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,326 kB of archives. After unpacking 3,273 kB will be used.
The following packages have unmet dependencies:
exim4-config: Conflicts: postfix but 2.7.1-1 is to be installed.
postfix: Conflicts: mail-transport-agent which is a virtual package.
exim4-daemon-light: Conflicts: mail-transport-agent which is a virtual package.
The following actions will resolve these dependencies:
Remove the following packages:
1) exim4
2) exim4-base
3) exim4-config
4) exim4-daemon-light
Accept this solution? [Y/n/q/?] y
サーバの設定を選ぶ。

ドメイン名の設定

/etc/postfix/main.cfの編集
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = tewasura.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = tewasura.com, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtpd_soft_error_limit = 3
smtpd_hard_error_limit = 5
smtpd_error_sleep_time = 70
smtpd_delay_reject = yes
最後の4行を追加。これが無いと攻撃のログがたくさんできますよ。以上で終わり。
しかし、料金を支払わないと、そのままではメールの送信ができません。たぶんOP25Bですね。送信メールがキューに溜まったままになり、何度も相手サーバとやりあい、弾かれます。さくらさんで入金の確認が終わるとメールが送信されます。
追記:このままでは外部からのメールの送受信はできませんよ。今回はあくまでも内部からメールを送信するためだけに使っています。受信はしちゃいますが別のサーバへと .forward で転送されます。要するに管理用にしか使っていないということです。外部からの送受信用に使うのなら、それなりの設定をしてください。
キーワード:
参照:[本日のメニュー]