Forums: users (Thread #12423)

POP proxyの動作について(qmail 1.03) (2006-09-23 19:17 by Anonymous #25077)

はじめまして、越智と申します。
今回bsfilterをPOP proxyとして利用するため動作を確認しています。

環境
OS Windows2000 SP4
MUA OutlookExpress 6.00 or Sylpheed 2.2.9-win32
MTA qmail 1.03 + vpopmail
アンチウィルスソフトは無効にしています。

bsfilter-1.0.14はc:\bsfilter以下に展開しています。
iconve.dll(iconve 1.9.1)もc:\bsfilterに配置しました。

bsfilter --add-spam
bsfilter --add-clean
bsfilter --update
でデータベースを作成して、

bsfilter ./spam/spam.eml
combined probability ./spam/spam.eml 1 1.000000
でbsfilterの単体ではうまく動いているようです。

bsfilter --pop --pop-server xxxx.xxx --pop-port 110 --pop-proxy-port 10110 -v --debug
で、POP Proxyとして起動しています。

デバッグ表示
start Sat Sep 23 19:01:48 東京 (標準時) 2006
pop mode start Sat Sep 23 19:01:48 東京 (標準時) 2006
pop_proxy is on 10110:0.0.0.0:0.0.0.0
#<TCPSocket:0xa5dd68> is accepted
#<TCPSocket:0xa5dab0> is connected
resp #<TCPSocket:0xa5dab0> +OK <1961.1159005719@xxxx.xxx>
resp #<TCPSocket:0xa5dd68> USER username@xxxx.xxx
send #<TCPSocket:0xa5dab0> USER username@xxxx.xxx
resp #<TCPSocket:0xa5dab0> +OK
Timeout error mx.partslist.to 110 10110
#<TCPSocket:0xa5dd68> is gone
#<TCPSocket:0xa5dab0> is gone

resp #<TCPSocket:0xa5dab0> +OK
のところで、タイムアウトしているようです。

別ISPのpopで試してみると、
#<TCPSocket:0xa5db58> is accepted
#<TCPSocket:0x9f7030> is connected
resp #<TCPSocket:0x9f7030> +OK pop.xxx.so-net.ne.jp <5003040.1159004645@xxx.xxx.xxx.xxx.16355>
resp #<TCPSocket:0xa5db58> USER username
send #<TCPSocket:0x9f7030> USER username
resp #<TCPSocket:0x9f7030> +OK password please
resp #<TCPSocket:0xa5db58> PASS ********
send #<TCPSocket:0x9f7030> PASS ********
resp #<TCPSocket:0x9f7030> +OK Maildrop locked and ready
resp #<TCPSocket:0xa5db58> STAT
send #<TCPSocket:0x9f7030> STAT
resp #<TCPSocket:0x9f7030> +OK 0 0
resp #<TCPSocket:0xa5db58> QUIT
send #<TCPSocket:0x9f7030> QUIT
resp #<TCPSocket:0x9f7030> +OK
#<TCPSocket:0xa5db58> is gone
#<TCPSocket:0x9f7030> is gone
のようになり、正常に動作しているみたいです。

etherealでパケットキャプチャもしてみましたが、bsfilterのログ表示と同じ内容でした。
vpopmailを使用しているので、ユーザ名がusername@domainの形式になっているのがまずいのか、
popサーバへUSERコマンドを発行した後のレスポンスが"+OK"だけなのが原因なのか、
対応策があれば非常にうれしいです。

Reply to #25077×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: POP proxyの動作について(qmail 1.03) (2006-09-23 22:16 by nabeken #25081)

vpopmailなしで、qmail-popup, qmaiol-pop3dのみを使用してmewから試してみました。
とくに問題は発生しませんでした。

#<TCPSocket:0x80663e8> is accepted
#<TCPSocket:0x8065a88> is connected
resp #<TCPSocket:0x8065a88> +OK <52911.1159015817@
resp #<TCPSocket:0x80663e8> CAPA
send #<TCPSocket:0x8065a88> CAPA
resp #<TCPSocket:0x8065a88> -ERR authorization first
resp #<TCPSocket:0x80663e8> USER nabeken
send #<TCPSocket:0x8065a88> USER nabeken
resp #<TCPSocket:0x8065a88> +OK
resp #<TCPSocket:0x80663e8> PASS ********
send #<TCPSocket:0x8065a88> PASS ********
resp #<TCPSocket:0x8065a88> +OK
resp #<TCPSocket:0x80663e8> LIST
send #<TCPSocket:0x8065a88> LIST
resp #<TCPSocket:0x8065a88> +OK
resp #<TCPSocket:0x80663e8> QUIT
send #<TCPSocket:0x8065a88> QUIT
resp #<TCPSocket:0x8065a88> +OK

USERコマンドで"+OK"が返っているので、MUAがPASSを送りそうなものなのですが。"+OK"がbsfilterまで返って来たがMUAに渡さなかった、という問題かもしれません。
(--debug指定時に、MUAにどんなレスポンスを返したかを表示していないので、そこは直します)

MUAの代りに、telnetを使用して手でPOPのコマンドを入力してみて貰えないでしょうか。
Reply to #25077

Reply to #25081×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: POP proxyの動作について(qmail 1.03) (2006-09-24 05:14 by Anonymous #25084)

越智です。

nabeken様、ご回答ありがとうございます。
telnetで確認してみましたが、非常に不可解な挙動をしています。

telnet localhost 10110
+OK <9776.1159038749@xx.xxxxxxxxx.xx>(pop_proxy by bsfilter)
USER xxxxx@xx.xxxxxxxxx.xx
+OK
PASS xxxx
USERとPASSを入力していくと、PASSのレスポンスが帰ってきません。

Proxy側は
resp #<TCPSocket:0xac5b68> +OK <9746.1159038302@xx.xxxxxxxxx.xx>
resp #<TCPSocket:0xac6af8> USER xxxxx@xx.xxxxxxxxx.xx
send #<TCPSocket:0xac5b68> USER xxxxx@xx.xxxxxxxxx.xx
resp #<TCPSocket:0xac5b68> +OK
Timeout error xx.xxxxxxxxx.xx 110 10110
となります。

このときクライアントでパケットキャプチャした結果です。
S:POPサーバ C:クライアント ->:送信方向
C->S SYN
C<-S SYN+ACK
C->S ACK
C<-S +OK <9746.1159038302@xx.xxxxxxxxx.xx>
C->S ACK
C->S USER xxxxx@xx.xxxxxxxxx.xx
C<-S ACK
C<-S +OK
注)レスポンスをHEXで表すと2b,4f,4b,20,0d,0aでした。
C->S ACK

USERのレスポンス+OKの後、POP Proxyがタイムアウトするまでキャプチャしましたが、
PASSがサーバに送信されていません。

ちなみに、POP Proxyを経由せず直接popサーバへアクセスすると
telnet xx.xxxxxxxxx.xx 110
+OK <9807.1159039010@xx.xxxxxxxxx.xx>
USER xxxxx@xx.xxxxxxxxx.xx
+OK
PASS xxxx
+OK
STAT
+OK 14 160747
QUIT
と、正常な反応を返しています。

ここまでxxxを使って伏字にしていましたが、
telnetでテストしている最中に、間違えて本当に
USER xxxxx@xx.xxxxxxxxx.xx
PASS xxxx
と伏字ではなく上記のままコマンド送ってしまいました。
すると、

resp #<TCPSocket:0xa5dd68> USER xxxxx@xx.xxxxxxxxx.xx
send #<TCPSocket:0xa5dab0> USER xxxxx@xx.xxxxxxxxx.xx
resp #<TCPSocket:0xa5dab0> +OK
resp #<TCPSocket:0xa5dd68> PASS ********
send #<TCPSocket:0xa5dab0> PASS ********
resp #<TCPSocket:0xa5dab0> -ERR authorization failed
resp #<TCPSocket:0xa5dd68> QUIT
send #<TCPSocket:0xa5dab0> QUIT

と、認証エラーの表示がされ正常にPOP Proxyが動作しています。
このことから、いろいろなパターンで試してみますと、
USERにpop_proxy_one()で実装されているPOPコマンドが含まれていると、再現するように思えます。

USER xxxxx@xxxlistxxxx
PASS xxxx

USER list
PASS xxxx

USER quit
このUSERコマンドだけでサーバにFIN+ACKして切断しています。

USER top
PASS xxxx

USER retr
PASS xxxx

以上のコマンドでPASSが送信されない症状が再現します。
他のISPのpopサーバでも再現しました。
修正パッチを作成したいところなのですが、rubyに不慣れなので・・・
お手数ですが、ご確認お願いします。
Reply to #25081

Reply to #25084×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: POP proxyの動作について(qmail 1.03) (2006-09-24 18:57 by nabeken #25094)

すみません。release 1.0.15 で修正しました。
Reply to #25084

Reply to #25094×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: POP proxyの動作について(qmail 1.03) (2006-09-26 01:57 by Anonymous #25125)

越智です。
release 1.0.15で上記問題がないことを確認しました。
素早い対応ありがとうございます。

さっそく運用してみました。
半年分のスパムメールをデータベースに登録したおかげか誤認しそうなメルマガなどは誤認せず、スパムメールだけ排除してくれています。
どうもありがとうございました。
Reply to #25094

Reply to #25125×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login