Skip to content

Allow setting GIT_OPT_SET_SSL_CERT_LOCATIONS option in libgit2 #876

Closed
@webknjaz

Description

@webknjaz

Apparently, there's GIT_OPT_SET_SSL_CERT_LOCATIONS (ref: https://libgit2.org/libgit2/#HEAD/group/libgit2/git_libgit2_opts) option available in libgit2 (src: https://github.com/libgit2/libgit2/blob/12c6e1f/src/settings.c#L180-L186).

OpenSSL we have compiled under manylinux1 image has the following completely non-default address for OPENSSLDIR config value:

[root@7a356be85129 ~]# /opt/pyca/cryptography/openssl/bin/openssl version -d
OPENSSLDIR: "/opt/pyca/cryptography/openssl"

But even if we wanted to set something more generic we simply wouldn't be able to agree on what such generic value would be. Every OS has it's own "ideal" location in their minds: http://gagravarr.org/writing/openssl-certs/others.shtml

That's why it's important to expose this option so that it could be specified by users who could also have some non-default places for certificates for hardening reasons, for example.

Going forward, Python itself has ssl module which might have a better idea of where the current installation stores its certificates. This is the location default of my Gentoo Linux based laptop, for example:

ipython
Python 3.7.1 (default, Jan 28 2019, 08:25:13) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.1.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import ssl                                                                                                                                                                             

In [2]: ssl.get_default_verify_paths()                                                                                                                                                         
Out[2]: 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')

So in order to provide better consistency with the runtime, I suggest to not only expose this option but also set the location to match Python's defaults, during initialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions