aws / aws-iot-device-sdk-js-v2

Next generation AWS IoT Client SDK for Node.js using the AWS Common Runtime
Apache License 2.0
222 stars 99 forks source link

Problem connection using libsofthsm2.so #389

Closed skulljoi closed 1 year ago

skulljoi commented 1 year ago

Describe the bug

When I try to load the library libsofthsm2.so it just fail with:

`Loading PKCS#11 library "/usr/lib/softhsm/libsofthsm2.so" ... /write/greengrass/packages/artifacts-unarchived/client-mqtt/node_modules/aws-crt/dist/native/io.js:395 super(binding_1.default.io_pkcs11_lib_new(path, behavior)); ^

Error: aws-c-io: AWS_IO_SHARED_LIBRARY_LOAD_FAILURE, System call error during attempt to load shared library at new Pkcs11Lib (/greengrass/packages/artifacts-unarchived/client-mqtt/node_modules/aws-crt/dist/native/io.js:395:33) at Object. (/greengrass/packages/artifacts-unarchived/client-mqtt/client.js:7:20) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'System call error during attempt to load shared library' }`

the client.js code is

`const { mqtt, io, iot } = require('aws-iot-device-sdk-v2');

const argv = {} argv.pkcs11_lib = process.argv[2]

console.log(Loading PKCS#11 library "${argv.pkcs11_lib}" ...); const pkcs11_lib = new io.Pkcs11Lib(argv.pkcs11_lib);`

Expected Behavior

It shoudl work as it works with python

Current Behavior

When I try to load the library libsofthsm2.so it just fail with:

`Loading PKCS#11 library "/usr/lib/softhsm/libsofthsm2.so" ... /write/greengrass/packages/artifacts-unarchived/client-mqtt/node_modules/aws-crt/dist/native/io.js:395 super(binding_1.default.io_pkcs11_lib_new(path, behavior)); ^

Error: aws-c-io: AWS_IO_SHARED_LIBRARY_LOAD_FAILURE, System call error during attempt to load shared library at new Pkcs11Lib (/greengrass/packages/artifacts-unarchived/client-mqtt/node_modules/aws-crt/dist/native/io.js:395:33) at Object. (/greengrass/packages/artifacts-unarchived/client-mqtt/client.js:7:20) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'System call error during attempt to load shared library' }`

the client.js code is

`const { mqtt, io, iot } = require('aws-iot-device-sdk-v2');

const argv = {} argv.pkcs11_lib = process.argv[2]

console.log(Loading PKCS#11 library "${argv.pkcs11_lib}" ...); const pkcs11_lib = new io.Pkcs11Lib(argv.pkcs11_lib);`

Reproduction Steps

create the client.js install de dependency

node client.js

you need to have the softhsm running

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.13.3

Environment details (OS name and version, etc.)

Linux ip-XXXXX-aws #23~22.04.1-Ubuntu SMP Fri Mar 17 15:42:08 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

skulljoi commented 1 year ago

Problem with the build aws-crt

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.