Gnus development mailing list
 help / color / mirror / Atom feed
* TLS v1.3 - Gnus and GnuTLS - Client resets connection
@ 2019-08-08  8:51 Chris Marusich
  2019-08-08  9:53 ` David Engster
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Marusich @ 2019-08-08  8:51 UTC (permalink / raw)
  To: ding, gnutls-help


[-- Attachment #1.1: Type: text/plain, Size: 820 bytes --]

Hi,

I just installed Ubuntu 19.04 fresh onto a machine.  Using Emacs (both
version 26.1 installed via apt, and also version 26.2 installed via
Guix) and Gnus configs that worked on a previous system, I tried setting
up nnimap for Gmail using TLS, but gnus failed to connect to
imap.gmail.com.  The *Messages* output was:

--8<---------------cut here---------------start------------->8---
Opening connection to imap.gmail.com via tls...
Unable to open server nnimap+gmail due to: Process *nnimap* not running
nnimap (gmail) open error: ‘’.  Continue? (y or n) n
Couldn’t open server on gmail
Warning: Unable to open server nnimap+gmail due to: Process *nnimap* not running
--8<---------------cut here---------------end--------------->8---

I also captured the following packets using Wireshark:


[-- Attachment #1.2: unable-to-connect.jpg --]
[-- Type: image/jpeg, Size: 64296 bytes --]

[-- Attachment #1.3: Type: text/plain, Size: 2347 bytes --]


It seems the client aborted the connection by sending an RST packet to
the server.

I found two ways to fix the problem.  One way is to set gnutls-log-level
to 1 (or higher).  The other is to set gnutls-algorithm-priority to
"NORMAL:-VERS-TLS1.3".

If you set gnutls-log-level to 1, you get some interesting output, but
unfortunately none of it describes the problem, since the problem
doesn't occur!  It's surprising that increasing the log level solves the
problem.

If you set gnutls-algorithm-priority to "NORMAL:-VERS-TLS1.3", my
understanding is that you are telling GnuTLS you don't want to use
version 1.3, and then (in my case) Gnus will connect successfully to
imap.gmail.com using TLS v1.2.  I verified that using Wireshark.

This feels similar (but maybe not identical) to the following issue:

http://emacs.1067599.n8.nabble.com/Emacs-gnus-tls-IMAP-connection-problems-with-Google-tp474191p475443.html

There, the author encountered a problem that prevented them from
connecting to a website using TLS v1.3.  They resolved it by setting
gnutls-algorithm-priority like I did, but they were not using Gnus.
Earlier in the same thread, another person reported the exact same issue
as me: they couldn't connect to imap.gmail.com using Gnus, and they also
discovered that the problem went away when they set gnutls-log-level to
2.

Separately, I've also heard that when GnuTLS added support for TLS v1.3,
they made some changes that require callers to change the way they call
GnuTLS.  For example, consider this:

https://nikmav.blogspot.com/2018/05/gnutls-and-tls-13.html

"Post handshake authentication

[...] In GnuTLS the implementation relies on a new non-fatal error code
which must be handled by the client application. [...]"

I don't know if post handshake authentication has anything to do with
the error I saw (I have no reason to believe that it does), but I
mention this because it makes me wonder if perhaps Gnus needs to be
updated to play nicely with GnuTLS' implementation of TLS v1.3.

Another possibility is that Gmail's IMAP server is misbehaving, but I
don't know if the evidence supports that conclusion at this time.

Thoughts?  I'm glad I have a work-around, but if there's anything I can
do to help resolve the actual problem, please let me know.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: TLS v1.3 - Gnus and GnuTLS - Client resets connection
  2019-08-08  8:51 TLS v1.3 - Gnus and GnuTLS - Client resets connection Chris Marusich
@ 2019-08-08  9:53 ` David Engster
  2019-08-08 12:02   ` Noam Postavsky
  2019-08-08 16:04   ` Chris Marusich
  0 siblings, 2 replies; 4+ messages in thread
From: David Engster @ 2019-08-08  9:53 UTC (permalink / raw)
  To: Chris Marusich; +Cc: ding, gnutls-help

Chris Marusich writes:
> I don't know if post handshake authentication has anything to do with
> the error I saw (I have no reason to believe that it does), but I
> mention this because it makes me wonder if perhaps Gnus needs to be
> updated to play nicely with GnuTLS' implementation of TLS v1.3.
>
> Another possibility is that Gmail's IMAP server is misbehaving, but I
> don't know if the evidence supports that conclusion at this time.
>
> Thoughts?  I'm glad I have a work-around, but if there's anything I can
> do to help resolve the actual problem, please let me know.

Yes, a lot of people doing TLS connections in Emacs are currently
struggling with this. For details, see this bug report:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341

This will be fixed in Emacs 27 (or maybe another Emacs 26 point
release, whichever comes first).

-David



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: TLS v1.3 - Gnus and GnuTLS - Client resets connection
  2019-08-08  9:53 ` David Engster
@ 2019-08-08 12:02   ` Noam Postavsky
  2019-08-08 16:04   ` Chris Marusich
  1 sibling, 0 replies; 4+ messages in thread
From: Noam Postavsky @ 2019-08-08 12:02 UTC (permalink / raw)
  To: David Engster; +Cc: Chris Marusich, ding, gnutls-help

On Thu, 8 Aug 2019 at 07:08, David Engster <deng@randomsample.de> wrote:

> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341
>
> This will be fixed in Emacs 27 (or maybe another Emacs 26 point
> release, whichever comes first).

26.3 will come first; it should already be fixed in the 26.2.90 pretest.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: TLS v1.3 - Gnus and GnuTLS - Client resets connection
  2019-08-08  9:53 ` David Engster
  2019-08-08 12:02   ` Noam Postavsky
@ 2019-08-08 16:04   ` Chris Marusich
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Marusich @ 2019-08-08 16:04 UTC (permalink / raw)
  To: David Engster; +Cc: Noam Postavsky, ding, gnutls-help

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

Hi David and Noam,

Thank you for the quick replies!

David Engster <deng@randomsample.de> writes:

> Yes, a lot of people doing TLS connections in Emacs are currently
> struggling with this. For details, see this bug report:
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341

Ah!  I should have checked the Emacs bugs first.  Sorry about that, and
thank you for pointing me to this.  It looks like my bug!

Noam Postavsky <npostavs@gmail.com> writes:

> On Thu, 8 Aug 2019 at 07:08, David Engster <deng@randomsample.de> wrote:
>
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341
>>
>> This will be fixed in Emacs 27 (or maybe another Emacs 26 point
>> release, whichever comes first).
>
> 26.3 will come first; it should already be fixed in the 26.2.90
> pretest.

That's great news!  I'll keep my eye out for the next release.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-08 16:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08  8:51 TLS v1.3 - Gnus and GnuTLS - Client resets connection Chris Marusich
2019-08-08  9:53 ` David Engster
2019-08-08 12:02   ` Noam Postavsky
2019-08-08 16:04   ` Chris Marusich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).