Imap

From Federal Burro of Information
Revision as of 17:14, 2 May 2012 by David (talk | contribs)
Jump to navigationJump to search

sample client commands:

a01 login $user $password
a02 SELECT INBOX
a03 FETCH  RFC822.HEADER
a04 SEARCH SUBJECT ??
a05 store 1:2 flags \Deleted

sample pine config:

inbox-path={moose.quadratic.net/ssl/user="david@quadratic.net"/novalidate-cert}INBOX

TCPDUMP of imap cnversation:

2 authenticate plain
AHRlc3QxMjNAc2NhbGFyLmNhAHRlc3QxMjM=
3 namespace
4 ID ("name" "Thunderbird" "version" "9.0.1")
5 xlist "" "%"
6 xlist "" "%/%"
7 lsub "" "*"
8 lsub "" "/home/*"
9 list "" "INBOX"
10 list "" "Trash"
11 create "Trash"
12 select "INBOX"
13 myrights "INBOX"
14 getacl "INBOX"
15 getquotaroot "INBOX"
16 UID fetch 367:* (FLAGS)
17 IDLE
DONE
18 noop
19 getquotaroot "INBOX"
20 UID fetch 367:* (FLAGS)
21 UID fetch 368 (UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type)])
22 UID fetch 368 (UID RFC822.SIZE BODY.PEEK[])
23 UID fetch 368 (UID BODY.PEEK[HEADER.FIELDS (Content-Type Content-Transfer-Encoding)] BODY.PEEK[TEXT]<0.2048>)
24 IDLE

that crazy auth string is

authz\0username\0password

base64 encoded. no line return.

authz is what you are logging into see normally this will be nothing.

so the string would be , for a zimbra build where your login is your email:

"\0username@domain.com\0password"

Here is an example of decoding the string so that you can "see" it:

echo -n AHRlc3QxMjNAc2NhbGFyLmNhAHRlc3QxMjM= | base64 -d
$ echo -n AHRlc3QxMjNAc2NhbGFyLmNhAHRlc3QxMjM= | base64 -d | od -c
0000000  \0   t   e   s   t   1   2   3   @   s   c   a   l   a   r   .
0000020   c   a  \0   t   e   s   t   1   2   3
0000032
$

Here is an example of encoding the string for use in a "manual" connection test:

$ echo -e "\0000username@domain.com\0000password" | base64
AHVzZXJuYW1lQGRvbWFpbi5jb20AcGFzc3dvcmQK
$

example command line conversation:

> client says
< server replies
$ openssl s_client -connect server.com:993
<* OK server.com Zimbra IMAP4rev1 server ready
>2 authenticate plain
<+
>AHJvdW5kdHJpcEBhbHBoYS1ncm91cC5jYQB0aWU3QWguSw==
<2 OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ LOGIN-REFERRALS
  MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] AUTHENTICATE completed