<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Feb 12, 2017 at 8:05 AM, Kim Holviala <span dir="ltr"><<a href="mailto:kim@holviala.com" target="_blank">kim@holviala.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 12 Feb 2017, at 14:02, Adam Thompson <<a href="mailto:arthompson1990@gmail.com">arthompson1990@gmail.com</a>> wrote:<br>
><br>
> I wonder if there's any way to have opportunistic tls here (i.e. a starttls<br>
> equivalent)<br>
<br>
</span>I almost started doing STARTTLS for Gophernicus... but it has two huge problems: you can always MITM a "silent" STARTTLS which makes the encryption useless, and it uses the existing TCP connection which makes TLS-wrappers like Stunnel4 hard to do (but I already figured out a way to go around that problem).<br>
<br>
Also, what should the response to STARTTLS be?<br>
<br>
C: opens TCP connection to server<br>
C: STARTTLS<br>
S: WTF OMG OMG IT'S ALIVE!!!!<br>
C: bzzzzz trrr trrr trrr <TLS connection with proper selector request here><br>
S: Happily serving the request<br>
<br>
So what should server answer instead of WTF? Client needs to know the server is OK with the connection, and the client should probably re-request without STARTTLS if the server doesn't understand TLS.<br>
<br>
Sounds a bit complicated to me - but I don't have a better solution either.<br></blockquote><div><br></div><div>This was exactly what I was thinking once on how to support this. I believe it could be done and backwards compatible. Old clients would never send this "special resource request".</div><div><br></div><div>cheers</div><div>James</div></div></div></div>