Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Better TLS story #127

Open
1 task
duesee opened this issue Feb 20, 2024 · 0 comments
Open
1 task

feat: Better TLS story #127

duesee opened this issue Feb 20, 2024 · 0 comments

Comments

@duesee
Copy link
Owner

duesee commented Feb 20, 2024

How do we want our users to use TLS? imap-flow can be used with anything that is AsyncRead + AsyncWrite. Thus, we don't dictate any technology for now. Still, I think we need to think -- at some layer -- how to make usage of TLS easy and usage of plaintext "ugly" (by putting insecure, danger, ... somewhere). When we do so, we can provide good TLS defaults, i.e., use ALPN, SNI, etc.

Question: What layer should it be? One could say that TLS needs to be done in imap-flow due to STARTTLS. But I would argue that we 1) should try to avoid implementing STARTTLS as long as possible (asking stupid questions like "Do you really need it?"), and 2) implement it as an isolated connection "prefix".

I.e., ...

let stream = Tcp::connect();

// No real IMAP implementation! Only ...
//   1) consume a line (greeting bytes, don't care)
//   2) send "A STARTTLS"
//   3) consume a line (response bytes, don't care)
//   4) TLS handshake
let stream = ImapStartTls::connect(stream);

Idea is: We do expect a very simple STARTTLS handshake. If anything unexpected happens, step 4 will fail anyway. It could be required to do a bit of response checking, i.e., consume lines until "A OK " was found. But we don't want to do any IMAP processing here as everything we may learn MUST be discarded anyway.

Related

@duesee duesee moved this to Blocked in imap-next Feb 21, 2024
@duesee duesee added this to the 9. Reworked: Higher-level, async-first, IMAP library for client- and server milestone Apr 6, 2024
@duesee duesee modified the milestones: 9.1 -- Higher-level, async-first, IMAP library for client- and server, 14. Release low- to high-level IMAP stack Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Blocked
Development

No branches or pull requests

1 participant