どうも、SASLを使うときには TLS対応が必須らしい。(なぜならば、Outlook Expressは LOGIN 認証しか対応していないので、TLSを使わないと平文のパスワードがネットワークを流れてしまうから。もっとも、OEなんて私は使わないんだけど)
と、言うわけで今回の参考はここ
portsからmakeするときの最初の設定画面で、SASL2に加えてTLSにもチェックを入れる。

続いて、サーバの証明書を作ります。
うちの場合は、https用にCAの証明書とhttpサーバの証明書が既にあるので、これにsmtpサーバの証明書の追加になります。
# cd /usr/local/etc/postfix
# openssl req -new -nodes -keyout smtpd.key -out smtpd.csr -days 3650
Generating a 1024 bit RSA private key
....++++++
............................++++++
writing new private key to 'smtpd.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:JP
State or Province Name (full name) [Some-State]:Kanagawa
Locality Name (eg, city) []:Yokohama
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Wizard limit
Organizational Unit Name (eg, section) []:smtp
Common Name (eg, YOUR name) []:wizard-limit.net
Email Address []:root@wizard-limit.net

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
これで、smtpd.keyがサーバの鍵、smtpd.csrが証明書の発行要求になる。
CAのディレクトリにsmtpd.csrをコピーして、sign.shでサインする。
# ./sign.sh smtpd.csr
CA signing: smtpd.csr -> smtpd.crt:
Using configuration from ca.config
Enter pass phrase for ./ca.key:
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'JP'
stateOrProvinceName   :PRINTABLE:'Kanagawa'
localityName          :PRINTABLE:'Yokohama'
organizationName      :PRINTABLE:'Wizard limit'
organizationalUnitName:PRINTABLE:'smtp'
commonName            :PRINTABLE:'wizard-limit.net'
emailAddress          :IA5STRING:'root@wizard-limit.net'
Certificate is to be certified until Mar 31 09:35:11 2016 GMT (3650 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
CA verifying: smtpd.crt <-> CA cert
smtpd.crt: OK
出来上がったsmtpd.crtを/usr/local/etc/postfixにコピー。keyファイルは、chmod 400とかしておく。
続いて、main.cf
smtpd_tls_cert_file = /usr/local/etc/postfix/smtpd.crt
smtpd_tls_key_file = /usr/local/etc/postfix/smtpd.key
smtpd_tls_CAfile = /usr/local/etc/apache2/ssl.ca/ca.crt
smtpd_tls_received_header = yes
最後に、master.cfのsubmissionポートのところ
submission inet n       -       n       -       -       smtpd
        -o smtpd_use_tls=yes
        -o smtpd_enforce_tls=yes
        -o smtpd_sasl_auth_enable=yes
        -o smtpd_sasl_security_options=noanonymous
        -o broken_sasl_auth_clients=yes
        -o smtpd_client_restrictions=
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
        -o smtpd_data_restrictions=
        -o smtpd_etrn_restrictions=reject
        -o content_filter=dksign:[127.0.0.1]:10028
後は、postfix reloadで有効になるはず。
ためしに、Beckyから送ってみたら、無事に送れて、ReceivedヘッダにTLS使ってまっせ~みたいなのが追加される。
暇があったら、証明書の検証とか、クライアント認証とかもやってみるかな~。

カテゴリ

トラックバック(0)

このブログ記事を参照しているブログ一覧: Postfix の TLS対応

このブログ記事に対するトラックバックURL: https://www.wizard-limit.net/cgi-bin/mt/mt-tb.cgi/1032

コメントする

このブログ記事について

このページは、falseが2006年4月 3日 19:05に書いたブログ記事です。

ひとつ前のブログ記事は「SASL対応」です。

次のブログ記事は「pop3s」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。

広告

Powered by Movable Type 6.1.1