DNS and electronic mail Section 9.1.3 in the textbook DNS purposes Originally purpose was to translate hostnames into IP addresses www.csd. is easier to remember than 129.100.23.247 Lets us do load balancing as well DNS history StarEyes:Desktop mike$ cat /etc/hosts ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost Most operating systems have a hosts file which is kept up-to-date locally and relates hostnames to IP addresses Up until 1983, there was one, global hosts file which was mailed out once every few days Surprise! There are scalability issues here DNS architecture 1983: DNS was created, which had a novel property in naming systems: domains Idea: one server would be in control over the naming inside a particular domain. When finding the IP address of a host outside your domain, you need only know the IP address of the server for that domain Distributed, Hierarchical Database Root DNS Servers com DNS servers org DNS servers edu DNS servers yahoo.com DNS servers amazon.com DNS servers pbs.org DNS servers poly.edu umass.edu DNS serversdns servers Client wants IP for www.amazon.com; 1 st approximation:! Client queries a root server to find com DNS server! Client queries com DNS server to get amazon.com DNS server! Client queries amazon.com DNS server to get IP address for www.amazon.com CS357b 62 DNS: Root name servers! contacted by local name server that can not resolve name! root name server: " contacts authoritative name server if name mapping not known " gets mapping " returns mapping to local name server e NASA Mt View, CA f Internet Software C. Palo Alto, CA (and 17 other locations) b USC-ISI Marina del Rey, CA l ICANN Los Angeles, CA a Verisign, Dulles, VA c Cogent, Herndon, VA (also Los Angeles) d U Maryland College Park, MD k RIPE London (also Amsterdam, Frankfurt) g US DoD Vienna, VA h ARL Aberdeen, MD i Autonomica, Stockholm (plus 3 j Verisign, ( 11 locations) other locations) m WIDE Tokyo 13 root name servers worldwide CS357b 63
TLD and Authoritative Servers! Top-level domain (TLD) servers: responsible for com, org, net, edu, etc, and all top-level country domains uk, fr, ca, jp. " Network solutions maintains servers for com TLD " Educause for edu TLD! Authoritative DNS servers: organization s DNS servers, providing authoritative hostname to IP mappings for organization s servers (e.g., Web and mail). " Can be maintained by organization or service provider Local Name Server! Does not strictly belong to hierarchy! Each ISP (residential ISP, company, university) has one. " Also called default name server! When a host makes a DNS query, query is sent to its local DNS server " Acts as a proxy, forwards query into hierarchy. CS357b 64 CS357b 65 Example root DNS server Recursive queries root DNS server 2! Host at cis.poly.edu wants recursive query: 3 IP address for TLD DNS server 2! puts burden of name 3 gaia.cs.umass.edu. 4 resolution on 7 6! First, check locally. 5 contacted name TLD DNS server! Then, check root. Root server notes.edu suffix and local DNS server! heavy load? suggests TLD servers for dns.poly.edu local DNS server.edu. 7 6 dns.poly.edu 4 1 8 iterated query: 5! Check TLD server. This! contacted server 1 8 provides the authoritative authoritative DNS server replies with name of server. dns.cs.umass.edu server to contact authoritative DNS server! Check authoritative requesting host server, and get the IP c i s. p o l y. e d u! I don t know this dns.cs.umass.edu requesting host address! name, but ask this c i s. p o l y. e d u! This uses both iterative gaia.cs.umass.edu server and recursive queries. gaia.cs.umass.edu (Usually the way its done.) CS357b 66 CS357b 67 DNS: caching and updating records! once (any) name server learns mapping, it caches mapping " cache entries timeout (disappear) after some time " TLD servers typically cached in local name servers Thus root name servers not often visited! update/notify mechanisms under design by IETF " RFC 2136 " http://www.ietf.org/html.charters/dnsind-charter.html CS357b 68 DNS records DNS: distributed database storing resource records (RR)! Type=A! Type=NS RR format: ( n a m e, v a l u e, t y p e, t t l ) " name is hostname " value is IP address " name is domain (e.g. foo.com) " value is IP address of authoritative name server for this domain! Type=CNAME " name is alias name for some canonical (the real) name www.ibm.com is really s e r v e r e a s t. b a c k u p 2. i b m. c o m " value is canonical name! Type=MX " value is name of mail server associated with name CS357b 69
DNS protocol, messages DNS protocol : query and reply messages, both with same message format message header! identification: 16 bit # for query, reply to query uses same #! flags: " query or reply " recursion desired " recursion available " reply is authoritative DNS protocol, messages Name, type fields for a query RRs in reponse to query records for authoritative servers additional helpful info that may be used CS357b 70 CS357b 71 Inserting records into DNS! Example: just created startup Network Utopia! Register name networkuptopia.com at a registrar (e.g., Network Solutions) " Need to provide registrar with names and IP addresses of your authoritative name server (pri and secondary) " Registrar inserts two RRs into the com TLD server: (networkutopia.com, dns1.networkutopia.com, NS) ( d n s 1. n e t w o r k u t o p i a. c o m, 2 1 2. 2 1 2. 2 1 2. 1, A )! Put in authoritative server Type A record for www.networkuptopia.com and Type MX record for mail.networkutopia.com.! How do people get the IP address of your Web site? DNS and load balancing We re in charge of our authoritative server (Masters of our Domain) Just return a different CNAME record each time we re queried If we re really fancy we can keep track of which server is the least loaded and return a CNAME for that one CS357b 72 DNS and load balancing How does this fit in with caching? Actually we can return multiple records for a single hostname All of them get cached Leave it up to the browser/whatever to pick one at random Electronic mail One of the oldest (and suckiest) systems currently in use Built around (Simple Mail Transfer Protocol) Transfers mail from one mail server to another mail server Computers that aren t mail servers are a recent phenomenon
From: @ To: bill@ From: @ To: bill@ From: @ To: bill@ From: @ To: bill@ bill
From: @ To: bill@ bill bill New view New view POP3 POP3 Webmail Webmail F: @ T: bill@ New view New view F: @ T: bill@ F: @ T: bill@ POP3 POP3 Webmail Webmail
New view Email components POP3 Webmail F: @ T: bill@ Mail transfer agents Speak and only E.g., sendmail, qmail, exim, Postfix, Microsoft Exchange Mail user agents Speak plus or POP3 E.g., Mail.app, Thunderbird, mutt, Microsoft Outlook, webmail (e.g., SquirrelMail, Sun Java System Communication Express) Simple Mail Transfer Protocol Runs on TCP/25 Closure Every MTA is both a server and client Three stages of connection: Handshaking/ authentication Transfer of messages All communication is human readable Everything must be 7-bit ASCII Status codes For historical reasons, we have two types of status codes Leading status codes: single number E.g., 220 = Service ready, 221 = Connection closing, 354 = Start mail input New status codes class. subject. detail class 2 = Success, class 4 = temporary failure, class 5 = permanent failure subject 1 = addressing status, subject 2 = mailbox status, etc. E.g., 2.1.5 = destination address valid E.g., 5.1.3 = bad syntax for destination address E.g., 4.2.2 = destination mailbox full Server gives both the old status codes and new status codes Why? 250 2.1.5 mburrel@ OK. round-up is a push client-server protocol We re limited to 7-bit ASCII How do email attachments work? is unencrypted and unverified Spam is a big problem
Mail message format Mail message format There is some redundancy between (RFC 821) and mail format (RFC 822) You have to list fill in the to and from twice Sometimes the server will modify (add headers to) a mail : protocol for exchanging email msgs RFC 822: standard for text message format:! header lines, e.g., " To: " From: " Subject: different from commands!! body " the message, ASCI I characters only header body blank line CS357b 52 Received: from harpo.mail.uwo.pri (brutus.mail.uwo.pri [172.29.32.39]) by harpo.mail.uwo.pri (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with E id <0KHF00HWGHNRF9G0@harpo.mail.uwo.pri>; Wed, 01 Apr 2009 11:28:39-0400 (EDT) Received: from swamp.mail.uwo.pri ([172.29.36.41]) by harpo.mail.uwo.pri (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ES id <0KHF00KILHNRJW00@harpo.mail.uwo.pri>; Wed, 01 Apr 2009 11:28:39-0400 (EDT) Received: from mail.service.csd. (name.service.csd. [129.100.23.252]) by swamp.mail.uwo.pri (8.13.1/8.13.1) with E id n31fsba9004932; Wed, 01 Apr 2009 11:28:37-0400 Date: Wed, 01 Apr 2009 11:28:09-0400 From: Cheryl McGrath <cheryl@csd.> Subject: Return of exam materials X-Sender: cheryl@chaplin.csd. To: faculty@csd. Message-id: <6.1.2.0.2.20090401094852.0399d938@chaplin.csd.> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 6.1.2.0 Content-type: text/plain; charset=us-ascii; format=flowed X-Client-Addr: 129.100.23.8 X-Client-Name: dazzle.admin.csd. X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-Spam-Score: 0.00 () [Tag at 5.00] SPF(pass,0) X-CanIt-Geo: ip=129.100.23.252; country=ca; region=on; city=london; postalcode=n6a5b7; latitude=42.9833; longitude=-81.2500; http://maps.google.com/maps?q=42.9833,-81.2500&z=6 X-CanItPRO-Stream: tag_and_pass (inherits from default) X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www. roaringpenguin. com) on 172.29.36.41 Hi there Could everyone bring back any exam materials such as pencils, scantrons etc. which are left from the exams. This way I can see what is needed for the new exam period. thanks Cheryl Cheryl McGrath Undergraduate Secretary Dept of Computer Science University of Western Ontario 519-661-3566, cheryl@csd. Message format: multimedia extensions MIME types Content-Type: type/subtype; parameters! MIME: multimedia mail extension, RFC 2045, 2056! additional lines in msg header declare MIME content type Text! example subtypes: p lain, html Video! example subtypes: m p e g, q u i c k t i m e MIME version method used to encode data multimedia data type, subtype, parameter declaration encoded data F r o m : a l i c e @ c r e p e s. f r T o : b o b @ h a m b u r g e r. e d u S u b j e c t : P i c t u r e o f y u m m y c r e p e. M I M E - V e r s i o n : 1. 0 C o n t e n t - T r a n s f e r - E n c o d i n g : b a s e 6 4 C o n t e n t - T y p e : i m a g e / j p e g base64 encoded data.................................. b a s e 6 4 e n c o d e d d a t a Image! example subtypes: j peg, gif Audio! example subtypes: b asic (8-bit mu-law encoded), 32kadpcm (32 kbps coding) Application! other data that must be processed by reader before viewable! example subtypes: m s w o r d, o c t e t - stream CS357b 53 CS357b 54
Multipart Type F r o m : a l i c e @ c r e p e s. f r T o : b o b @ h a m b u r g e r. e d u Subject: Picture of yummy crepe. M I M E - V e r s i o n : 1. 0 C o n t e n t - T y p e : m u l t i p a r t / m i x e d ; b o u n d a r y = S t a r t O f N e x t P a r t - - S t a r t O f N e x t P a r t D e a r B o b, P l e a s e f i n d a picture of a crepe. - - S t a r t O f N e x t P a r t C o n t e n t - T r a n s f e r - E n c o d i n g : b a s e 6 4 C o n t e n t - T y p e : i m a g e / j p e g b a s e 6 4 e n c o d e d d a t a.................................base64 encoded data - - S t a r t O f N e x t P a r t D o y o u w a n t t h e r e c i p l e? Base64 Used not just in email (MIME) Used any time we want to transfer an octet stream (arbitrary bytes) over a protocol which is not 8-bit clean Map bit-wise from an 8-bit space onto a 6- bit space Why 6 bits? Why not 7? CS357b 55 t
t t K t K t KA t KA t KAd
Mail access protocols access user agent protocol sender s mail server receiver s mail server! : delivery/storage to receiver s server! Mail access protocol: retrieval from server " POP: Post Office Protocol [RFC 1939] authorization (agent <-->server) and download " : Internet Mail Access Protocol [RFC 1730] more features (more complex) manipulation of stored msgs on server " HTTP: Hotmail, Yahoo! Mail, etc. user agent CS357b 56 POP3 protocol authorization phase! client commands: " user: declare username " pass: password! server responses " +OK " -ERR transaction phase, client:! list: list message numbers! retr: retrieve message by number! dele: delete! quit S : + O K P O P 3 s e r v e r r e a d y C: user bob S : + O K C : p a s s h u n g r y S : + O K u s e r s u c c e s s f u l l y l o g g e d o n C : l i s t S : 1 4 9 8 S : 2 9 1 2 S :. C : r e t r 1 S : < m e s s a g e 1 c o n t e n t s > S :. C : d e l e 1 C : r e t r 2 S : < m e s s a g e 2 c o n t e n t s > S :. C : d e l e 2 C : q u i t S : + O K P O P 3 s e r v e r s i g n i n g o f f CS357b 57 POP3 (more) and More about POP3! Previous example uses download and delete mode.! Bob cannot re-read e- mail if he changes client! Download-and-keep : copies of messages on different clients! POP3 is stateless across sessions! Keep all messages in one place: the server! Allows user to organize messages in folders! keeps user state across sessions: " names of folders and mappings between message IDs and folder name CS357b 58 All mail is stored on the mail server The MUA must request to explicitly delete emails extensions allow you to save address books, etc., server side never really caught on due to timing Kind of like 8-tracks What webmail can t do Webmail typically requires that emails be stored unencrypted server-side I ve seen a Firefox plug-in to address this, though it s kind of dodgy Not a huge deal since no one encrypts their email anyway :(