glyph / txsni

Simple support for running a TLS server with Twisted.
MIT License
25 stars 10 forks source link

Don't cache certificates #22

Closed markrwilliams closed 5 years ago

markrwilliams commented 5 years ago

Caching prevents the txsni: endpoint from loading regenerated certificates.

What might regenerate certificates? txacme or certbot!

markrwilliams commented 5 years ago

The failed test:

txsni.test.test_txsni
  TestCommunication
    test_specific_certificate ...                                          [OK]
  TestNegotiationStillWorks
    test_specific_cert_still_negotiates ...                                [OK]
  TestSNIDirectoryParser
    test_recreated_certificates ...                                      [FAIL]
  TestSNIMap
    test_snimap_default ...                                                [OK]
    test_snimap_makes_its_own_defaults ...                                 [OK]
===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/travis/build/glyph/txsni/txsni/test/test_txsni.py", line 304, in maybeRethrow
    exception[0].raiseException()
  File "/home/travis/build/glyph/txsni/.tox/py36-twlatest/lib/python3.6/site-packages/twisted/python/failure.py", line 467, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/home/travis/build/glyph/txsni/.tox/py36-twlatest/lib/python3.6/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/home/travis/build/glyph/txsni/txsni/test/test_txsni.py", line 291, in confirm_cert
    assert_cert_is(self, cert, HTTP2BIN_CERT_PATH)
  File "/home/travis/build/glyph/txsni/txsni/test/test_txsni.py", line 180, in assert_cert_is
    target_cert.digest('sha256')
  File "/home/travis/build/glyph/txsni/.tox/py36-twlatest/lib/python3.6/site-packages/twisted/trial/_synctest.py", line 432, in assertEqual
    super(_Assertions, self).assertEqual(first, second, msg)
  File "/opt/python/3.6.3/lib/python3.6/unittest/case.py", line 829, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/opt/python/3.6.3/lib/python3.6/unittest/case.py", line 822, in _baseAssertEqual
    raise self.failureException(msg)
twisted.trial.unittest.FailTest: b'F2:48:95:DF:0E:1A:A0:DE:4C:CD:17:40:45:C0[50 chars]0:4B' != b'10:19:9A:D7:B9:F1:18:EB:CC:B0:A0:65:F4:69[50 chars]5:5E'
txsni.test.test_txsni.TestSNIDirectoryParser.test_recreated_certificates
-------------------------------------------------------------------------------
Ran 5 tests in 0.521s
FAILED (failures=1, successes=4)
codecov-io commented 5 years ago

Codecov Report

Merging #22 into master will increase coverage by 5.98%. The diff coverage is 93.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
+ Coverage   87.77%   93.76%   +5.98%     
==========================================
  Files           7        6       -1     
  Lines         360      385      +25     
  Branches       27       28       +1     
==========================================
+ Hits          316      361      +45     
+ Misses         33       14      -19     
+ Partials       11       10       -1
Impacted Files Coverage Δ
txsni/test/certs/cert_builder.py 97.29% <100%> (+13.96%) :arrow_up:
txsni/parser.py 100% <100%> (+30%) :arrow_up:
txsni/snimap.py 91% <100%> (ø) :arrow_up:
txsni/test/test_txsni.py 94.19% <92.5%> (-0.85%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fc638e8...7a14957. Read the comment docs.