jborean93 / smbprotocol

Python SMBv2 and v3 Client
MIT License
318 stars 73 forks source link

smbclient not working in lambda context - cant find rust x509 compiled files #175

Closed jmwolfe closed 2 years ago

jmwolfe commented 2 years ago

When using smbclient in AWS lambda environment, getting this error:

{
  "errorMessage": "Unable to import module 'main': cannot import name 'x509' from 'cryptography.hazmat.bindings._rust' (unknown location)",
  "errorType": "Runtime.ImportModuleError",
  "stackTrace": []
}

I installed smbprotocol using pip on a linux host and grabbed all the lib folders from there for the lambda, so in theory the needed files are around on the AL2 Linux system. Does anyone here know where the compiled crypto files live and how to get them into the lambda?

adiroiban commented 2 years ago

This looks like a cryptography library issue and not an issue with the smbprotocol library.

Can you try to install cryptography==36.0.2

cryptography 37 was released with wheels containing OpenSSL 3.0.0 ... so this is a big change

jborean93 commented 2 years ago

You can't just copy the files as they are binary Python modules that could be linked to specific Python versions or other system libraries. The cryptography library is used for things like signing and encryption and is not an optional component. You need to ensure you've installed the cryptography library properly on your lambda context, however that is done.

jmwolfe commented 2 years ago

See also: