How can I tell if my source-built python has SSL enabled? either
Context:
Source code: Lib/ssl.py. This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library.
Currently Python versions 3.6 to 3.9 are compatible with OpenSSL 1.0. 2, 1.1. 0, and 1.1. 1.
For example, python itself uses openssl, while conda uses pyopenssl.
If all you want to do is figure out if openssl
is installed, you can parse the output of openssl version
:
$ openssl version
OpenSSL 1.0.2g-fips 1 Mar 2016
You can get all sorts of information from version
, for example, the directory where its stored:
$ openssl version -d
OPENSSLDIR: "/usr/lib/ssl"
As far as Python goes, I'm not sure how you can tell before running configure (maybe check the contents of config.log
?) but once Python is installed; simply parse the output of ssl.OPENSSL_VERSION
, like this:
$ python -c "import ssl; print(ssl.OPENSSL_VERSION)"
OpenSSL 1.0.2g-fips 1 Mar 2016
For even more information, have a play with the sysconfig
module, for example:
$ python -c "import sysconfig; print(sysconfig.get_config_var('CONFIG_ARGS'))"
'--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-unicode=ucs4' '--with-dbmliborder=bdb:gdbm' '--with-system-expat' '--with-computed-gotos' '--with-system-ffi' '--with-fpectl' 'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With