Re: SSL renegotiation
От | Alvaro Herrera |
---|---|
Тема | Re: SSL renegotiation |
Дата | |
Msg-id | 20130920211805.GD4832@eldon.alvh.no-ip.org обсуждение исходный текст |
Ответ на | SSL renegotiation (Alvaro Herrera <alvherre@2ndquadrant.com>) |
Ответы |
Re: SSL renegotiation
|
Список | pgsql-hackers |
Here's the patch I propose to handle renegotiation cleanly. I noticed in testing that SSL_renegotiate_pending() doesn't seem to actually work --- if I throw an ereport(FATAL) at the point where I expect the renegotiation to be complete, it always dies; even if I give it megabytes of extra traffic while waiting for the renegotiation to complete. I suspect this is an OpenSSL bug. Instead, in this patch I check the internal renegotiation counter: grab its current value when starting the renegotiation, and consider it complete when the counter has advanced. This works fine. Another thing not covered by the original code snippet I proposed upthread is to avoid renegotiating when there was a renegotiation in progress. This bug has been observed in the field. Per discussion, I made it close the connection with a FATAL error if the limit is reached and the renegotiation hasn't taken place. To do otherwise is not acceptable for a security PoV. Sean Chittenden mentioned that when retrying the handshake, we should be careful to only do it a few times, not forever, to avoid a malfeasant from grabbing hold of a connection indefinitely. I've added that too, hardcoding the number of retries to 20. Also, I made this code request a renegotiation slightly before the limit is actually reached. I noticed that in some cases some traffic can go by before the renegotiation is actually completed. The difference should be pretty minimal. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: