fix(ConnectionHandler/tls): Change the TLS alert sent when a ClientHello lacks SNI: use the close_notify alert instead of handshake_failure to prompt immediate retry with SNI.
This commit is contained in:
		| @@ -1,5 +1,11 @@ | |||||||
| # Changelog | # Changelog | ||||||
|  |  | ||||||
|  | ## 2025-03-16 - 4.1.8 - fix(ConnectionHandler/tls) | ||||||
|  | Change the TLS alert sent when a ClientHello lacks SNI: use the close_notify alert instead of handshake_failure to prompt immediate retry with SNI. | ||||||
|  |  | ||||||
|  | - Replaced the previously sent handshake_failure alert (code 0x28) with a close_notify alert (code 0x00) in the TLS session resumption handling in ConnectionHandler. | ||||||
|  | - This change encourages clients to immediately retry and include SNI when allowSessionTicket is false. | ||||||
|  |  | ||||||
| ## 2025-03-16 - 4.1.7 - fix(classes.pp.connectionhandler) | ## 2025-03-16 - 4.1.7 - fix(classes.pp.connectionhandler) | ||||||
| Improve TLS alert handling in ClientHello when SNI is missing and session tickets are disallowed | Improve TLS alert handling in ClientHello when SNI is missing and session tickets are disallowed | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,6 +3,6 @@ | |||||||
|  */ |  */ | ||||||
| export const commitinfo = { | export const commitinfo = { | ||||||
|   name: '@push.rocks/smartproxy', |   name: '@push.rocks/smartproxy', | ||||||
|   version: '4.1.7', |   version: '4.1.8', | ||||||
|   description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.' |   description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.' | ||||||
| } | } | ||||||
|   | |||||||
| @@ -595,10 +595,20 @@ export class ConnectionHandler { | |||||||
|               0x28, // handshake_failure alert (40) instead of unrecognized_name (112) |               0x28, // handshake_failure alert (40) instead of unrecognized_name (112) | ||||||
|             ]); |             ]); | ||||||
|  |  | ||||||
|  |             const closeNotifyAlert = Buffer.from([ | ||||||
|  |               0x15, // Alert record type | ||||||
|  |               0x03, | ||||||
|  |               0x03, // TLS 1.2 version | ||||||
|  |               0x00, | ||||||
|  |               0x02, // Length | ||||||
|  |               0x01, // Warning alert level (1) | ||||||
|  |               0x00, // close_notify alert (0) | ||||||
|  |             ]); | ||||||
|  |  | ||||||
|             try { |             try { | ||||||
|               // Use cork/uncork to ensure the alert is sent as a single packet |               // Use cork/uncork to ensure the alert is sent as a single packet | ||||||
|               socket.cork(); |               socket.cork(); | ||||||
|               const writeSuccessful = socket.write(sslHandshakeFailureAlertData); |               const writeSuccessful = socket.write(closeNotifyAlert); | ||||||
|               socket.uncork(); |               socket.uncork(); | ||||||
|  |  | ||||||
|               // Function to handle the clean socket termination |               // Function to handle the clean socket termination | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user