From 2d7a6ccf3c6d87a2f274910182e091dea56640e0 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Thu, 25 Aug 2016 10:09:46 -0700 Subject: [PATCH] Owner email (#414) * Ensuring python2 works with unicode strings. * adding in owner DN * fixing tests * Upgrading requests. * Fixing tests. --- lemur/certificates/service.py | 1 + lemur/common/utils.py | 2 +- lemur/tests/test_certificates.py | 5 +++-- setup.py | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lemur/certificates/service.py b/lemur/certificates/service.py index 41521315..cd5786c7 100644 --- a/lemur/certificates/service.py +++ b/lemur/certificates/service.py @@ -322,6 +322,7 @@ def create_csr(**csr_config): x509.NameAttribute(x509.OID_COUNTRY_NAME, csr_config['country']), x509.NameAttribute(x509.OID_STATE_OR_PROVINCE_NAME, csr_config['state']), x509.NameAttribute(x509.OID_LOCALITY_NAME, csr_config['location']), + x509.NameAttribute(x509.OID_EMAIL_ADDRESS, csr_config['owner']) ])) builder = builder.add_extension( diff --git a/lemur/common/utils.py b/lemur/common/utils.py index 82d7f900..6934b9a5 100644 --- a/lemur/common/utils.py +++ b/lemur/common/utils.py @@ -40,4 +40,4 @@ def parse_certificate(body): if isinstance(body, bytes): return x509.load_pem_x509_certificate(body, default_backend()) return x509.load_pem_x509_certificate(bytes(body, 'utf8'), default_backend()) - return x509.load_pem_x509_certificate(body, default_backend()) + return x509.load_pem_x509_certificate(str(body), default_backend()) diff --git a/lemur/tests/test_certificates.py b/lemur/tests/test_certificates.py index f0beb54d..9f9edf9d 100644 --- a/lemur/tests/test_certificates.py +++ b/lemur/tests/test_certificates.py @@ -284,6 +284,7 @@ def test_create_basic_csr(client): country='US', state='CA', location='A place', + owner='joe@example.com', extensions=dict(names=dict(sub_alt_names=['test.example.com', 'test2.example.com'])) ) csr, pem = create_csr(**csr_config) @@ -328,12 +329,12 @@ def test_create_csr(): from lemur.certificates.service import create_csr csr, private_key = create_csr(common_name='ACommonName', organization='test', organizational_unit='Meters', country='US', - state='CA', location='Here') + state='CA', location='Here', owner='joe@example.com') assert csr assert private_key extensions = {'sub_alt_names': {'names': [{'name_type': 'DNSName', 'value': 'AnotherCommonName'}]}} - csr, private_key = create_csr(common_name='ACommonName', organization='test', organizational_unit='Meters', country='US', + csr, private_key = create_csr(owner='joe@example.com', common_name='ACommonName', organization='test', organizational_unit='Meters', country='US', state='CA', location='Here', extensions=extensions) assert csr assert private_key diff --git a/setup.py b/setup.py index 6c6619be..a9f1bc78 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ install_requires = [ 'Flask-Mail==0.9.1', 'SQLAlchemy-Utils==0.31.4', 'BeautifulSoup4==4.4.1', - 'requests==2.9.1', + 'requests==2.11.1', 'psycopg2==2.6.1', 'arrow==0.7.0', 'six==1.10.0', @@ -52,7 +52,7 @@ install_requires = [ 'marshmallow-sqlalchemy==0.8.0', 'marshmallow==2.4.0', 'pycrypto==2.6.1', - 'cryptography==1.3.2', + 'cryptography==1.4', 'pyopenssl==0.15.1', 'pyjwt==1.4.0', 'xmltodict==0.9.2',