mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Support TLS handshake directly without SSLRequest negotiation
By skipping SSLRequest, you can eliminate one round-trip when establishing a TLS connection. It is also more friendly to generic TLS proxies that don't understand the PostgreSQL protocol. This is disabled by default in libpq, because the direct TLS handshake will fail with old server versions. It can be enabled with the sslnegotation=direct option. It will still fall back to the negotiated TLS handshake if the server rejects the direct attempt, either because it is an older version or the server doesn't support TLS at all, but the fallback can be disabled with the sslnegotiation=requiredirect option. Author: Greg Stark, Heikki Linnakangas Reviewed-by: Matthias van de Meent, Jacob Champion
This commit is contained in:
@@ -235,7 +235,8 @@ typedef enum
|
||||
#define ENC_ERROR 0
|
||||
#define ENC_PLAINTEXT 0x01
|
||||
#define ENC_GSSAPI 0x02
|
||||
#define ENC_NEGOTIATED_SSL 0x04
|
||||
#define ENC_DIRECT_SSL 0x04
|
||||
#define ENC_NEGOTIATED_SSL 0x08
|
||||
|
||||
/* Target server type (decoded value of target_session_attrs) */
|
||||
typedef enum
|
||||
@@ -394,6 +395,8 @@ struct pg_conn
|
||||
char *keepalives_count; /* maximum number of TCP keepalive
|
||||
* retransmits */
|
||||
char *sslmode; /* SSL mode (require,prefer,allow,disable) */
|
||||
char *sslnegotiation; /* SSL initiation style
|
||||
* (postgres,direct,requiredirect) */
|
||||
char *sslcompression; /* SSL compression (0 or 1) */
|
||||
char *sslkey; /* client key filename */
|
||||
char *sslcert; /* client certificate filename */
|
||||
@@ -563,6 +566,7 @@ struct pg_conn
|
||||
|
||||
/* SSL structures */
|
||||
bool ssl_in_use;
|
||||
bool ssl_handshake_started;
|
||||
bool ssl_cert_requested; /* Did the server ask us for a cert? */
|
||||
bool ssl_cert_sent; /* Did we send one in reply? */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user