Advertisement

More Related Content

More from Shuhei Iitsuka(20)

Advertisement

メール入門

  1. メール入門
  2. メールの仕組み プロバイダ 1 プロバイダ 2 境界SMTPサーバ 負荷分散のために 複数のサーバを用 意している。 SMTP POP3
  3. MX レコードを引いて SMTP を叩いてみる $ nslookup -type=mx gmail.com Server: 172.16.0.23 Address: 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
  4. MX レコードを引いて SMTP を叩いてみる $ rlwrap telnet alt3.gmail-smtp-in.l.google.com 25 Trying 74.125.113.27... Connected to alt3.gmail-smtp-in.l.google.com. Escape character is '^]'. 220 mx.google.com ESMTP cy3si7427630vdc.109 HELO 250 mx.google.com at your service MAIL FROM: <amachang@amachang.com> 250 2.1.0 OK cy3si7427630vdc.109 RCPT TO: <seijro@gmail.com> 250 2.1.5 OK cy3si7427630vdc.109 DATA 354 Go ahead cy3si7427630vdc.109 Subject: hoge From: hoge To: hoge hoge . 250 2.0.0 OK 1318668890 cy3si7427630vdc.109 QUIT 221 2.0.0 closing connection cy3si7427630vdc.109 Connection closed by foreign host.
  5. メールのヘッダを見てみる Delivered-To: seijro@gmail.com Received: 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: <amachang@amachang.com> Received: from (ec2-175-41-197-166.ap-northeast-1.compute.amazonaws.com. [175.41.197.1 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 gu Authentication-Results: mx.google.com; spf=neutral (google.com: 175.41.197.166 is neither pe Date: Sat, 15 Oct 2011 01:51:11 -0700 (PDT) Message-Id: <4e99497f.e948340a.6648.3bc5SMTPIN_ADDED@mx.google.com> Subject: hoge To: hoge From: hoge hoge
  6. SPAM 対策 • 2004 年: メールトラフィックの 9 割が SPAM • 第三者中継対策 • From 詐称対策 • IP アドレスベースブラックリスト • パラノイドチェック – 逆引きの結果と正引きの整合性を見る – ちゃんと逆引きの設定をしておきましょう
  7. 第三者中継 プロバイダ 1 プロバイダ 2 SMTP POP3 プロバイダ 1 と関係ない人
  8. 第三者中継対策 (送信元として使われる対策) • POP before SMTP – POP した後にしか SMTP できない (POP は認証 が必要なので) • SMTP Authentication – SMTP プロトコルの拡張 – AUTH • 送信可能 IP アドレスの範囲指定
  9. From 詐称対策 • From のドメインが確定できれば、メール アドレスでのフィルタリングが可能にな る • 自ドメインを名乗るメールの信頼性を高 める • SPF (Sender Policy Framework) • Sender ID • DKIM • 逆引き設定と、 From メールアドレスとの
  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 に公開鍵を載せて、署名する
  11. ブラックリストの解除申請 • maps, spamhaus などでは、 EC2 のように 動的に IP アドレスを割り当てるサービス の IP を全部 Spam 登録してる • パラノイドチェックをして、 OK だったら 解除してくれる • ちゃんと設定して、申請しよう
  12. で、我々のメールサーバどうす る? • Google Apps を使う – IP アドレスの逆引きとメールアドレスのドメ インの整合性チェックに引っかかる – SPF を書いておけば大丈夫だったりする? • メールサーバを自前で立てる – 逆引き申請、ブラックリスト申請めんどくさ そう – スパムと戦う勇気が必要
Advertisement