Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
0fb5e5ea50 | |||
35f6739b3c | |||
4634c68ea6 | |||
e126032b61 | |||
7797c799dd | |||
e8639e1b01 | |||
60a0ad106d | |||
a70c123007 | |||
46aa7620b0 | |||
f72db86e37 |
32
changelog.md
32
changelog.md
@ -1,5 +1,37 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-03-17 - 4.1.13 - fix(tls-handshake)
|
||||||
|
Set certificate_expired TLS alert level to warning instead of fatal to allow graceful termination.
|
||||||
|
|
||||||
|
- In the TLS handshake alert for certificate_expired (0x2F), changed the alert level from 0x02 (fatal) to 0x01 (warning).
|
||||||
|
- This change avoids abrupt connection termination, enabling a smoother handling of certificate expiration alerts.
|
||||||
|
|
||||||
|
## 2025-03-17 - 4.1.12 - fix(classes.pp.connectionhandler)
|
||||||
|
Replace unrecognized_name alert data with certificate_expired alert in TLS handshake handling for session resumption without SNI
|
||||||
|
|
||||||
|
- Switched the alert payload from serverNameUnknownAlertData to a new certificateExpiredAlert buffer
|
||||||
|
- Now sends a fatal certificate_expired alert (code 47) instead of a warning unrecognized_name alert
|
||||||
|
- Improves TLS error reporting and encourages immediate disconnection when a ClientHello lacks SNI and session tickets are disallowed
|
||||||
|
|
||||||
|
## 2025-03-17 - 4.1.11 - fix(connectionhandler)
|
||||||
|
Increase delay before cleaning up connections when session resumption is blocked due to missing SNI, allowing more natural socket termination.
|
||||||
|
|
||||||
|
- Changed cleanup delay in ts/classes.pp.connectionhandler.ts from 300ms to 1000ms.
|
||||||
|
- This fix ensures that sockets get sufficient time to terminate gracefully.
|
||||||
|
|
||||||
|
## 2025-03-16 - 4.1.10 - fix(connectionhandler)
|
||||||
|
Increase delay timings for TLS alert transmission in session ticket blocking to allow graceful socket termination
|
||||||
|
|
||||||
|
- Updated finishConnection: replaced immediate socket.destroy with a graceful end call
|
||||||
|
- Increased delay after successful write from 50ms to 200ms to allow alert processing
|
||||||
|
- Raised safety timeout from 250ms to 400ms when waiting for 'drain' event
|
||||||
|
|
||||||
|
## 2025-03-16 - 4.1.9 - fix(ConnectionHandler)
|
||||||
|
Replace closeNotify alert with handshake failure alert in TLS ClientHello handling to properly signal missing SNI and enforce session ticket restrictions.
|
||||||
|
|
||||||
|
- Switched alert data sent on missing SNI from closeNotifyAlert to sslHandshakeFailureAlertData.
|
||||||
|
- Ensures consistent TLS alert behavior during handshake failure.
|
||||||
|
|
||||||
## 2025-03-16 - 4.1.8 - fix(ConnectionHandler/tls)
|
## 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.
|
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.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartproxy",
|
"name": "@push.rocks/smartproxy",
|
||||||
"version": "4.1.8",
|
"version": "4.1.13",
|
||||||
"private": false,
|
"private": false,
|
||||||
"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.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartproxy',
|
name: '@push.rocks/smartproxy',
|
||||||
version: '4.1.8',
|
version: '4.1.13',
|
||||||
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.'
|
||||||
}
|
}
|
||||||
|
@ -605,42 +605,49 @@ export class ConnectionHandler {
|
|||||||
0x00, // close_notify alert (0)
|
0x00, // close_notify alert (0)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const certificateExpiredAlert = Buffer.from([
|
||||||
|
0x15, // Alert record type
|
||||||
|
0x03,
|
||||||
|
0x03, // TLS 1.2 version
|
||||||
|
0x00,
|
||||||
|
0x02, // Length
|
||||||
|
0x01, // Warning alert level (1)
|
||||||
|
0x2F, // certificate_expired alert (47)
|
||||||
|
]);
|
||||||
|
|
||||||
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(closeNotifyAlert);
|
const writeSuccessful = socket.write(certificateExpiredAlert);
|
||||||
socket.uncork();
|
socket.uncork();
|
||||||
|
|
||||||
// Function to handle the clean socket termination
|
// Function to handle the clean socket termination - but more gradually
|
||||||
const finishConnection = () => {
|
const finishConnection = () => {
|
||||||
// First call end() to initiate a graceful close (sends FIN)
|
// Give Chrome more time to process the alert before closing
|
||||||
|
// We won't call destroy() at all - just end() and let the socket close naturally
|
||||||
socket.end();
|
socket.end();
|
||||||
|
|
||||||
// Allow a short delay for the alert and FIN to be transmitted
|
// Log the cleanup but wait for natural closure
|
||||||
// before we fully close the socket
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!socket.destroyed) {
|
|
||||||
socket.destroy();
|
|
||||||
}
|
|
||||||
this.connectionManager.cleanupConnection(record, 'session_ticket_blocked_no_sni');
|
this.connectionManager.cleanupConnection(record, 'session_ticket_blocked_no_sni');
|
||||||
}, 150); // Short delay, but longer than the standard TCP ACK timeout
|
}, 1000); // Longer delay to let socket cleanup happen naturally
|
||||||
};
|
};
|
||||||
|
|
||||||
if (writeSuccessful) {
|
if (writeSuccessful) {
|
||||||
// If the data was successfully written to the kernel buffer,
|
// Wait longer before ending connection to ensure alert is processed by client
|
||||||
// we can finish the connection after a short delay to ensure transmission
|
setTimeout(finishConnection, 200); // Increased from 50ms to 200ms
|
||||||
setTimeout(finishConnection, 50);
|
|
||||||
} else {
|
} else {
|
||||||
// If the kernel buffer was full, wait for the drain event
|
// If the kernel buffer was full, wait for the drain event
|
||||||
socket.once('drain', () => {
|
socket.once('drain', () => {
|
||||||
setTimeout(finishConnection, 50);
|
// Wait longer after drain as well
|
||||||
|
setTimeout(finishConnection, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set a safety timeout in case drain never happens
|
// Safety timeout is increased too
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
socket.removeAllListeners('drain');
|
socket.removeAllListeners('drain');
|
||||||
finishConnection();
|
finishConnection();
|
||||||
}, 250);
|
}, 400); // Increased from 250ms to 400ms
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// If we can't send the alert, fall back to immediate termination
|
// If we can't send the alert, fall back to immediate termination
|
||||||
|
Reference in New Issue
Block a user