jborean93 / smbprotocol

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

Unable to login to Azure drives from linux #256

Open davymcf opened 11 months ago

davymcf commented 11 months ago

I am unable to connect to azure drives from a python application running on a lambda container :

`FROM public.ecr.aws/lambda/python:3.8

RUN yum update -y && \ yum install -y gcc python-devel krb5-devel krb5-workstation python-devel && \ yum clean all

COPY requirements.txt /requirements.txt

RUN pip install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r /requirements.txt

COPY ./code ${LAMBDA_TASK_ROOT}

CMD ["lambda_function.lambda_handler"] `

Requirements: smbprotocol[kerberos] krb5 gssapi

Errror: [ERROR] LogonFailure: Received unexpected status from the server: The attempted logon is invalid. This is either due to a bad username or authentication information. (3221225581) STATUS_LOGON_FAILURE: 0xc0    raise SMBResponseException(response)kages/smbprotocol/connection.py"

I am successful in connecting to the drive when running the application locally via PyCharm py3.8 on Macos, with the above python dependencies.

I have also tried using DOMAIN\username and username@domain.com. Another note is that I am able to connect to other drives using this user within my docker container.

jborean93 commented 10 months ago

Hi sorry I missed this issue. I'm not sure why the server has replied with this error but if it worked on your macOS with the same credentials but not in the container it could be that the version of MIT krb5 has a problem authenticating with the server. Looking online it seems like that Lamba image is based on Amazon Linux 2 which is based on RHEL 7 and can have older packages. It might be worthwhile attempting to fallback to ntlm auth to rule out whether it's a problem with the Kerberos libraries or not.

Unfortunately I don't really have such an environment to test these things out but it certainly seems like something specific to the OS it's running on, especially if it works from your macOS host.