diff --git a/autoca/ca.py b/autoca/ca.py index 366520726f8f47420a4fed583edccc8ed9d34b99..02227366365e449885f0133610c9da628c512dd6 100644 --- a/autoca/ca.py +++ b/autoca/ca.py @@ -1,3 +1,4 @@ +import OpenSSL from OpenSSL import crypto import logging import os @@ -9,6 +10,12 @@ from autoca import certutil log = logging.getLogger(__name__) +crl_export_args = { + 'digest': 'sha256', +} +if OpenSSL.__version__.startswith('0.'): + crl_export_args = {} + class CA(object): """A Certification Authority stored on the local filesystem.""" @@ -134,7 +141,7 @@ class CA(object): crl.add_revoked(revoked) self.storage.set_crl( crl.export(self.ca_crt, self.ca_key, crypto.FILETYPE_PEM, 30, - digest='sha256')) + **crl_export_args)) self._load_crl() def _load_crl(self): @@ -144,7 +151,7 @@ class CA(object): crl = crypto.CRL() self.crl_data_pem = crl.export(self.ca_crt, self.ca_key, crypto.FILETYPE_PEM, 30, - digest='sha256') + **crl_export_args) self.storage.set_crl(self.crl_data_pem) # Re-read the CRL data in DER and PEM formats. diff --git a/debian/changelog b/debian/changelog index 87b4263824e09d4fbff6ec260220c04747e110f5..8e4c818b5785464faa1cf13465a63b0299f4b192 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +autoca (0.3.2) unstable; urgency=low + + * Fix CRL generation with older OpenSSL versions. + + -- Autistici/Inventati <debian@autistici.org> Sat, 2 Sep 2017 05:40:32 +0000 + autoca (0.3.1) unstable; urgency=low * Added command to update the CRL. diff --git a/setup.py b/setup.py index b6ee62ab36f27be18aba3d95e1c132deae3d4cd1..65a55d8148fbbd4a2d6696c0e7d10420eada2b15 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages setup( name="autoca", - version="0.3.1", + version="0.3.2", description="Automated CA management.", author="Ale", author_email="ale@incal.net", diff --git a/tox.ini b/tox.ini index a9b19d0d4dbd34428d185bf12f3443c9d1a425bd..88a6b5c5714fec15fb2f890216cd4395cb334a0b 100644 --- a/tox.ini +++ b/tox.ini @@ -4,8 +4,8 @@ deps= coverage mox commands= - nosetests \ - --with-coverage --cover-package=autoca,autovpn --cover-erase --cover-html --cover-html-dir=htmlcov \ + nosetests -v \ + --with-coverage --cover-package=autoca --cover-erase --cover-html --cover-html-dir=htmlcov \ --with-xunit \ [] # substitute with tox' positional arguments