Thread View: news.software.nntp
12 messages
12 total messages
Started by Julien ÉLIE
Sat, 20 Sep 2008 15:22
Behaviour when STARTTLS fails
Author: Julien ÉLIE
Date: Sat, 20 Sep 2008 15:22
Date: Sat, 20 Sep 2008 15:22
51 lines
2674 bytes
2674 bytes
Hi,
In RFC 4642, we have:
If the TLS negotiation fails, both client and server SHOULD
immediately close the connection. Note that while continuing the
NNTP session is theoretically possible, in practice a TLS negotiation
failure often leaves the session in an indeterminate state;
therefore, interoperability can not be guaranteed.
All right. However, samples do not show how to do that. There is
only an example when the connection still goes on:
[C] STARTTLS
[S] 382 Continue with TLS negotiation
[TLS negotiation is attempted here]
[Following failed negotiation, traffic resumes without TLS]
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] STARTTLS
[S] LIST ACTIVE NEWSGROUPS OVERVIEW.FMT
[S] OVER
[S] .
Therefore, I wonder what is the right way to do that.
If the connection is not closed, the first command will never be understood
because there is no synchronization between the client and the server.
For intance:
STARTTLS
382 Begin TLS negotiation now
LIST ACTIVE.TIMES
500 What?
QUIT
205 Bye!
Can we just close the socket on failure? I assume it is what RFC 4642 suggests
because the server "SHOULD immediately close the connection".
Is it OK not to send 400 just before?
--
Julien ÉLIE
« Je ne suis ni pour ni contre, bien au contraire ! » (Coluche)
Re: Behaviour when STARTTLS fails
Author: Russ Allbery
Date: Sat, 20 Sep 2008 21:22
Date: Sat, 20 Sep 2008 21:22
30 lines
2116 bytes
2116 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:
> Therefore, I wonder what is the right way to do that. If the connection
> is not closed, the first command will never be understood because there
> is no synchronization between the client and the server. For intance:
>
> STARTTLS
> 382 Begin TLS negotiation now
> LIST ACTIVE.TIMES
> 500 What?
> QUIT
> 205 Bye!
Well, if you actually get a mutually detected failure, I think there is
synchronization for that and both sides know when it's failed.
(Otherwise, it wouldn't be even theoretically possible to continue.)
> Can we just close the socket on failure? I assume it is what RFC 4642
> suggests because the server "SHOULD immediately close the connection".
>
> Is it OK not to send 400 just before?
I believe you can just close the connection on failure without any status
code.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Behaviour when STARTTLS fails
Author: Julien ÉLIE
Date: Sat, 20 Sep 2008 21:48
Date: Sat, 20 Sep 2008 21:48
33 lines
2368 bytes
2368 bytes
Hi Russ, >> STARTTLS >> 382 Begin TLS negotiation now >> LIST ACTIVE.TIMES >> 500 What? >> QUIT >> 205 Bye! > > Well, if you actually get a mutually detected failure, I think there is > synchronization for that and both sides know when it's failed. > (Otherwise, it wouldn't be even theoretically possible to continue.) The server normally synchronizes after \r\n so there will only be one exchange which is not understood (the first one -> 500). At one moment indeed, both sides will know STARTTLS failed. Well, I hope :) >> Can we just close the socket on failure? I assume it is what RFC 4642 >> suggests because the server "SHOULD immediately close the connection". >> >> Is it OK not to send 400 just before? > > I believe you can just close the connection on failure without any status > code. It is the safest thing to do. Let's close the connection then. -- Julien ÉLIE « La vie ne vaut rien. Mais rien ne vaut la vie. » (André Malraux)
Re: Behaviour when STARTTLS fails
Author: D. Stussy
Date: Sun, 21 Sep 2008 01:09
Date: Sun, 21 Sep 2008 01:09
33 lines
2260 bytes
2260 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:gb3r4b$k3u$1@news.trigofacile.com... > >> STARTTLS > >> 382 Begin TLS negotiation now > >> LIST ACTIVE.TIMES > >> 500 What? > >> QUIT > >> 205 Bye! > > > > Well, if you actually get a mutually detected failure, I think there is > > synchronization for that and both sides know when it's failed. > > (Otherwise, it wouldn't be even theoretically possible to continue.) > > The server normally synchronizes after \r\n so there will only be > one exchange which is not understood (the first one -> 500). > At one moment indeed, both sides will know STARTTLS failed. Well, I hope :) > > >> Can we just close the socket on failure? I assume it is what RFC 4642 > >> suggests because the server "SHOULD immediately close the connection". > >> > >> Is it OK not to send 400 just before? > > > > I believe you can just close the connection on failure without any status > > code. > > It is the safest thing to do. Let's close the connection then. What else could one do? The connection can't continue, and sending a status code is pointless.
Re: Behaviour when STARTTLS fails
Author: Julien ÉLIE
Date: Sun, 21 Sep 2008 07:26
Date: Sun, 21 Sep 2008 07:26
39 lines
2718 bytes
2718 bytes
Hi D. Stussy,
> What else could one do? The connection can't continue, and sending a status
> code is pointless.
The connection could continue unencrypted, in the same state as it was before
STARTTLS, if both the client and the server fail to negotiate TLS.
It is the example provided by RFC 4642:
[C] STARTTLS
[S] 382 Continue with TLS negotiation
[TLS negotiation is attempted here]
[Following failed negotiation, traffic resumes without TLS]
[C] CAPABILITIES
[S] 101 Capability list:
[S] VERSION 2
[S] READER
[S] STARTTLS
[S] LIST ACTIVE NEWSGROUPS OVERVIEW.FMT
[S] OVER
[S] .
[C] GROUP local.confidential
[S] 483 Encryption or stronger authentication required
[C] GROUP local.private
[S] 400 Closing connection due to lack of security
But I believe it is not that easy: the client will have to send an unknown number
of commands (while the server is still in its negotiating state), then one command
will be answered 500 (in most cases), then we can go on.
Hard to do...
Therefore, it is better to close the connection just after a failed negotiation.
--
Julien ÉLIE
« La vie ne vaut rien. Mais rien ne vaut la vie. » (André Malraux)
Re: Behaviour when STARTTLS fails
Author: Russ Allbery
Date: Sun, 21 Sep 2008 18:31
Date: Sun, 21 Sep 2008 18:31
54 lines
3884 bytes
3884 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:
> The connection could continue unencrypted, in the same state as it was
> before STARTTLS, if both the client and the server fail to negotiate
> TLS. It is the example provided by RFC 4642:
[...]
> But I believe it is not that easy: the client will have to send an
> unknown number of commands (while the server is still in its negotiating
> state), then one command will be answered 500 (in most cases), then we
> can go on.
It also looks like if there ever was any ability to resume after an error,
it's been removed from the TLS protocol. RFC 5246, section 7.2.2:
Error handling in the TLS Handshake protocol is very simple. When an
error is detected, the detecting party sends a message to the other
party. Upon transmission or receipt of a fatal alert message, both
parties immediately close the connection. Servers and clients MUST
forget any session-identifiers, keys, and secrets associated with a
failed connection. Thus, any connection terminated with a fatal
alert MUST NOT be resumed.
Whenever an implementation encounters a condition which is defined as
a fatal alert, it MUST send the appropriate alert prior to closing
the connection. For all errors where an alert level is not
explicitly specified, the sending party MAY determine at its
discretion whether to treat this as a fatal error or not. If the
implementation chooses to send an alert but intends to close the
connection immediately afterwards, it MUST send that alert at the
fatal alert level.
If an alert with a level of warning is sent and received, generally
the connection can continue normally. If the receiving party decides
not to proceed with the connection (e.g., after having received a
no_renegotiation alert that it is not willing to accept), it SHOULD
send a fatal alert to terminate the connection. Given this, the
sending party cannot, in general, know how the receiving party will
behave. Therefore, warning alerts are not very useful when the
sending party wants to continue the connection, and thus are
sometimes omitted. For example, if a peer decides to accept an
expired certificate (perhaps after confirming this with the user) and
wants to continue the connection, it would not generally send a
certificate_expired alert.
Given that, I think the SHOULD NOT in RFC 4642 should be treated as a MUST
NOT.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Behaviour when STARTTLS fails
Author: Julien ÉLIE
Date: Sun, 21 Sep 2008 18:46
Date: Sun, 21 Sep 2008 18:46
15 lines
1789 bytes
1789 bytes
Hi Russ, > It also looks like if there ever was any ability to resume after an error, > it's been removed from the TLS protocol. RFC 5246, section 7.2.2: Thanks a lot for having investigated. Have a nice Sunday, -- Julien ÉLIE « Rien n'est plus facile à apprendre que la géométrie pour peu qu'on en ait besoin. » (Sacha Guitry)
Re: Behaviour when STARTTLS fails
Author: Julien ÉLIE
Date: Wed, 24 Sep 2008 17:39
Date: Wed, 24 Sep 2008 17:39
26 lines
2467 bytes
2467 bytes
Hi Russ,
> It also looks like if there ever was any ability to resume after an error,
> it's been removed from the TLS protocol. RFC 5246, section 7.2.2:
>
> Given that, I think the SHOULD NOT in RFC 4642 should be treated as a MUST
> NOT.
After having carefully reviewed it, I think I cannot submit an errata report
for that because of the difference between fatal and warning messages in
RFC 5246. Even though almost everything is fatal, I see that one:
user_canceled
This handshake is being canceled for some reason unrelated to a
protocol failure. If the user cancels an operation after the
handshake is complete, just closing the connection by sending a
close_notify is more appropriate. This alert should be followed
by a close_notify. This message is generally a warning.
And unfortunately, the connection MAY go on (even though it SHOULD be closed).
--
Julien ÉLIE
« Tu l'as trop écrasé, César, ce Port-Salut. »
Re: Behaviour when STARTTLS fails
Author: Russ Allbery
Date: Wed, 24 Sep 2008 19:00
Date: Wed, 24 Sep 2008 19:00
29 lines
2711 bytes
2711 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:
> After having carefully reviewed it, I think I cannot submit an errata
> report for that because of the difference between fatal and warning
> messages in RFC 5246. Even though almost everything is fatal, I see
> that one:
>
> user_canceled
> This handshake is being canceled for some reason unrelated to a
> protocol failure. If the user cancels an operation after the
> handshake is complete, just closing the connection by sending a
> close_notify is more appropriate. This alert should be followed
> by a close_notify. This message is generally a warning.
>
> And unfortunately, the connection MAY go on (even though it SHOULD be
> closed).
I was having a hard time understanding RFC 5246, but the impression that I
was getting was that once you start establishing STARTTLS, either you
finish or you fail; if you send a warning message instead of an error
message, that means you're going to finish successfully. I couldn't find
any notion of an unsuccessful finish. But I might not be reading it in
sufficient detail or the right way.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Behaviour when STARTTLS fails
Author: Julien ÉLIE
Date: Wed, 24 Sep 2008 19:20
Date: Wed, 24 Sep 2008 19:20
49 lines
3328 bytes
3328 bytes
Hi Russ,
> I was having a hard time understanding RFC 5246, but the impression that I
> was getting was that once you start establishing STARTTLS, either you
> finish or you fail;
I also admit it is not clear at all!
> if you send a warning message instead of an error
> message, that means you're going to finish successfully.
If an alert with a level of warning is sent and received, generally
the connection can continue normally. If the receiving party decides
^^^^^^^^^^^^^^^^^^^^^
not to proceed with the connection (e.g., after having received a
no_renegotiation alert that it is not willing to accept), it SHOULD
send a fatal alert to terminate the connection. Given this, the
sending party cannot, in general, know how the receiving party will
behave. Therefore, warning alerts are not very useful when the
sending party wants to continue the connection, and thus are
sometimes omitted. For example, if a peer decides to accept an
^^^^^^^^^^^^^^^^^
expired certificate (perhaps after confirming this with the user) and
wants to continue the connection, it would not generally send a
^^^^^^^^^^^^^^^^^^^^^^^
certificate_expired alert.
> I couldn't find any notion of an unsuccessful finish.
Fatal => close.
But with warnings, nothing very precise is said :-/
One of the content types supported by the TLS record layer is the
alert type. Alert messages convey the severity of the message
(warning or fatal) and a description of the alert. Alert messages
with a level of fatal result in the immediate termination of the
connection.
...
--
Julien ÉLIE
« Tout homme devrait un jour se marier ;
après tout, le bonheur n'est pas la seule chose dans la vie. »
Re: Behaviour when STARTTLS fails
Author: Russ Allbery
Date: Thu, 25 Sep 2008 01:30
Date: Thu, 25 Sep 2008 01:30
18 lines
2122 bytes
2122 bytes
Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> writes:
>> if you send a warning message instead of an error
>> message, that means you're going to finish successfully.
>
> If an alert with a level of warning is sent and received, generally
> the connection can continue normally. If the receiving party decides
> ^^^^^^^^^^^^^^^^^^^^^
Yeah, I guess I don't know what "can continue normally" means and if a
normal continuation includes the possibility of not negotiating TLS at
all.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Behaviour when STARTTLS fails
Author: Julien ÉLIE
Date: Thu, 25 Sep 2008 16:29
Date: Thu, 25 Sep 2008 16:29
79 lines
5365 bytes
5365 bytes
Some news from the TLS working group :) http://www.ietf.org/mail-archive/web/tls/current/index.html Eric Rescorla: TLS doesn't have any opinion about what you do with the underlying transport. So, as far as TLS is concerned, the underlying transport (TCP) could stay open and you could try to negotiate NNTP on it. It might even work. It's recommended not for the reasons noted above. I wouldn't have a problem with 4462 saying MUST, but I don't think it's required by the logic of TLS. Martin Rex: I have no experience with STARTTLS-style extensions for protocols such as NNTP or HTTP, but I think I know where the "should close down" suggestion" because of the "indeterminate state" of the connection comes from. I also don't see a need for a MUST close down here. The possibility to get back in sync on a connection after a SSL/TLS handshake error (or a fatal SSL alert after a successful handshake) is probably not a feature that most SSL/TLS stacks offer in their APIs because it is not really deterministic. A SSL/TLS stack could try to recv(,,,MSG_PEEK) from the network socket and apply heuristics whether anything that arrived during the timeout might be a leftover SSL record from the failed SSL/TLS handshake (or data) which would need to be cleared from the connection. But it is completely unclear how much SSL/TLS handshake (or data) messages may still be in the network pipe when one side detects a fatal handshake (or data) error and aborts. Even in the successful TLS session closure case, when the connection is gracefully completed with the CloseNotify closure alerts it is common behaviour that the closure alert of one side dies unread in the network pipe. TLS v1.1 (and newer) explicitly mentions this characteristic for the successful closure and describes what would have to be done/changed to reuse a network connection of a _successfully_ closed SSL/TLS communication: Unless some other fatal alert has been transmitted, each party is required to send a close_notify alert before closing the write side of the connection. The other party MUST respond with a close_notify alert of its own and close down the connection immediately, discarding any pending writes. It is not required for the initiator of the close to wait for the responding close_notify alert before closing the read side of the connection. If the application protocol using TLS provides that any data may be carried over the underlying transport after the TLS connection is closed, the TLS implementation must receive the responding close_notify alert before indicating to the application layer that the TLS connection has ended. If the application protocol will not transfer any additional data, but will only close the underlying transport connection, then the implementation MAY choose to close the transport without waiting for the responding close_notify. No part of this standard should be taken to dictate the manner in which a usage profile for TLS manages its data transport, including when connections are opened or closed. I can not think of a good and robust way to clear a network connection from SSL/TLS errors, and even if someone came up with a workable scheme, it would take much to long to be adopted by the installed base and probably not usable/useful for several years. Btw. not all (network) pipes offer "PEEK" and how long do you wait? Interesting answers! -- Julien ÉLIE « À l'école, en algèbre, j'étais du genre Einstein. Mais plutôt Franck qu'Albert. » (Philippe Geluck)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads