LennyのpostfixとExchange2010のsmtp応答比較

※Debian Lenny postfixとExchange2010のsmtpサーバの応答比較

■規定のsmtpポートの待ち受けを確認する。

★IPv6は使用可能だが、postfix側でipv4を指定している。

$ grep ipv /etc/modprobe.d/aliases
# alias net-pf-2 ipv4
# alias net-pf-10 ipv6

$ lsmod | grep v6
ipv6 288456 18

$ sudo postconf -d | grep v4
[sudo] password for labunix:
inet_protocols = ipv4

$ netstat -an | grep :25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN

■Exchange2010ではIPv4/v6共に待ちうけしている。

> netstat -an | find ":25"
TCP 0.0.0.0:25 0.0.0.0:0 LISTENING
TCP [::]:25 [::]:0 LISTENING

★IPv6は特殊な方法で無効にする為、余程の理由が無い限り行わない。

 簡単に言うと、MSの言う「IPv6を無効に出来ます」は大間違い。
 Exchange単独でのIPv6を無効にすることは出来ません。
 IIS、FTP等の依存関係を考慮した上で、レジストリで無効にするという、
 何故か英語のページで誤魔化されます。

 また、OSのレジストリ変更を行ってもIPv6のローカルホストを無効にすることは出来ません。
 (ネットワークアダプタのIPv6サポートはDC、Exchangeサーバ共にそれぞれインストール前にチェックは外してあります)

参考URL1:http://kogelog.wordpress.com/2011/05/22/
参考URL2:http://technet.microsoft.com/en-us/network/cc987595.aspx#EDFAE
参考URL3:http://support.microsoft.com/kb/952842/ja

★確認方法

> reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters

■smtpの応答設定を確認する。

★postfix側では、応答に関する変更は行っていない。

$ sudo postconf -n | grep "helo\|ehlo"

★「smtpd_helo_required = no」なので、HELOコマンドには応答しない。

$ sudo postconf -d | grep helo
milter_helo_macros = {tls_version} {cipher} {cipher_bits} {cert_subject} {cert_issuer}
smtp_helo_name = $myhostname
smtp_helo_timeout = 300s
smtpd_helo_required = no
smtpd_helo_restrictions =

★ehloの応答設定(規定)

$ sudo postconf -d | grep ehlo
smtp_always_send_ehlo = yes
smtp_discard_ehlo_keyword_address_maps =
smtp_discard_ehlo_keywords =
smtp_never_send_ehlo = no
smtpd_discard_ehlo_keyword_address_maps =
smtpd_discard_ehlo_keywords =
smtpd_proxy_ehlo = $myhostname

■manマニュアルで応答に関する設定は確認、変更出来る。

$ man 5 postconf | grep "_ehlo_\|_helo_" | \
for list in `xargs`;do echo "$list" | grep ^smtp | grep -v \- | sed s/"\,\|\.\|\=.*"//g;done | sort | uniq
smtp
smtp_discard_ehlo_keyword_address_maps
smtp_discard_ehlo_keywords
smtp_helo_name
smtp_helo_timeout
smtpd_client_restrictions
smtpd_delay_reject
smtpd_discard_ehlo_keyword_address_maps
smtpd_discard_ehlo_keywords
smtpd_helo_required
smtpd_helo_restrictions
smtpd_sender_restrictions

■Debianの ehlo 応答確認

$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 nec-debian.example.local ESMTP Postfix (Debian/GNU)
ehlo localhost
250-debianlenny.example.jp
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

■Exchangeの ehlo 応答確認

$ telnet 192.168.164.155 25
Trying 192.168.164.155...
Connected to 192.168.164.155.
Escape character is '^]'.
eh220 VMEX.exchange.ms Microsoft ESMTP MAIL Service ready at Sun, 11 Sep 2011 21:44:41 +0900
lo localhost
250-VMEX.exchange.ms Hello [192.168.164.1]
250-SIZE
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-X-ANONYMOUSTLS
250-AUTH NTLM
250-X-EXPS GSSAPI NTLM
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250-XRDST
250 XSHADOW
quit
221 2.0.0 Service closing transmission channel
Connection closed by foreign host.

■プレインテキストを拒否すると450のエラーコードを返す事が分かる。

$ sudo postconf -d | grep plain
lmtp_sasl_security_options = noplaintext, noanonymous
plaintext_reject_code = 450
smtp_sasl_security_options = noplaintext, noanonymous

$ man 5 postconf | grep "plain" | grep ^[a-z]
lmtp_sasl_security_options (default: noplaintext, noanonymous)
plaintext_reject_code (default: 450)
smtp_sasl_security_options (default: noplaintext, noanonymous)

■送信時のメッセージサイズには制限がある。

$ sudo postconf | grep message_size_limit
message_size_limit = 10240000

★Windows側でも管理コンソールのプロパティか管理Shellから参照、変更が出来る。
 設定値のデフォルトは同じく10MB。

■ExchangeではVRFYが無い為、ユーザの検索は行われない。

VRFYはメールアカウントが存在するかどうかを確認するもので存在していればそのユーザー名を表示します。

$ sudo postconf | grep -i vrfy
disable_vrfy_command = no

■DebianのpostfixでもVRFYの設定変更等により、アカウントの存在確認はOFFに出来る。

参考URL:http://linux.kororo.jp/cont/server/postfix_security.php

■Exchenge2010では、110/995143/993の各pop3、imap4ポートは
 デフォルトでリッスンしていない。

参考URL:http://technet.microsoft.com/ja-jp/library/bb124107.aspx

リッスンポートをコマンドプロンプトで確認する。

> netstat -an | find ":143"
> netstat -an | find ":993"

> netstat -an | find ":110"
> netstat -an | find ":995"

■netstatに無く、管理Shellからは見える。
 X509の証明書を使って、ポートにログインして使う仕組みらしい。なるほど。

[PS] C:\Windows\system32>get-imapsettings

UnencryptedOrTLSBindings SSLBindings LoginType X509CertificateName
------------------------ ----------- --------- -------------------
{:::143, 0.0.0.0:143} {:::993, 0.0.0.0:993} SecureLogin VMEX


[PS] C:\Windows\system32>get-popsettings

UnencryptedOrTLSBindings SSLBindings LoginType X509CertificateName
------------------------ ----------- --------- -------------------
{:::110, 0.0.0.0:110} {:::995, 0.0.0.0:995} SecureLogin VMEX

■ここまでのまとめ

 ・Outlook2010でlocalhost経由の自身宛メールは送受信OK。
 ・Outlook起動時にExchange2010の証明書の取込が必要。
 ・デフォルトのExchangeServerは、普通のメールサーバとしては使えない。
 ・Exchange Management Shellは、PowerShellにモジュールを追加しただけ。




[PS] C:\Windows\system32>get-module | format-list

Name : vmex.exchange.ms
Path : C:\Users\Administrator.EXCHANGE\AppData\Roaming\Microsoft\Exchange\RemotePowerShell\vmex.exchange.m
s\vmex.exchange.ms.psm1
Description : http://vmex.exchange.ms/powershell?serializationLevel=Full;ExchClientVer=14.1.218.15 の暗黙的なリモ
ート処理
ModuleType : Script
Version : 1.0
NestedModules : {}
ExportedFunctions : {Add-ADPermission, Add-AvailabilityAddressSpace, Add-ContentFilterPhrase, Add-DatabaseAvailabilityG
roupServer, Add-DistributionGroupMember, Add-FederatedDomain, Add-IPAllowListEntry, Add-IPAllowList
Provider, Add-IPBlockListEntry, Add-IPBlockListProvider, Add-MailboxDatabaseCopy, Add-MailboxFolder
Permission, Add-MailboxPermission, Add-ManagementRoleEntry, Add-PublicFolderAdministrativePermissio
n, Add-PublicFolderClientPermission...}
ExportedCmdlets : {}
ExportedVariables : {}
ExportedAliases : {}

★Exchange2010のメールサーバのクセは、良くも悪くもそのままグループウエア全体のクセとなる。
 ユーザ検索の制限をDebianに取り込む事が出来れば上出来といったところ。
 Debianがドメインに参加できたとしてもExchangeとの連携は難しいだろうという印象。