Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use client cipher suites for server #271

Open
chribro88 opened this issue Dec 13, 2022 · 1 comment
Open

Use client cipher suites for server #271

chribro88 opened this issue Dec 13, 2022 · 1 comment

Comments

@chribro88
Copy link
Contributor

chribro88 commented Dec 13, 2022

Hello,

I'm trying mirror the client's given cipher suites for the proxy to provide to the server.

There's two road blocks I'm getting stuck at.

  1. obtaining the client's provided cipher suites. What I can obtain is the accepted cipher thru the onRequest hook and ctx.clientToProxyRequest.client.getCipher().
  2. providing the cipher suites to the server (ctx.proxyToServerRequestOptions.agent.options.cipher) without the TLS_EMPTY_RENEGOTIATION_INFO_SCSV cipher being automatically appended to the list. I've also tried setting require('constants').SSL_OP_NO_RENEGOTIATION for secureOptions but still occurs

potentially (2) might require openssl to be patched as suggested here:
https://stackoverflow.com/questions/35254883/avoid-sending-tls-empty-renegotiation-info-scsv-cipher-in-tls-client-hello

Hoping someone with a better understanding than myself can point me in the right direction 😁

Cheers!

@chribro88 chribro88 changed the title Use client cipher suites upstream Use client cipher suites for server Dec 13, 2022
@Viiprogrammer
Copy link

Viiprogrammer commented Jun 7, 2024

In a bit of a hacky way, I monkey patched TLS to change the fingerprint:

const tls = require("node:tls")

const origTLSConnect = tls.connect
const ciphers = [
    'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384',
    'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
    'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384',
    'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA',
    'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256',
    'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA',
    'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384',
    'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256',
    'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384',
    'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256',
    'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA'
].join(':')

tls.connect = function () {
    const args = arguments

    if (typeof args[0] === 'object') {
        args[0].ciphers = ciphers
        args[0].secureProtocol = 'TLSv1_2_method'
    }

    // args[1].ciphers = ciphers
    return origTLSConnect(...args)
}

just call this before init proxy server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants