Skip to content

Can OpenSSL native library be lazy loaded? #46076

@mthalman

Description

@mthalman

I've been experimenting with Docker Slim to produce extremely slimmed down versions of .NET containers that contain only the files that are actually used by the app. After examining the results of a basic Hello World console app, I wonder whether it'd be possible to modify the runtime to further reduce its dependencies.

Here's the list of files that are left in my Alpine Linux 3.12 container after applying Docker Slim (my app is published as a single file):

FILE                                  SIZE
/app/app                              14.9M
/etc/os-release                       164B
/lib/ld-musl-x86_64.so.1              582.5K
/lib/libcom_err.so.2.1                13.6K
/lib/libcrypto.so.1.1                 2.5M
/lib/libssl.so.1.1                    511.5K
/lib/libz.so.1.2.11                   97.8K
/usr/lib/libgcc_s.so.1                73.7K
/usr/lib/libgssapi_krb5.so.2.2        280.2K
/usr/lib/libk5crypto.so.3.1           170.1K
/usr/lib/libkeyutils.so.1.9           21.7K
/usr/lib/libkrb5.so.3.3               786.5K
/usr/lib/libkrb5support.so.0.1        46.1K
/usr/lib/libstdc++.so.6.0.28          1.6M

I'm specifically wondering about the need for libssl.so.1.1. Again, I have a simple .NET 5 app (System.Console.WriteLine("Hello World!");) with, presumably, no underlying dependency on OpenSSL. The libssl.so.1.1 file is currently required however because it's loaded as part of the loading of the libSystem.Security.Cryptography.Native.OpenSsl module due to:

I'm wondering if it's possible to have OpenSSL lazy loaded until the point where it's required. Presumeably, that would allow my container to not require the libssl.so.1.1 file and remove 500K from it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Securityneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions