1 / 18

計算機網路實驗

計算機網路實驗. 實驗三. 指導教授 : 林風 助教 : TA221, 李國禎 Email: 實驗講解時間 : 週三中午 12:20 實驗地點 : R202 PTT 討論版 : CSIE_R221 課程網頁 : http://eraser.csie.ntu.edu.tw/courses/cnl/95/. 本學期實驗預計 Deadline. 2/27 課程介紹 + 講解實驗一 3/17 講解實驗二 3/19 實驗一截止 4/7 講解實驗三 4/10 實驗二截止 , 迎接期中考 4/28 介紹期末 Project 5/1 實驗三截止

kaden-gomez
Télécharger la présentation

計算機網路實驗

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 計算機網路實驗 實驗三

  2. 指導教授: 林風 • 助教: TA221, 李國禎 • Email: • 實驗講解時間: 週三中午12:20 • 實驗地點: R202 • PTT 討論版: CSIE_R221 • 課程網頁: http://eraser.csie.ntu.edu.tw/courses/cnl/95/

  3. 本學期實驗預計 Deadline • 2/27 課程介紹+講解實驗一 • 3/17 講解實驗二 • 3/19 實驗一截止 • 4/7 講解實驗三 • 4/10實驗二截止, 迎接期中考 • 4/28 介紹期末Project • 5/1實驗三截止 • 5/2~5/7 提出期末Project名稱及大概內容 • 6/11 期末實驗截止, 迎接期末考週

  4. 實驗三的目標 • 設計一個反垃圾郵件機制 • 偵測垃圾郵件 • 寄件者/來源黑名單; 標題; 內容; 信件到達間隔時間 • 在垃圾郵件標題中 • 加入Tag • 在 header 裡加上一個欄位,例如:X-Spam-Flag: Yes • 直接刪除 • 提供一個收發信網頁界面(修改現有的或自己寫)去收信演示你的垃圾郵件偵測效果, 但是不准使用套件裏的任何antispam功能

  5. 注意事項 • 判斷垃圾郵件的方法可以參考, 但是不得使用任何Anti-SPAM的相關套件,例如SpamAssassin或是Procmail等 • Anti-SPAM請務必自己做

  6. 實驗設備 • 設備 • 一台Mail Server • 一台Client • Hub

  7. 實驗預習 • Unix Programming : C++, Perl, … • MySQL:黑名單白名單可以存進資料庫 • Postfix Mail Server 架設

  8. 簡單測試 • 助教演示 and/or 提問

  9. 實驗步驟1 • Setup your mail server (Postfix) • Test your mail server (把操作結果寫在結報裡) • 請解釋 HELO, MAIL FROM:, RCPT TO:, DATA 的指令的用途以及在整封mail中分別會記錄在哪裡。 • 請解釋 mail header 中 From, Return-Path:, Received:, From:, To:, Subject:, Date: 等欄位的值是何時以及如何產生的。 • 有些郵件的 Received: 欄位有很多行,為什麼?它們的前後關係為何? • 哪些 mail header 中的值是無法假造的?(請說明哪個欄位的什麼值)

  10. 實驗步驟2 • Setup the mailbox_command parameter • /etc/postfix/main.cf (Config) • mailbox_command= [你的程式所在] • mailbox_command = /usr/bin/procmail (僅參考,禁用) • /usr/share/postfix/main.cf.dist (重要範例)

  11. 實驗步驟3 • 你的程式必須做以下的事: • 從 stdin 讀取 mail (包括 header 與 body) • 判斷這封信是不是廣告信,如果是的話,做某些處理 • 判斷這封信是寄給誰的 • 為了防止多個程序同時修改 /var/mail/ta221 (即 ta221 的信箱),Lock /var/mail/ta221 (參考: man flock) • 把信件內容 (包括 header 與 body) 接在 /var/mail/[帳號] 的最後 • Unlock /var/mail/[帳號]

  12. 實驗步驟4 • 判斷廣告信的方法:自由發揮。常見的有下列幾種方式: • 黑名單、白名單 • 搜尋關鍵字 • 用許多 heuristics 評分,分數超過某個值的即判斷為廣告信 (可參考 SpamAssassin 的 list of tests) • 檢查Header, 使用者是否來自合法Mail Server • 連續寄信時間太密集=>病毒造成 • 處理廣告信的方法:自由發揮。投影片第四頁規定的三項是必備的。

  13. 實驗步驟5 • 簡單的收信寄信介面 • 信件標題 • 寄件者 • 收件者 • 信件大小 • 刪除信件按鈕 • 寄信按鈕 • Bonus?有任何建議作為 Bonus 的功能立即提出 (例如: 你的程式和收信網頁介面可以讓使用者自行設計 Filter)

  14. 實驗結報 • 說明實驗步驟二的相關問題解答 • 郵件伺服器的安裝及設定 • 說明你的Email Anti-Spam Mechanism的程式流程 • 說明設計之判斷廣告信的方法(包括postfix設定和mailbox_command指向的程式) • 例如 Postfix 提供一個機制,強迫使用 SMTP 送信的過程中一定要使用 HELO/EHLO (這樣有什麼好處?) • 說明程式處理廣告信之方式(附code) • 其他(Bonus等不在實驗基本要求上的額外相關工作)

  15. 以下是從系上DHCP server底下的使用者大量寄出去的廣告信(dst_port=25); 試問:a) 這封信是從哪裡送到哪裡? b) 這封信哪些欄位是郵件伺服器(合法MTA)填的? 哪些欄位是使用者(可能是病毒)填的? c) DHCP server 如何防止這樣的信件送出 From qvfqafsvf@bossvan.com Tue Apr 1 11:30:48 2008 Return-Path: <qvfqafsvf@bossvan.com> X-Original-To: sblack@internetmci.com Received: from wlan.csie.ntu.edu.tw (wlan.csie.ntu.edu.tw [140.112.30.84]) by pandora.secsup.org (Postfix) with ESMTP id 8072D107B472 for <sblack@internetmci.com>; Tue, 1 Apr 2008 08:40:39 +0000 (GMT) Received: from [140.112.30.84] by m1.dnsix.com; Tue, 1 Apr 2008 16:40:40+0800 信件內容尚未結束, 請接續下一頁

  16. Message-ID: <01c89417$1eaef400$541e708c@qvfqafsvf> From: "Leanne Goldman" <qvfqafsvf@bossvan.com> To: <sblack@internetmci.com> Subject: Re: Re: Hi Date: Tue, 1 Apr 2008 16:40:40 +0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-Msmail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.1830 X-Mimeole: Produced By Microsoft MimeOLE V6.00.3790.1830 X-Sender-Ip: 140.112.30.84 X-Asn: 17716 X-Cidr: 140.112.0.0/17 You can control your weight. It is as easy, as black and white.Buy online! http://www.toiblef.net/?grnnfpjoxzp

  17. 去年同學的建議 • 問: 建議若能給予每個實驗機一個真實IP,使其能實際架設DNS或是上層的DNS SERVER能夠配合給予domain name的話,本次實驗作出來的server 應更有實用性也更便於測試。 • 答: 暫時性的domain name, ubuntu可以在 /etc/hosts設定, 如果要寄信到網內IP, 可以這樣作: RCPT TO: <cnl15@[192.168.16.xx]>

  18. Reference • Postfix • http://linux.vbird.org/linux_server/0380mail.php • http://www.weithenn.idv.tw/cgi-bin/wiki.pl/OpenLDAP-Postfix_With_SASL2_SMTP_Auth_%E8%A8%AD%E5%AE%9A • http://vbb.twftp.org/archive/index.php/t-2067.html

More Related