270 likes | 958 Views
Internet and Intranet Protocols and Applications Lecture 8: EMAIL 2/21/2000 Vernal equinox + 1 Arthur P. Goldberg Computer Science Department New York University artg@cs.nyu.edu Outline Email structure RFC822 MIME Email transport User agents, Servers, Gateways Push SMTP Pull
E N D
Internet and Intranet Protocols and Applications Lecture 8: EMAIL 2/21/2000 Vernal equinox + 1 Arthur P. Goldberg Computer Science Department New York University artg@cs.nyu.edu
Outline • Email structure • RFC822 • MIME • Email transport • User agents, Servers, Gateways • Push • SMTP • Pull • POP3, IMAP4
RFC822 Headers <Blank line> [Body] Key headers As we’ve discussed … Multipurpose Internet Mail Extensions (MIME) N. Borenstein, N. Freed, RFC1521, 1993 Email body Self-describing, typed object Key Headers MIME-Version Content-Transfer-Encoding – how binary is mapped to ASCII Content-Type Email structure
MIME Content-Types • Hierarchical • Examples Text/Plain Image/Gif Image/Jpeg Application/Octet-stream Application/Postscript Multipart/Mixed • Multipart/Mixed • Multipart separation • boundary="------------C725BD4EC548463C“ • Potentially recursive • Each part described by a MIME type
Mail transport:User agents (UA), Servers, Gateways • Draw a diagram • Multiple UAs may access one mailbox concurrently • Remember IBM’S VM – only ONE login! • Proxies and gateways for security and addressing • Firewall digression and diagram? • Visible in Received: headers
SMTP +----------+ +----------+ +------+ | | | | | User |<-->| | SMTP | | +------+ | Sender- |Commands/Replies| Receiver-| +------+ | SMTP |<-------------->| SMTP | +------+ | File |<-->| | and Mail | |<-->| File | |System| | | | | |System| +------+ +----------+ +----------+ +------+ Sender-SMTP Receiver-SMTP Model for SMTP Use
SMTP • Push email • Goals • Work reliably • Implement easily • Minimum Implementation Commands HELO <SP> <domain> <CRLF> MAIL <SP> FROM:<reverse-path> <CRLF> RCPT <SP> TO:<forward-path> <CRLF> DATA QUIT RSET NOOP
SMTP Data Transmission C: DATA S: 354 Enter mail, end with "." on a line by itself C: Message-ID: <3895F196.816A8F98@cs.nyu.edu> C: Date: Mon, 31 Jan 2000 15:33:26 -0500 C: From: Arthur Goldberg <artg@cs.nyu.edu> C: X-Mailer: Mozilla 4.51 [en] (WinNT; I) C: MIME-Version: 1.0 C: To: me <artg@cs>, Meira Goldberg <lameira@juno.com> C: Subject: testing C: Content-Type: text/plain; charset=us-ascii C: C: a test message C: . S: 250 PAA22834 Message accepted for delivery C: QUIT S: 221 griffin.cs.nyu.edu closing connection
Selected SMTP REPLY CODES (by function groups) 500 Syntax error, command unrecognized 501 Syntax error in parameters or arguments 503 Bad sequence of commands 211 System status, or system help reply 214 Help message 220 <domain> Service ready 221 <domain> Service closing transmission channel 421 <domain> Service t available, closing transmission channel 250 Requested mail action okay, completed 251 User t local; will forward to <forward-path> 450 Requested mail action t taken: mailbox unavailable 451 Requested action aborted: error in processing 452 Requested action t taken: insufficient system storage 552 Requested mail action aborted: exceeded storage allocation 354 Start mail input; end with <CRLF>.<CRLF> 554 Transaction failed
Email Pull Models • RFC 1733, M Crispin, 94 • POP - Offline, IMAP - All Feature Offline Online Dis- ------- connected Can use multiple clients Y Y Minimum use of server connect time Y Y Minimum use of server resources Y Minimum use of client disk resources Y Multiple remote mailboxes Y Y Fast startup Y Mail processing when not online Y Y
Post Office Protocol - Version 3 (POP3) • Pull email • Permit a workstation to dynamically access a maildrop on a server
POP3 States • AUTHORIZATION: TCP connection has been opened • TRANSACTION: client has successfully identified itself and POP3 server has locked and opened the appropriate maildrop • UPDATE: client has issued QUIT from the TRANSACTION state
POP3 Commands, by State • AUTHORIZATION USER name PASS password APOP name digest - ‘digest' is MD5 of the server’s timestamp and a shared SECRET known only to the client and server
POP3 Commands, by State, continued • TRANSACTION STAT - status LIST – list messages UIDL [msg] - unique-id listing RETR msg – retrieve msg DELE msg – delete msg QUIT – enter UPDATE state • UPDATE QUIT – remove messages marked as deleted; release any lock on the maildrop and close the connection
POP3 Scaling • the combination of UIDL not issuing DELE command - provides a weak "maildrop as semi-permanent repository" normally associated with IMAP • Overloads the server • Suggested resolutions • Impose a per-user maildrop storage quota or the like • Enforce a policy limiting mail retention on the server
Internet Message Access Protocol - Version 4rev1 (IMAP) • Supports • manipulation of remote message folders (mailboxes) in a way that is functionally equivalent to local mailboxes • Offline client can resynchronize with the server • Operations • create, delete, and rename mailboxes • check for new messages; remove messages • Parse, search, selectively fetch message attributes, texts, and portions thereof • Access • message sequence numbers or unique identifiers
IMAP4 Message Attributes • Message Sequence Number • Relative position from 1 to the number of messages in the mailbox • Size • Envelope Structure • the [RFC-822] envelope information • Body Structure • parsed representation of the MIME body structure
IMAP4 UIDs • unique identifier validity value (UIVV) • associated with every mailbox • unique identifier validity value MUST increase across sessions • non-persistence problems • mailbox X deleted and a new mailbox X is created later • good value: a 32-bit representation of the mailbox creation date/time • Unique Identifier (UID) • Combination of 32-bit number and UIVV • permanently guaranteed not to refer to any other message in the mailbox
IMAP4 Server States • Non-Authenticated • client MUST supply authentication credentials • avoided if the connection has been pre-authenticated • Authenticated • client MUST select a mailbox • Selected • a mailbox has been selected for access • Logout • the server will close the connection
+--------------------------------------+ |initial connection and server greeting| +--------------------------------------+ || (1) || (2) || (3) VV || || +-----------------+ || || |non-authenticated| || || +-----------------+ || || || (7) || (4) || || || VV VV || || +----------------+ || || | authenticated |<=++ || || +----------------+ || || || || (7) || (5) || (6) || || || VV || || || || +--------+ || || || || |selected|==++ || || || +--------+ || || || || (7) || VV VV VV VV +--------------------------------------+ | logout and close connection | +--------------------------------------+ IMAP4 Server State Transition Diagram (1) connection without pre-authentication (OK greeting) (2) pre-authenticated connection (PREAUTH greeting) (3) rejected connection (BYE greeting) (4) successful LOGIN or AUTHENTICATE command (5) successful SELECT or EXAMINE command (6) CLOSE command, or failed SELECT or EXAMINE command (7) LOGOUT command, server shutdown, or connection closed
IMAP4 Client Commands, by State • Any State • LOGOUT • Non-Authenticated • AUTHENTICATE “authentication mechanism name” • LOGIN username password • Authenticated • SELECT mailbox_name • CREATE mailbox_name • DELETE mailbox_name • SUBSCRIBE mailbox_name • STATUS mailbox_name
IMAP4 Authentication Example S: * OK KerberosV4 IMAP4rev1 Server C: A001 AUTHENTICATE KERBEROS_V4 S: + AmFYig== C: BAcAQU5EUkVXLkNNVS5FRFUAOCAsho84kLN3/IJmrMG+25a4DT +nZImJjnTNHJUtxAA+o0KPKfHEcAFs9a3CL5Oebe/ydHJUwYFd WwuQ1MWiy6IesKvjL5rL9WjXUb9MwT9bpObYLGOKi1Qh S: + or//EoAADZI= C: DiAF5A4gA+oOIALuBkAAmw== S: A001 OK Kerberos V4 authentication successful
IMAP4 Client Commands in Selected State • CHECK - checkpoint the mailbox • CLOSE – remove \Deleted messages, and return to authenticated state • EXPUNGE - remove \Deleted messages • FETCH message_set message_data_item names - get message parts • SEARCH arguments • COPY message_set mailbox_name • STORE arguments – alter message data
cs.nyu.edu Subject: email Date: Mon, 20 Mar 2000 12:55:12 -0500 From: Arthur Goldberg artg@cs.nyu.edu To: "comment@cims" <comment@cims.nyu.edu> Andy It would be handy to have an IMAP4 server manage our email. Have we/you considered that? A From: CIMS Systems Support <comment@cims.nyu.edu> To: artg@cs.nyu.edu, comment@cims.nyu.edu We’ll consider it. Last time we considered it it had serious security problems -andy
Later • SMTP undeliverable mail notification • Software Design • Reliability, Standards compliance, Performance • Deployed system design • Addressing • Manageability • Security • Encryption • PEM • SPAM • Open relays