Skip to content

Commit

Permalink
fix: allow connection to unsafe legacy servers
Browse files Browse the repository at this point in the history
This commit adds the SSL_OP_LEGACY_SERVER_CONNECT flag when connecting to
legacy remote servers for increased compatibility.
Note that it allows man-in-the-middle attacks, but those attacks are
already possible anyway because of the rejectUnauthorized option which
allows any certificate on the server. kassette is a test tool that is not
designed to run in a production environment.

This PR fixes the following error that can happen when this flag is not
set:

78250000:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled
  • Loading branch information
divdavem committed Nov 23, 2023
1 parent 31510de commit ce30f1d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/app/server/requesting/impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { Socket } from 'net';
import { TLSSocket } from 'tls';
import { SecureClientSessionOptions } from 'http2';
import { RequestTimings } from '../../../lib/har/harTypes';
import { constants } from 'crypto';

////////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -161,6 +162,7 @@ export async function sendRequest({
// forces the use of http/1.x in case http/1.x is used in the original request:
...(original.original?.httpVersionMajor < 2 ? forceHttp1 : {}),
rejectUnauthorized: false,
secureOptions: constants.SSL_OP_LEGACY_SERVER_CONNECT,
method: requestOptions.method,
headers: requestOptions.headers,
agent: {
Expand Down

0 comments on commit ce30f1d

Please sign in to comment.