serverless-python-requirements icon indicating copy to clipboard operation
serverless-python-requirements copied to clipboard

Problem installing native sftp

Open shaunc opened this issue 3 years ago • 1 comments

I am trying to add sftp to the image and call it using subprocess.call() to get around a paramiko bug involving jumphosts.

Following the documentation, I add to a custom dockerfile:

FROM lambci/lambda:build-python3.8 as base

RUN yum install -y libffi libffi-devel openssh openssh-clients

Then configure to add to runtime package:

    dockerFile: ./Dockerfile
    dockerExtraFiles:
    - /usr/bin/sftp
    - /usr/lib64/libcrypto.so.10
    - /usr/lib64/libgssapi_krb5.so.2
    - /usr/lib64/libk5crypto.so.3
    - /usr/lib64/libkeyutils.so.1
    - /usr/lib64/libkeyutils.so.1
    - /usr/lib64/libkrb5.so.3
    - /usr/lib64/libkrb5support.so.0
    - /usr/lib64/libssl.so.10
    - /usr/lib64/libssl3.so

and add to package:

package:
  patterns:
    - '!.serverless*/**'
    - '!node_modules/**'
    - '/usr/bin/sftp'
    - '/usr/lib64/**'

However, when I look in the image, I see sftp executable, but no lib64 dependencies:

$ zipinfo .serverless/cdh-send-sftp-frb.zip | grep usr/bin/sftp
-rwxr-xr-x  3.0 unx   129544 b- defN 80-Jan-01 00:00 usr/bin/sftp
$ zipinfo .serverless/cdh-send-sftp-frb.zip | grep usr/bin/sftp
-rwxr-xr-x  3.0 unx   129544 b- defN 80-Jan-01 00:00 usr/bin/sftp
(base) shauncutts@silk:~/.../cdh-send-sftp-frb$ zipinfo .serverless/cdh-send-sftp-frb.zip | grep lib64
-rwxr-xr-x  3.0 unx   216192 b- defN 80-Jan-01 00:00 usr/lib64/ld-linux-x86-64.so.2

(well, almost no .. not the ones I asked for!)

As a result, sftp doesn't run. How can I get the files I need from the docker image?

UPDATE In fact, many of the libraries above are symlinks. However, using the target version doesn't work either. For instance -- with extra files:

    # - /usr/lib64/libcrypto.so.10
    - /usr/lib64/libcrypto.so.1.0.2k
    # - /usr/lib64/libgssapi_krb5.so.2
    - /usr/lib/libgssapi_krb5.so.2.2    
    # - /usr/lib64/libk5crypto.so.3
    - /usr/lib64/libk5crypto.so.3.1
    # - /usr/lib64/libkeyutils.so.1
    - /usr/lib64/libkeyutils.so.1.5
    # - /usr/lib64/libkrb5.so.3
    - /usr/lib64/libkrb5.so.3.3
    # - /usr/lib64/libkrb5support.so.0
    - /usr/lib64/libkrb5support.so.0.1
    # - /usr/lib64/libssl.so.10
    - /usr/lib64/libssl.so.1.0.2k
    - /usr/lib64/libssl3.so

The files are still not included. Yet usr/bin/sftp is included?!

shaunc avatar Feb 04 '22 05:02 shaunc

Anything, anyone?

shaunc avatar Jul 18 '23 21:07 shaunc