Computer
Postfix+TLS

Postfix with TLSのインストール

2007年9月にPostfixを入れ直しました.
以前のは PostfixのインストールPostfix with TLSのインストール を参照.

どうやら
http://www.h3.dion.ne.jp/~x723/postfix.html
http://tsuttayo.sytes.net/postfix/imap/
の情報によると,少なくともVine4ではapt-getからインストールしたPostfixはTLSに対応している模様.
ということで,大幅更新.

まず,もろもろのインストール.
# apt-get update
# apt-get install courier-imap openssl-devel cyrus-sasl-devel cyrus-sasl-md5 cyrus-sasl-plain db4-devel postfix
(open-ssl-develはApacheのインストール時とかでインストールしている可能性あり.postfixは標準で入っている・・・かも)
次に各サービスの起動.
# chkconfig saslauthd on
# service saslauthd restart
# service courier-authlib restart
# service courier-imap restart
# service postfix restart
お次はCyrus SASLの設定.
# vi /usr/lib/sasl2/smtpd.conf
というファイルを作成し,
pwcheck_method: saslauthd
と入力.
次に
# vi /etc/postfix/master.cf
smtps inet n - n - - smtpd
-o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
の部分のコメントアウトを外す.
さらにSSLの証明書はApacheのを流用する.(作り直しても良い.)
# ln -s /usr/local/apache2/conf/server.crt /etc/postfix/server.crt
# ln -s /usr/local/apache2/conf/server.key /etc/postfix/server.key
そして/etc/postfix/main.cfの編集.
myhostname = silvia.satze.net

mydomain = satze.net

myorigin = $mydomain

inet_interfaces = $myhostname, localhost

mydestination = $mydomain

mynetworks = 192.168.1.0/24, 127.0.0.0/8

relay_domains = $mydestination

#mail_spool_directory = /var/spool/mail (←#を付ける)
home_mailbox = Maildir/

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $mydomain
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination
broken_sasl_auth_clients = no

smtpd_tls_cert_file = /etc/postfix/server.crt
smtpd_tls_key_file = /etc/postfix/server.key
smtpd_use_tls = yes
smtpd_tls_loglevel = 1
以上を入力.
さらにCourier-IMAPの設定.
/etc/courier-imap/
にあるimapd, imapd-ssl, pop3dというファイルを開いて, それぞれ
IMAPDSTART = NO
IMAPDSSLSTART = NO
POP3DDSTART = NO
としておく.
最後に,サービスの再起動.
# service saslauthd restart
# service courier-authlib restart
# service courier-imap restart
# service postfix restart
これでOK.

# telnet localhost 25
をすると
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 silvia.satze.net ESMTP Postfix
EHLO localhost <-入力
250-silvia.satze.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH CRAM-MD5 LOGIN DIGEST-MD5 PLAIN
250 8BITMIME
STARTTLS <-入力
220 Ready to start TLS
となればOK (QUITでtelnetから抜けれる).
ただし,実際はCRAM-MD5は非対応っぽい.
Valid HTML 4.01 Transitional Valid CSS!
Copyright© Satze.net All rights reserved.