alienscience / imapsrv

An IMAP server written in Go
BSD 3-Clause "New" or "Revised" License
48 stars 9 forks source link

add starttls #23

Open MoritzFago opened 9 years ago

EtienneBruines commented 9 years ago

I've started working on this, but I'm not sure if I'm capable enough to finish it.

RFC2595 is the one I'm trying to implement, but it's taking some refactoring (since it needs to modify the connection readers/writers).

alienscience commented 9 years ago

Please carry on if you would like. I am stuck on the getmessage command for at least another month.

Is this helpful: https://github.com/flashmob/go-guerrilla/blob/master/goguerrilla.go#L367:L376

Its the TLS upgrade used by an SMTP server in go. It uses the go TLS library.

EtienneBruines commented 9 years ago

That is pretty much the implementation.

https://github.com/alienscience/imapsrv/blob/master/command.go#L59-L65

EtienneBruines commented 9 years ago

Turns out, using openssl s_client, it seems to work... However, browsers such as geary and thunderbird tend to break...

Somehow they do not respond after the OK message...

The problem

The client does not send a client-handshake during the handshake... The server keeps waiting for it, but the mail clients never send it ...

Solved

Nevermind ... this sub-issue is solved...

I guess it's quite important to send \r\n after the command ... My mistake.