|
11 | 11 | *
|
12 | 12 | *
|
13 | 13 | * IDENTIFICATION
|
14 |
| - * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.33 2003/05/27 17:49:46 momjian Exp $ |
| 14 | + * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.34 2003/06/11 15:05:50 momjian Exp $ |
15 | 15 | *
|
16 | 16 | * Since the server static private key ($DataDir/server.key)
|
17 | 17 | * will normally be stored unencrypted so that the database
|
@@ -124,7 +124,7 @@ static const char *SSLerrmessage(void);
|
124 | 124 | * How much data can be sent across a secure connection
|
125 | 125 | * (total in both directions) before we require renegotiation.
|
126 | 126 | */
|
127 |
| -#define RENEGOTIATION_LIMIT (64 * 1024) |
| 127 | +#define RENEGOTIATION_LIMIT (512 * 1024 * 1024) |
128 | 128 | #define CA_PATH NULL
|
129 | 129 | static SSL_CTX *SSL_context = NULL;
|
130 | 130 | #endif
|
@@ -320,8 +320,11 @@ secure_write(Port *port, void *ptr, size_t len)
|
320 | 320 | elog(COMMERROR, "SSL renegotiation failure");
|
321 | 321 | if (SSL_do_handshake(port->ssl) <= 0)
|
322 | 322 | elog(COMMERROR, "SSL renegotiation failure");
|
323 |
| - port->ssl->state = SSL_ST_ACCEPT; |
324 |
| - if (SSL_do_handshake(port->ssl) <= 0) |
| 323 | + if (port->ssl->state != SSL_ST_OK) |
| 324 | + elog(COMMERROR, "SSL failed to send renegotiation request"); |
| 325 | + port->ssl->state |= SSL_ST_ACCEPT; |
| 326 | + SSL_do_handshake(port->ssl); |
| 327 | + if (port->ssl->state != SSL_ST_OK) |
325 | 328 | elog(COMMERROR, "SSL renegotiation failure");
|
326 | 329 | port->count = 0;
|
327 | 330 | }
|
@@ -639,6 +642,13 @@ initialize_SSL(void)
|
639 | 642 | SSL_CTX_set_tmp_dh_callback(SSL_context, tmp_dh_cb);
|
640 | 643 | SSL_CTX_set_options(SSL_context, SSL_OP_SINGLE_DH_USE | SSL_OP_NO_SSLv2);
|
641 | 644 |
|
| 645 | + /* setup the allowed cipher list */ |
| 646 | + if (SSL_CTX_set_cipher_list(SSL_context, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGH") != 1) |
| 647 | + { |
| 648 | + postmaster_error("unable to set the cipher list (no valid ciphers available)"); |
| 649 | + ExitPostmaster(1); |
| 650 | + } |
| 651 | + |
642 | 652 | /* accept client certificates, but don't require them. */
|
643 | 653 | snprintf(fnbuf, sizeof fnbuf, "%s/root.crt", DataDir);
|
644 | 654 | if (!SSL_CTX_load_verify_locations(SSL_context, fnbuf, CA_PATH))
|
|
0 commit comments