SlideShare ist ein Scribd-Unternehmen logo
1 von 12
メール入門
メールの仕組み
     プロバイダ 1                プロバイダ 2




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



                     SMTP
                     POP3
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
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.
メールのヘッダを見てみる
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
SPAM 対策
• 2004 年: メールトラフィックの 9 割が
  SPAM
• 第三者中継対策
• From 詐称対策
• IP アドレスベースブラックリスト
• パラノイドチェック
 – 逆引きの結果と正引きの整合性を見る
 – ちゃんと逆引きの設定をしておきましょう
第三者中継
       プロバイダ 1            プロバイダ 2




                   SMTP
                   POP3

プロバイダ 1 と関係ない人
第三者中継対策
    (送信元として使われる対策)
• POP before SMTP
  – POP した後にしか SMTP できない (POP は認証
    が必要なので)
• SMTP Authentication
  – SMTP プロトコルの拡張
  – AUTH
• 送信可能 IP アドレスの範囲指定
From 詐称対策
• From のドメインが確定できれば、メール
  アドレスでのフィルタリングが可能にな
  る
• 自ドメインを名乗るメールの信頼性を高
  める
• SPF (Sender Policy Framework)
• Sender ID
• DKIM
• 逆引き設定と、 From メールアドレスとの
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 に公開鍵を載せて、署名する
ブラックリストの解除申請
• maps, spamhaus などでは、 EC2 のように
  動的に IP アドレスを割り当てるサービス
  の IP を全部 Spam 登録してる
• パラノイドチェックをして、 OK だったら
  解除してくれる
• ちゃんと設定して、申請しよう
で、我々のメールサーバどうす
        る?
• Google Apps を使う
  – IP アドレスの逆引きとメールアドレスのドメ
    インの整合性チェックに引っかかる
  – SPF を書いておけば大丈夫だったりする?
• メールサーバを自前で立てる
  – 逆引き申請、ブラックリスト申請めんどくさ
    そう
  – スパムと戦う勇気が必要

Weitere ähnliche Inhalte

Mehr von Shuhei Iitsuka

Inferring win–lose product network from user behavior
Inferring win–lose product network from user behaviorInferring win–lose product network from user behavior
Inferring win–lose product network from user behaviorShuhei Iitsuka
 
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会Shuhei Iitsuka
 
Procedural modeling using autoencoder networks
Procedural modeling using autoencoder networksProcedural modeling using autoencoder networks
Procedural modeling using autoencoder networksShuhei Iitsuka
 
Generating sentences from a continuous space
Generating sentences from a continuous spaceGenerating sentences from a continuous space
Generating sentences from a continuous spaceShuhei Iitsuka
 
ウェブサイト最適化のためのバリエーション自動生成システム
ウェブサイト最適化のためのバリエーション自動生成システムウェブサイト最適化のためのバリエーション自動生成システム
ウェブサイト最適化のためのバリエーション自動生成システムShuhei Iitsuka
 
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...Shuhei Iitsuka
 
Machine learning meets web development
Machine learning meets web developmentMachine learning meets web development
Machine learning meets web developmentShuhei Iitsuka
 
Python と Xpath で ウェブからデータをあつめる
Python と Xpath で ウェブからデータをあつめるPython と Xpath で ウェブからデータをあつめる
Python と Xpath で ウェブからデータをあつめるShuhei Iitsuka
 
リミックスからはじめる DTM 入門
リミックスからはじめる DTM 入門リミックスからはじめる DTM 入門
リミックスからはじめる DTM 入門Shuhei Iitsuka
 
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...Shuhei Iitsuka
 
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web DataAsia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web DataShuhei Iitsuka
 
【DBDA 勉強会 2013 夏】Doing Bayesian Data Analysis Chapter 4: Bayes’ Rule
【DBDA 勉強会 2013 夏】Doing Bayesian Data Analysis Chapter 4: Bayes’ Rule【DBDA 勉強会 2013 夏】Doing Bayesian Data Analysis Chapter 4: Bayes’ Rule
【DBDA 勉強会 2013 夏】Doing Bayesian Data Analysis Chapter 4: Bayes’ RuleShuhei Iitsuka
 
UT Startup Gym で人生が変わった話
UT Startup Gym で人生が変わった話UT Startup Gym で人生が変わった話
UT Startup Gym で人生が変わった話Shuhei Iitsuka
 
ウェブサイトで収益を得る
ウェブサイトで収益を得るウェブサイトで収益を得る
ウェブサイトで収益を得るShuhei Iitsuka
 
HTML で自己紹介ページをつくる
HTML で自己紹介ページをつくるHTML で自己紹介ページをつくる
HTML で自己紹介ページをつくるShuhei Iitsuka
 
データベースを使おう
データベースを使おうデータベースを使おう
データベースを使おうShuhei Iitsuka
 
ウェブサービスの企画とデザイン
ウェブサービスの企画とデザインウェブサービスの企画とデザイン
ウェブサービスの企画とデザインShuhei Iitsuka
 
データベースを使おう
データベースを使おうデータベースを使おう
データベースを使おうShuhei Iitsuka
 
第3期キックオフ説明会+勉強会
第3期キックオフ説明会+勉強会 第3期キックオフ説明会+勉強会
第3期キックオフ説明会+勉強会 Shuhei Iitsuka
 
かんたん Twitter アプリをつくろう
かんたん Twitter アプリをつくろう かんたん Twitter アプリをつくろう
かんたん Twitter アプリをつくろう Shuhei Iitsuka
 

Mehr von Shuhei Iitsuka (20)

Inferring win–lose product network from user behavior
Inferring win–lose product network from user behaviorInferring win–lose product network from user behavior
Inferring win–lose product network from user behavior
 
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
バリエーションの提示がもたらす長期的効果に着目したウェブサイト最適化手法 @第31回人工知能学会全国大会
 
Procedural modeling using autoencoder networks
Procedural modeling using autoencoder networksProcedural modeling using autoencoder networks
Procedural modeling using autoencoder networks
 
Generating sentences from a continuous space
Generating sentences from a continuous spaceGenerating sentences from a continuous space
Generating sentences from a continuous space
 
ウェブサイト最適化のためのバリエーション自動生成システム
ウェブサイト最適化のためのバリエーション自動生成システムウェブサイト最適化のためのバリエーション自動生成システム
ウェブサイト最適化のためのバリエーション自動生成システム
 
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-E...
 
Machine learning meets web development
Machine learning meets web developmentMachine learning meets web development
Machine learning meets web development
 
Python と Xpath で ウェブからデータをあつめる
Python と Xpath で ウェブからデータをあつめるPython と Xpath で ウェブからデータをあつめる
Python と Xpath で ウェブからデータをあつめる
 
リミックスからはじめる DTM 入門
リミックスからはじめる DTM 入門リミックスからはじめる DTM 入門
リミックスからはじめる DTM 入門
 
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
【DBDA 勉強会 2013 夏】Chapter 12: Bayesian Approaches to Testing a Point (‘‘Null’’...
 
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web DataAsia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
Asia Trend Map: Forecasting “Cool Japan” Content Popularity on Web Data
 
【DBDA 勉強会 2013 夏】Doing Bayesian Data Analysis Chapter 4: Bayes’ Rule
【DBDA 勉強会 2013 夏】Doing Bayesian Data Analysis Chapter 4: Bayes’ Rule【DBDA 勉強会 2013 夏】Doing Bayesian Data Analysis Chapter 4: Bayes’ Rule
【DBDA 勉強会 2013 夏】Doing Bayesian Data Analysis Chapter 4: Bayes’ Rule
 
UT Startup Gym で人生が変わった話
UT Startup Gym で人生が変わった話UT Startup Gym で人生が変わった話
UT Startup Gym で人生が変わった話
 
ウェブサイトで収益を得る
ウェブサイトで収益を得るウェブサイトで収益を得る
ウェブサイトで収益を得る
 
HTML で自己紹介ページをつくる
HTML で自己紹介ページをつくるHTML で自己紹介ページをつくる
HTML で自己紹介ページをつくる
 
データベースを使おう
データベースを使おうデータベースを使おう
データベースを使おう
 
ウェブサービスの企画とデザイン
ウェブサービスの企画とデザインウェブサービスの企画とデザイン
ウェブサービスの企画とデザイン
 
データベースを使おう
データベースを使おうデータベースを使おう
データベースを使おう
 
第3期キックオフ説明会+勉強会
第3期キックオフ説明会+勉強会 第3期キックオフ説明会+勉強会
第3期キックオフ説明会+勉強会
 
かんたん Twitter アプリをつくろう
かんたん Twitter アプリをつくろう かんたん Twitter アプリをつくろう
かんたん Twitter アプリをつくろう
 

メール入門

  • 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 を書いておけば大丈夫だったりする? • メールサーバを自前で立てる – 逆引き申請、ブラックリスト申請めんどくさ そう – スパムと戦う勇気が必要