artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
8.06k stars 511 forks source link

Client Certificate, mTLS, ERR_OSSL_UNSUPPORTED #3398

Open marc8405 opened 3 weeks ago

marc8405 commented 3 weeks ago

Error: ERR_OSSL_UNSUPPORTED

Topic Client Certificate, mTLS, I need to set Client Certificate

VERSION INFO: Artillery: 2.0.21 Node.js: v18.20.2 OS: win32

Running this command: artillery run _test4OpenSSLError.yaml

I expected to see this happen: return Http200

Please validate: key: 'C:\temp\mypem-key.pem' cert: 'C:\temp\mypem-cert.pem'

Instead, this happened:

2024-11-01T06:59:18.324Z http RequestError: error:1E08010C:DECODER routines::unsupported
    at Request._makeRequest (C:\eplatform\tools\node\v18\node_modules\artillery\node_modules\got\dist\source\core\index.js:1191:19)
    at C:\eplatform\tools\node\v18\node_modules\artillery\node_modules\got\dist\source\core\index.js:334:28
    at setKey (node:internal/tls/secure-context:93:11)
    at configSecureContext (node:internal/tls/secure-context:200:7)
    at Object.createSecureContext (node:_tls_common:117:3)
    at Object.connect (node:_tls_wrap:1750:48)
    at HttpsAgent.createConnection (node:https:158:22)
    at HttpsAgent.createConnection (C:\eplatform\tools\node\v18\node_modules\artillery\node_modules\agentkeepalive\lib\https_agent.js:29:49)
    at HttpsAgent.createSocket (node:_http_agent:341:26)
    at HttpsAgent.addRequest (node:_http_agent:288:10)
    at new ClientRequest (node:_http_client:342:16)
    at request (node:https:366:10)

errors.ERR_OSSL_UNSUPPORTED: ................................................... 1
vusers.created: ................................................................ 1
vusers.created_by_name.0: ...................................................... 1
vusers.failed: ................................................................. 1

Request / Certificate / pem is ok with: a) Postman b) Artillery using customer.js, customer.js reads cert and key

Files being used:

config:
  target: 'https://mybaseurl:8443'
  tls:
    rejectUnauthorized: false
    key: 'C:\temp\mypem-key.pem'
    cert: 'C:\temp\mypem-cert.pem'
  http:
    defaults:
      headers:
        Context: 'eyJ0eXAiOiJKV…'
        Accept-Language: 'de'
        Content-Type: 'application/json'
custom.js
  // Define request options with mTLS and the selected Context value
  const options = {
    ...
    method: 'GET',
    key: fs.readFileSync('C:\\...'),
    cert: fs.readFileSync('C:\\...'),
    rejectUnauthorized: false, 
    headers: {
      'Context': ...,
      'Accept-Language': 'de',
      'Content-Type': 'application/json'
    }
  };