メール入門

12

Click here to load reader

Upload: shuhei-iitsuka

Post on 19-Jun-2015

807 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: メール入門

メール入門

Page 2: メール入門

メールの仕組み

SMTP

POP3

プロバイダ 1 プロバイダ 2

境界 SMTP サーバ

負荷分散のために複数のサーバを用意している。

Page 3: メール入門

MX レコードを引いてSMTP を叩いてみる

$ nslookup -type=mx gmail.comServer: 172.16.0.23Address: 172.16.0.23#53

Non-authoritative answer:gmail.com mail exchanger = 20 alt2.gmail-smtp-in.l.google.com.gmail.com mail exchanger = 30 alt3.gmail-smtp-in.l.google.com.gmail.com mail exchanger = 40 alt4.gmail-smtp-in.l.google.com.gmail.com mail exchanger = 5 gmail-smtp-in.l.google.com.gmail.com mail exchanger = 10 alt1.gmail-smtp-in.l.google.com.

Authoritative answers can be found from:alt3.gmail-smtp-in.l.google.com internet address = 74.125.113.27

Page 4: メール入門

MX レコードを引いてSMTP を叩いてみる

$ rlwrap telnet alt3.gmail-smtp-in.l.google.com 25Trying 74.125.113.27...Connected to alt3.gmail-smtp-in.l.google.com.Escape character is '^]'.220 mx.google.com ESMTP cy3si7427630vdc.109HELO250 mx.google.com at your serviceMAIL FROM: <[email protected]>250 2.1.0 OK cy3si7427630vdc.109RCPT TO: <[email protected]>250 2.1.5 OK cy3si7427630vdc.109DATA354 Go ahead cy3si7427630vdc.109Subject: hogeFrom: hogeTo: hoge

hoge

.250 2.0.0 OK 1318668890 cy3si7427630vdc.109QUIT221 2.0.0 closing connection cy3si7427630vdc.109Connection closed by foreign host.

Page 5: メール入門

メールのヘッダを見てみるDelivered-To: [email protected]: by 10.220.181.4 with SMTP id bw4cs30846vcb; Sat, 15 Oct 2011 01:51:12 -0700 (PDT)Received: by 10.52.176.98 with SMTP id ch2mr12032698vdc.82.1318668671402; Sat, 15 Oct 2011 01:51:11 -0700 (PDT)Return-Path: <[email protected]>Received: from (ec2-175-41-197-166.ap-northeast-1.compute.amazonaws.com. [175.41.197.166]) by mx.google.com with SMTP id g9si7453472vdv.27.2011.10.15.01.50.23; Sat, 15 Oct 2011 01:51:11 -0700 (PDT)Received-SPF: neutral (google.com: 175.41.197.166 is neither permitted nor denied by best guess record for domain of [email protected]) client-ip=175.41.197.166;Authentication-Results: mx.google.com; spf=neutral (google.com: 175.41.197.166 is neither permitted nor denied by best guess record for domain of [email protected]) [email protected]: Sat, 15 Oct 2011 01:51:11 -0700 (PDT)Message-Id: <[email protected]>Subject: hogeTo: hogeFrom: hoge

hoge

Page 6: メール入門

SPAM 対策• 2004 年 : メールトラフィックの 9 割が

SPAM• 第三者中継対策• From 詐称対策• IP アドレスベースブラックリスト• パラノイドチェック– 逆引きの結果と正引きの整合性を見る– ちゃんと逆引きの設定をしておきましょう

Page 7: メール入門

第三者中継

SMTP

POP3

プロバイダ 1 プロバイダ 2

プロバイダ 1 と関係ない人

Page 8: メール入門

第三者中継対策( 送信元として使われる対策 )

• POP before SMTP– POP した後にしか SMTP できない (POP は認

証が必要なので )• SMTP Authentication– SMTP プロトコルの拡張– AUTH

• 送信可能 IP アドレスの範囲指定

Page 9: メール入門

From 詐称対策• From のドメインが確定できれば、メール

アドレスでのフィルタリングが可能になる

• 自ドメインを名乗るメールの信頼性を高める

• SPF (Sender Policy Framework)• Sender ID• DKIM• 逆引き設定と、 From メールアドレスと

の整合性??

Page 10: メール入門

SPF と Sender ID

• TXT レコードに書く• SPF– MAIL FROM の妥当性を使っても良いかどうか– @ IN TXT "v=spf1 ip4:202.172.26.24 -all"– @ IN TXT "v=spf1 include:readyfor.jp -all"

• Sender ID– SPF の拡張

• DKIM– DNS に公開鍵を載せて、署名する

Page 11: メール入門

ブラックリストの解除申請• maps, spamhaus などでは、 EC2 のように

動的に IP アドレスを割り当てるサービスの IP を全部 Spam 登録してる

• パラノイドチェックをして、 OK だったら解除してくれる

• ちゃんと設定して、申請しよう

Page 12: メール入門

で、我々のメールサーバどうする?

• Google Apps を使う– IP アドレスの逆引きとメールアドレスのドメ

インの整合性チェックに引っかかる– SPF を書いておけば大丈夫だったりする?

• メールサーバを自前で立てる– 逆引き申請、ブラックリスト申請めんどくさ

そう– スパムと戦う勇気が必要