|
16 | 16 | * backend can restart automatically, it is important that
|
17 | 17 | * we select an algorithm that continues to provide confidentiality
|
18 | 18 | * even if the attacker has the server's private key. Ephemeral
|
19 |
| - * DH (EDH) keys provide this, and in fact provide Perfect Forward |
20 |
| - * Secrecy (PFS) except for situations where the session can |
21 |
| - * be hijacked during a periodic handshake/renegotiation. |
22 |
| - * Even that backdoor can be closed if client certificates |
23 |
| - * are used (since the imposter will be unable to successfully |
24 |
| - * complete renegotiation). |
| 19 | + * DH (EDH) keys provide this and more (Perfect Forward Secrecy |
| 20 | + * aka PFS). |
25 | 21 | *
|
26 | 22 | * N.B., the static private key should still be protected to
|
27 | 23 | * the largest extent possible, to minimize the risk of
|
|
37 | 33 | * session. In this case you'll need to temporarily disable
|
38 | 34 | * EDH by commenting out the callback.
|
39 | 35 | *
|
40 |
| - * ... |
41 |
| - * |
42 |
| - * Because the risk of cryptanalysis increases as large |
43 |
| - * amounts of data are sent with the same session key, the |
44 |
| - * session keys are periodically renegotiated. |
45 |
| - * |
46 | 36 | *-------------------------------------------------------------------------
|
47 | 37 | */
|
48 | 38 |
|
@@ -92,9 +82,6 @@ static const char *SSLerrmessage(void);
|
92 | 82 |
|
93 | 83 | static char *X509_NAME_to_cstring(X509_NAME *name);
|
94 | 84 |
|
95 |
| -/* are we in the middle of a renegotiation? */ |
96 |
| -static bool in_ssl_renegotiation = false; |
97 |
| - |
98 | 85 | static SSL_CTX *SSL_context = NULL;
|
99 | 86 |
|
100 | 87 | /* ------------------------------------------------------------ */
|
@@ -570,37 +557,6 @@ be_tls_write(Port *port, void *ptr, size_t len, int *waitfor)
|
570 | 557 | ssize_t n;
|
571 | 558 | int err;
|
572 | 559 |
|
573 |
| - /* |
574 |
| - * If SSL renegotiations are enabled and we're getting close to the limit, |
575 |
| - * start one now; but avoid it if there's one already in progress. |
576 |
| - * Request the renegotiation 1kB before the limit has actually expired. |
577 |
| - */ |
578 |
| - if (ssl_renegotiation_limit && !in_ssl_renegotiation && |
579 |
| - port->count > (ssl_renegotiation_limit - 1) * 1024L) |
580 |
| - { |
581 |
| - in_ssl_renegotiation = true; |
582 |
| - |
583 |
| - /* |
584 |
| - * The way we determine that a renegotiation has completed is by |
585 |
| - * observing OpenSSL's internal renegotiation counter. Make sure we |
586 |
| - * start out at zero, and assume that the renegotiation is complete |
587 |
| - * when the counter advances. |
588 |
| - * |
589 |
| - * OpenSSL provides SSL_renegotiation_pending(), but this doesn't seem |
590 |
| - * to work in testing. |
591 |
| - */ |
592 |
| - SSL_clear_num_renegotiations(port->ssl); |
593 |
| - |
594 |
| - /* without this, renegotiation fails when a client cert is used */ |
595 |
| - SSL_set_session_id_context(port->ssl, (void *) &SSL_context, |
596 |
| - sizeof(SSL_context)); |
597 |
| - |
598 |
| - if (SSL_renegotiate(port->ssl) <= 0) |
599 |
| - ereport(COMMERROR, |
600 |
| - (errcode(ERRCODE_PROTOCOL_VIOLATION), |
601 |
| - errmsg("SSL failure during renegotiation start"))); |
602 |
| - } |
603 |
| - |
604 | 560 | errno = 0;
|
605 | 561 | n = SSL_write(port->ssl, ptr, len);
|
606 | 562 | err = SSL_get_error(port->ssl, n);
|
@@ -646,28 +602,6 @@ be_tls_write(Port *port, void *ptr, size_t len, int *waitfor)
|
646 | 602 | break;
|
647 | 603 | }
|
648 | 604 |
|
649 |
| - if (n >= 0) |
650 |
| - { |
651 |
| - /* is renegotiation complete? */ |
652 |
| - if (in_ssl_renegotiation && |
653 |
| - SSL_num_renegotiations(port->ssl) >= 1) |
654 |
| - { |
655 |
| - in_ssl_renegotiation = false; |
656 |
| - port->count = 0; |
657 |
| - } |
658 |
| - |
659 |
| - /* |
660 |
| - * if renegotiation is still ongoing, and we've gone beyond the limit, |
661 |
| - * kill the connection now -- continuing to use it can be considered a |
662 |
| - * security problem. |
663 |
| - */ |
664 |
| - if (in_ssl_renegotiation && |
665 |
| - port->count > ssl_renegotiation_limit * 1024L) |
666 |
| - ereport(FATAL, |
667 |
| - (errcode(ERRCODE_PROTOCOL_VIOLATION), |
668 |
| - errmsg("SSL failed to renegotiate connection before limit expired"))); |
669 |
| - } |
670 |
| - |
671 | 605 | return n;
|
672 | 606 | }
|
673 | 607 |
|
|
0 commit comments