TritonDataCenter / node-triton

Triton client tool and node.js library
56 stars 40 forks source link

AssertionError in keyring.js caused by OpenSSL 3 #329

Closed mshavliuk closed 1 year ago

mshavliuk commented 1 year ago

When I'm running the triton -v -i info command it throws an unexpected error:

{"name":"triton","hostname":"server","pid":7690,"level":20,"msg":"Using configDir /home/mike/.triton","time":"2022-12-10T17:36:35.894Z","src":{"file":"/usr/local/lib/node_modules/triton/lib/cli.js","line":268,"func":"CLI.init"},"v":0}
{"name":"triton","hostname":"server","pid":7690,"level":10,"profile":{"url":"https://10.88.88.5","account":"mike","keyId":"f2:3c:ac:94:1f:f6:cb:74:0e:05:11:7e:2c:18:48:e3","name":"fi-tuni-01","insecure":true},"msg":"loaded profile","time":"2022-12-10T17:36:35.899Z","src":{"file":"/usr/local/lib/node_modules/triton/lib/cli.js","line":312,"func":"getProfile"},"v":0}
{"name":"triton","hostname":"server","pid":7690,"level":10,"config":{"cacheDir":"cache","profile":"fi-tuni-01","_user":{"profile":"fi-tuni-01"},"_defaults":{"cacheDir":"cache"},"_configDir":"/home/mike/.triton"},"msg":"loaded config","time":"2022-12-10T17:36:35.900Z","src":{"file":"/usr/local/lib/node_modules/triton/lib/cli.js","line":275,"func":"getConfig"},"v":0}
{"name":"triton","hostname":"server","pid":7690,"level":10,"cacheDir":"/home/mike/.triton/cache/mike@10_88_88_5","msg":"cache dir","time":"2022-12-10T17:36:35.901Z","src":{"file":"/usr/local/lib/node_modules/triton/lib/tritonapi.js","line":441,"func":"TritonApi"},"v":0}
{"name":"triton","hostname":"server","pid":7690,"level":10,"msg":"created tritonapi","time":"2022-12-10T17:36:35.902Z","src":{"file":"/usr/local/lib/node_modules/triton/lib/cli.js","line":324,"func":"getTritonapi"},"v":0}
assert.js:386
    throw err;
    ^

AssertionError [ERR_ASSERTION]: value
    at SignatureCache.put (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/lib/keyring.js:255:13)
    at sign (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/lib/keypair.js:160:10)
    at RequestSigner.rsign [as rs_signFunc] (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/lib/keypair.js:101:3)
    at RequestSigner.sign (/usr/local/lib/node_modules/triton/node_modules/http-signature/lib/signer.js:205:10)
    at CloudApi._getAuthHeaders (/usr/local/lib/node_modules/triton/lib/cloudapi2.js:200:8)
    at CloudApi._request (/usr/local/lib/node_modules/triton/lib/cloudapi2.js:288:10)
    at CloudApi._passThrough (/usr/local/lib/node_modules/triton/lib/cloudapi2.js:404:10)
    at CloudApi.getAccount (/usr/local/lib/node_modules/triton/lib/cloudapi2.js:840:10)
    at onSetup (/usr/local/lib/node_modules/triton/lib/do_info.js:38:28)
    at /usr/local/lib/node_modules/triton/lib/common.js:891:13 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}

System

Triton CLI 7.15.1 NPM 8.5.1 Node v12.22.9 Ubuntu 22.04.1 LTS

mshavliuk commented 1 year ago

After I run export NODE_NDEBUG=1 to disable the node assertions it started to throw another error:

internal/validators.js:120
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:120:11)
    at Object.basename (path.js:1156:5)
    at KeyRingFilePlugin._load (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/lib/kr-file.js:89:21)
    at KeyRingFilePlugin.findKey (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/lib/kr-file.js:69:7)
    at runPlugin (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/lib/keyring.js:151:10)
    at Array.<anonymous> (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/node_modules/vasync/lib/vasync.js:122:12)
    at parallel (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/node_modules/vasync/lib/vasync.js:94:11)
    at Object.forEachParallel (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/node_modules/vasync/lib/vasync.js:126:10)
    at SDCKeyRing.find (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/lib/keyring.js:127:13)
    at SDCKeyRing.findSigningKeyPair (/usr/local/lib/node_modules/triton/node_modules/smartdc-auth/lib/keyring.js:166:7) {
  code: 'ERR_INVALID_ARG_TYPE'
}
travispaul commented 1 year ago

@mshavliuk, thanks for the bug report.

Could you try running:

export OPENSSL_CONF=/etc/ssl

Then triton info again?

Exporting OPENSSL_CONF should allow you to work around that assertion until there is a permanent fix.

bahamat commented 1 year ago

Hi @mshavliuk, version 7.15.3 has just been published which fixes this issue.

mshavliuk commented 1 year ago

Awesome news, thanks a lot!