Pine, IMAP, and SSH (SSH, The Secure Shell: The Definitive Gu...
Pine, IMAP, and SSH (SSH, The Secure Shell: The Definitive Gu...
Pine, IMAP, and SSH (SSH, The Secure Shell: The Definitive Gu...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Pine</strong>, <strong>IMAP</strong>, <strong>and</strong> <strong>SSH</strong> (<strong>SSH</strong>, <strong>The</strong> <strong>Secure</strong> <strong>Shell</strong>: <strong>The</strong> <strong>Definitive</strong> <strong>Gu</strong>ide)of 8http://www.hn.edu.cn/book/NetWork/NetworkingBookshelf_2ndEd/ssh...8/3/2005 2:16 PMFigure 11-10. <strong>Pine</strong>/<strong>IMAP</strong> over <strong>SSH</strong>, preauthenticatedHere's a sample session that invokes an <strong>IMAP</strong> server, imapd, through inetd so it runs as root:server% telnet localhost imap* OK localhost <strong>IMAP</strong>4rev1 v12.261 server ready0 login res password'1 select inbox* 3 EXISTS* 0 RECENT* OK [UIDVALIDITY 964209649] UID validity status* OK [UIDNEXT 4] Predicted next UID* FLAGS (\Answered \Flagged \Deleted \Draft \Seen)* OK [PERMANENTFLAGS (\* \Answered \Flagged \Deleted \Draft \Seen)] Permanent flags1 OK [READ-WRITE] SELECT completed2 logout* BYE imap.example.com <strong>IMAP</strong>4rev1 server terminating connection2 OK LOGOUT completedAlternatively, in preauthenticated mode, the <strong>IMAP</strong> server assumes that authentication has already been doneby the program that started the server <strong>and</strong> that it already has the necessary rights to access the user's mailbox.If you invoke imapd on the comm<strong>and</strong> line under a nonroot uid, imapd assumes you have alreadyauthenticated <strong>and</strong> opens your email inbox. You can then type <strong>IMAP</strong> comm<strong>and</strong>s <strong>and</strong> access your mailboxwithout authentication:server% /usr/local/sbin/imapd* PREAUTH imap.example.com <strong>IMAP</strong>4rev1 v12.261 server ready0 select inbox* 3 EXISTS* 0 RECENT* OK [UIDVALIDITY 964209649] UID validity status* OK [UIDNEXT 4] Predicted next UID* FLAGS (\Answered \Flagged \Deleted \Draft \Seen)* OK [PERMANENTFLAGS (\* \Answered \Flagged \Deleted \Draft \Seen)] Permanent flags0 OK [READ-WRITE] SELECT completed1 logout* BYE imap.example.com <strong>IMAP</strong>4rev1 server terminating connection1 OK LOGOUT completedNotice the PREAUTH response at the beginning of the session, indicating pre-authenticated mode. It is followedby the comm<strong>and</strong> select inbox, which causes the <strong>IMAP</strong> server implicitly to open the inbox of the currentuser without dem<strong>and</strong>ing authentication.Now, how does all this relate to <strong>Pine</strong>? When instructed to access an <strong>IMAP</strong> mailbox, <strong>Pine</strong> first attempts to loginto the <strong>IMAP</strong> host using rsh <strong>and</strong> to run a preauthenticated instance of imapd directly. If this succeeds, <strong>Pine</strong>then converses with the <strong>IMAP</strong> server over the pipe to rsh <strong>and</strong> has automatic access to the user's remote inboxwithout further authentication. This is a good idea <strong>and</strong> very convenient; the only problem is that rsh is veryinsecure. However, you can make <strong>Pine</strong> use <strong>SSH</strong> instead.