Skip to content
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

[YoutubeDL] Add --client-certificate option #29590

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dirkf
Copy link
Contributor

@dirkf dirkf commented Jul 19, 2021

Please follow the guide below

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

Some sites only allow access to HTTPS connections that offer a valid client certificate. In some cases, the client certificate may be built into the firmware of a client device. While such certificates are typically not accessible without jail-breaking the device, it would be desirable to allow this means of authentication as well as username+password, etc.

This PR adds an option --client-certificate whose value should be the filename of a single certificate file containing the certificate and private key (as described in the Python library documentation for the ssl module under 'Combined key and certificate').

Use a PEM certificate to authenticate HTTPS access to site
@dirkf
Copy link
Contributor Author

dirkf commented Jul 20, 2021

The new test case test_check_clientcertificate failed for Python >= 2.7.8 because yt-dl sets the HTTPS client to validate the server certificate, and this failed with the test HTTPS server from test/test_http.py because self-signed certificates don't pass.

If 'nocheckcertificate': True is passed along with the clientcertificate option in the test_check_clientcertificate test case, the test succeeds.

The tests for HTTPS in test/test_http.py don't check that HTTPS connections work in general, but only that the nocheckcertificate option works. A similar test-case without that option fails, but this will happen unless the server certificate has a valid path to a root CA. Unfortunately, arranging proper SSL certificates for testing seems to be a hopeless task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant