-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
Add support for verifying ssl certificates #596
Conversation
Weird, the tests pass on my side. |
Ping... |
Hi, apologies for delay! There appears to be an issue appveyor currently. This looks good, though I think want to make the Thanks! |
docs/manual/configuring.rst
Outdated
By default, SSL-Certificates of websites are not verified. To enable verification, add the following to the config:: | ||
|
||
certificates: | ||
cert_req: 'CERT_REQUIRED' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cert_req: 'CERT_REQUIRED' | |
cert_reqs: 'CERT_REQUIRED' |
typo
pywb/warcserver/http.py
Outdated
@@ -17,8 +17,10 @@ class PywbHttpAdapter(HTTPAdapter): | |||
until a better solution is found | |||
""" | |||
|
|||
# todo: allow configuring this later? | |||
cert_reqs = 'CERT_NONE' | |||
def __init__(self, cert_reqs='CERT_NONE', ca_cert_dir='/etc/ssl/certs', **init_kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __init__(self, cert_reqs='CERT_NONE', ca_cert_dir='/etc/ssl/certs', **init_kwargs): | |
def __init__(self, cert_reqs='CERT_NONE', ca_cert_dir=None, **init_kwargs): |
pywb/warcserver/warcserver.py
Outdated
certs_config = self.config['certificates'] | ||
DefaultAdapters.live_adapter = PywbHttpAdapter(max_retries=Retry(3), | ||
cert_reqs=certs_config.get('cert_reqs', 'CERT_NONE'), | ||
ca_cert_dir=certs_config.get('ca_cert_dir', '/etc/ssl/certs')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ca_cert_dir=certs_config.get('ca_cert_dir', '/etc/ssl/certs')) | |
ca_cert_dir=certs_config.get('ca_cert_dir')) |
Want to make this optional.
pywb/warcserver/warcserver.py
Outdated
ca_cert_dir=certs_config.get('ca_cert_dir', '/etc/ssl/certs')) | ||
DefaultAdapters.remote_adapter = PywbHttpAdapter(max_retries=Retry(3), | ||
cert_reqs=certs_config.get('cert_reqs', 'CERT_NONE'), | ||
ca_cert_dir=certs_config.get('ca_cert_dir', '/etc/ssl/certs')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ca_cert_dir=certs_config.get('ca_cert_dir', '/etc/ssl/certs')) | |
ca_cert_dir=certs_config.get('ca_cert_dir')) |
docs/manual/configuring.rst
Outdated
cert_req: 'CERT_REQUIRED' | ||
ca_cert_dir: '/etc/ssl/certs' | ||
|
||
``ca_cert_dir`` should point to a directory containing the CA certificates that you trust. Most linux distributions provide CA certificates via a package called ``ca-certificates``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``ca_cert_dir`` should point to a directory containing the CA certificates that you trust. Most linux distributions provide CA certificates via a package called ``ca-certificates``. | |
``ca_cert_dir`` can optionally point to a directory containing the CA certificates that you trust. Most linux distributions provide CA certificates via a package called ``ca-certificates``. | |
If omitted, the default system CA used by Python is used. |
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
eb5ee5b
to
8e3ca71
Compare
Thank you for your Review. I addressed your comments. |
Codecov Report
@@ Coverage Diff @@
## master #596 +/- ##
==========================================
- Coverage 87.69% 87.24% -0.45%
==========================================
Files 64 64
Lines 8096 8109 +13
Branches 1445 1446 +1
==========================================
- Hits 7100 7075 -25
- Misses 640 667 +27
- Partials 356 367 +11
Continue to review full report at Codecov.
|
Thanks! Could you add a quick test case, perhaps in the main You can just add a custom config yaml and then call a live endpoint, maybe something like: You can look at a small test file like: https://github.com/webrecorder/pywb/blob/master/tests/test_root_coll.py |
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
I added a testcase. |
Description
For Security reasons it may be desirable to reject invalid certificates. This adds configuration
options to configure this.
Fixes: #594
Types of changes
Checklist: