Skip to main content

certifi-linux

PyPI - Version PyPI - Python Version


Table of Contents

About

WHAT: certifi-linux wraps certifi, but instead of distributing a certificate like certifi does, it uses the Linux system trust store.

WHY? The requests module depends on certifi and uses it for TLS. certifi distributes the collection of root certificates provided by Mozilla for Python deployments. In some cases, especially in an enterprise setup it is necessary to use the certificates which are shipped with the OS.

Installation

certifi-linux is purposed for Linux! For Windows take a look at pip-system-certs.

pip install certifi-linux

Usage

certifi-linux just needs to be installed. Afterwards certifi.where() or $ python3 -m certifi will return the path to the system store. Hence all dependent projects like requests will do as well.

Compatibility

I am trying to keep tests up to date with endoflife.

Tested distros are:

  • alpine:3,
  • ubuntu:focal, ubuntu:jammy, ubuntu:noble,
  • debian:buster, debian:bullseye, debian:bookworm,
  • fedora:33, fedora:>=34
  • centos:stream9,
  • (manually) rhel:37, rhel:38

Yet untested: Arch, Slackware, OpenWRT, FreeBSD, SUSE, gentoo, ...

Implementation

certifi-linux monkey patches certif.where and certifi.contents by using wrapt. When called, it searches in the defined set of possible certificate bundle paths for a match.

Cert Path Candidates

Tested: yes✅, no❌

Cert Bundle Path Linux Distribution
/etc/ssl/cert.pem fedora >= 34✅, RHEL✅, alpine✅, centOS Stream✅, Arch❌, OpenWRT❌, FreeBSD❌
/etc/ssl/ca-bundle.pem openSUSE❌
/etc/ssl/certs/ca-certificates.crt Debian✅, Ubuntu✅
/etc/pki/tls/cert.pem fedora <= 33✅
/etc/pki/tls/cacert.pem OpenELEC❌
/etc/pki/tls/certs/ca-bundle.crt Fedora✅, RHEL✅
/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem CentOS✅, RHEL✅

Related Projects

The idea behind certifi-linux is the same as behind certifi-system-store. certifi-system-store replaces the dist-info of certifi with its own dist-info. This approach needs a specific order of installation for a succesful patch. When installed as a dependency among a whole set of dependencies this is hard to ensure and replacing dist-infos can mess up virtual environments.

pip-system-certs solves the same problem with a different approach. It monkey patches the requests.adapters.HTTPAdapter and uses ssl.create_default_context to load the OS certs. This works fine on Windows but has shown limitations on Linux as it does not work in some cases.

Viewed from the outside, certifi-debian is doing the exact same thing like certifi-linux but just for debian. certifi-system-store-wrapper also does the same but with the necessity to set an environment variable.

There are variants for other programming languages: Go, R

Credits

Credits go to the developers of certifi-system-store and pip-system-certs as certifi-linux is highly influenced by these two projects.

License

certifi-linux is distributed under the terms of the MIT license.

Metadata

Release files for certifi-linux 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for certifi-linux 1.1.0
File Interpreter ABI Platform
certifi_linux-1.1.0-py3-none-any.whl Python 3 none any Details

Release files / certifi_linux-1.1.0-py3-none-any.whl

Download URL certifi_linux-1.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffa23d189e1213682b32ce33380debdfc575bc3a4703adcc6b90bb1d27d46c11
BLAKE2b-256 checksum
How to use checksums
0bf231d1b35d73de2f70af368eb3388244a7669201d6b22751664ebb86f644d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.25.0

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page