Skip to content

env.sh does not copy /etc/ssl/cert.pem symbol link file #277

Description

@luyang93

When I set SYSTEM_LIB_REQUIREMENTS="/usr/lib/python3.14,/usr/lib,/etc/ssl,/etc/nsswitch.conf,/etc/hosts,/etc/resolv.conf,/etc/localtime,/usr/share/zoneinfo,/etc/timezone"
env.sh does not copy /etc/ssl/cert.pem symbol link file.

bash-5.3# ls -alh /var/sandbox/sandbox-python/etc/ssl/
total 24K    
drwxr-xr-x    1 root     root        4.0K Jun 30 10:42 .
drwxr-xr-x    1 root     root        4.0K Jul  4 03:37 ..
drwxr-xr-x    1 root     root        4.0K Jul  4 03:37 certs
bash-5.3# ls -alh /etc/ssl/**
-rw-r--r--    1 root     root        7.4K Jun 25 09:54 /etc/ssl/ca.cnf
lrwxrwxrwx    1 root     root          25 Apr 17 19:14 /etc/ssl/cert.pem -> certs/ca-certificates.crt

/etc/ssl/certs:
total 232K   
drwxr-xr-x    1 root     root        4.0K Apr 17 19:14 .
drwxr-xr-x    1 root     root        4.0K Jun 25 09:54 ..
lrwxrwxrwx    1 root     root          19 Apr 17 19:14 ca-bundle.crt -> ca-certificates.crt
-rw-r--r--    2 root     root      212.7K Apr 17 19:14 ca-certificates.crt

It breaks python ssl library in sandbox. ssl can not set cafile(etc/ssl/cert.pem), cafile should follow symbol link, then set to /etc/ssl/certs/ca-certificates.crt

def main():
    import ssl
    return {
        "result": str(ssl.get_default_verify_paths()),
    }
{
  "result": "DefaultVerifyPaths(cafile=None, capath='/etc/ssl/certs', openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/etc/ssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/etc/ssl/certs')"
}

After I copy symbol link to sanbox-python directory. It works well.

bash-5.3# cp -a /etc/ssl/cert.pem /var/sandbox/sandbox-python/etc/ssl/
bash-5.3# ls -alh /var/sandbox/sandbox-python/etc/ssl/
total 24K    
drwxr-xr-x    1 root     root        4.0K Jul  4 03:48 .
drwxr-xr-x    1 root     root        4.0K Jul  4 03:37 ..
lrwxrwxrwx    1 root     root          25 Jul  4 03:48 cert.pem -> certs/ca-certificates.crt
drwxr-xr-x    1 root     root        4.0K Jul  4 03:37 certs
{
  "result": "DefaultVerifyPaths(cafile='/etc/ssl/cert.pem', capath='/etc/ssl/certs', openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/etc/ssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/etc/ssl/certs')"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions