Skip to content

Allow specifying a certificate bundle with TLDR_CERT #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ ENV/
env.bak/
venv.bak/

# direnv
.envrc
.direnv/

# Spyder project settings
.spyderproject
.spyproject
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ For networks that sit behind a proxy, it may be necessary to disable SSL verific

will disable SSL certificate inspection. This __should be avoided__ unless absolutely necessary.

It is possible to use a different certificate store/bundle by setting:

* `TLDR_CERT=/path/to/certificates.crt`

### Colors

Values of the `TLDR_COLOR_x` variables may consist of three parts:
Expand Down
3 changes: 3 additions & 0 deletions tldr.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@
USE_NETWORK = int(os.environ.get('TLDR_NETWORK_ENABLED', '1')) > 0
USE_CACHE = int(os.environ.get('TLDR_CACHE_ENABLED', '1')) > 0
MAX_CACHE_AGE = int(os.environ.get('TLDR_CACHE_MAX_AGE', 24*7))
CAFILE = None if os.environ.get('TLDR_CERT', None) is None else Path(os.environ.get('TLDR_CERT')).expanduser()

URLOPEN_CONTEXT = None
if int(os.environ.get('TLDR_ALLOW_INSECURE', '0')) == 1:
URLOPEN_CONTEXT = ssl.create_default_context()
URLOPEN_CONTEXT.check_hostname = False
URLOPEN_CONTEXT.verify_mode = ssl.CERT_NONE
elif CAFILE:
URLOPEN_CONTEXT = ssl.create_default_context(cafile=CAFILE)

OS_DIRECTORIES = {
"linux": "linux",
Expand Down
Loading