Skip to content

Instantly share code, notes, and snippets.

@Ramblurr
Created February 19, 2015 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ramblurr/bf48299caaadeb17d392 to your computer and use it in GitHub Desktop.
Save Ramblurr/bf48299caaadeb17d392 to your computer and use it in GitHub Desktop.
A minimum proof of concept for the ssl bundle location bug

Running ebook-convert poc.recipe foo.mobi --test

  1. Case 1 /etc/ssl/cert.pem exists
1% Converting input to HTML...
InputFormatPlugin: Recipe Input running
Using custom recipe
SSL verification succeeded! You're not affected.
  1. Case 2 /etc/ssl/cert.pem does not exist
1% Converting input to HTML...
InputFormatPlugin: Recipe Input running
Using custom recipe
^[[ATraceback (most recent call last):
  File "site.py", line 51, in main
  File "site-packages/calibre/ebooks/conversion/cli.py", line 360, in main
  File "site-packages/calibre/ebooks/conversion/plumber.py", line 1041, in run
  File "site-packages/calibre/customize/conversion.py", line 241, in __call__
  File "site-packages/calibre/ebooks/conversion/plugins/recipe_input.py", line 116, in convert
  File "site-packages/calibre/web/feeds/news.py", line 887, in __init__
  File "<string>", line 13, in get_browser
  File "site-packages/mechanize/_mechanize.py", line 203, in open
  File "site-packages/mechanize/_mechanize.py", line 230, in _mech_open
  File "site-packages/mechanize/_opener.py", line 193, in open
  File "site-packages/mechanize/_urllib2_fork.py", line 344, in _open
  File "site-packages/mechanize/_urllib2_fork.py", line 332, in _call_chain
  File "site-packages/mechanize/_urllib2_fork.py", line 1170, in https_open
  File "site-packages/mechanize/_urllib2_fork.py", line 1118, in do_open
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
'''
SSL Cert Bundle Bug Proof of Concept
'''
import sys
from calibre.web.feeds.recipes import BasicNewsRecipe
class POCRecipe(BasicNewsRecipe):
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
br.open('https://google.com')
print("SSL verification succeeded! You're not affected.") # If we get here, the bug doesn't affect you. This is good!
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment