From 8dc52b859ba2e2183ebe52db510dd546dd13131c Mon Sep 17 00:00:00 2001 From: root Date: Wed, 11 Jul 2018 11:57:36 -0500 Subject: [PATCH 1/9] initial commit --- lemur/dns_providers/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lemur/dns_providers/__init__.py diff --git a/lemur/dns_providers/__init__.py b/lemur/dns_providers/__init__.py new file mode 100644 index 00000000..e69de29b From 825844107ef83953e594cff7a54dc15e3b5fbf1b Mon Sep 17 00:00:00 2001 From: Curtis Castrapel Date: Fri, 29 Jun 2018 14:03:45 -0700 Subject: [PATCH 2/9] updates --- requirements-docs.txt | 18 +++++++++--------- requirements-tests.txt | 12 ++++++------ requirements.txt | 15 +++++++-------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/requirements-docs.txt b/requirements-docs.txt index eee0ee35..146ddf25 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -7,16 +7,16 @@ acme==0.25.1 alabaster==0.7.11 # via sphinx alembic-autogenerate-enums==0.0.2 -alembic==0.9.9 -aniso8601==3.0.0 +alembic==0.9.10 +aniso8601==3.0.2 arrow==0.12.1 asn1crypto==0.24.0 asyncpool==1.0 babel==2.6.0 # via sphinx bcrypt==3.1.4 blinker==1.4 -boto3==1.7.39 -botocore==1.10.37 +boto3==1.7.48 +botocore==1.10.48 certifi==2018.4.16 cffi==1.11.5 click==6.7 @@ -55,9 +55,9 @@ ndg-httpsclient==0.5.0 packaging==17.1 # via sphinx paramiko==2.4.1 pbr==4.0.4 -pem==17.1.0 -psycopg2==2.7.4 -pyasn1-modules==0.2.1 +pem==18.1.0 +psycopg2==2.7.5 +pyasn1-modules==0.2.2 pyasn1==0.4.3 pycparser==2.18 pygments==2.2.0 # via sphinx @@ -68,7 +68,7 @@ pyparsing==2.2.0 # via packaging pyrfc3339==1.1 python-dateutil==2.7.3 python-editor==1.0.3 -pytz==2018.4 +pytz==2018.5 pyyaml==3.12 raven[flask]==6.9.0 requests-toolbelt==0.8.0 @@ -82,7 +82,7 @@ sphinx==1.7.5 sphinxcontrib-httpdomain==1.6.1 sphinxcontrib-websupport==1.1.0 # via sphinx sqlalchemy-utils==0.33.3 -sqlalchemy==1.2.8 +sqlalchemy==1.2.9 tabulate==0.8.2 werkzeug==0.14.1 xmltodict==0.11.0 diff --git a/requirements-tests.txt b/requirements-tests.txt index 4e19f638..1da5269f 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -8,9 +8,9 @@ asn1crypto==0.24.0 # via cryptography atomicwrites==1.1.5 # via pytest attrs==18.1.0 # via pytest aws-xray-sdk==0.95 # via moto -boto3==1.7.41 # via moto +boto3==1.7.48 # via moto boto==2.48.0 # via moto -botocore==1.10.41 # via boto3, moto, s3transfer +botocore==1.10.48 # via boto3, moto, s3transfer certifi==2018.4.16 # via requests cffi==1.11.5 # via cryptography chardet==3.0.4 # via requests @@ -19,7 +19,7 @@ cookies==2.2.1 # via moto, responses coverage==4.5.1 cryptography==2.2.2 # via moto docker-pycreds==0.3.0 # via docker -docker==3.4.0 # via moto +docker==3.4.1 # via moto docutils==0.14 # via botocore factory-boy==2.11.1 faker==0.8.16 @@ -38,15 +38,15 @@ moto==1.3.3 nose==1.3.7 pbr==4.0.4 # via mock pluggy==0.6.0 # via pytest -py==1.5.3 # via pytest +py==1.5.4 # via pytest pyaml==17.12.1 # via moto pycparser==2.18 # via cffi pyflakes==2.0.0 pytest-flask==0.10.0 pytest-mock==1.10.0 -pytest==3.6.1 +pytest==3.6.2 python-dateutil==2.6.1 # via botocore, faker, freezegun, moto -pytz==2018.4 # via moto +pytz==2018.5 # via moto pyyaml==3.12 # via pyaml requests-mock==1.5.0 requests==2.19.1 # via aws-xray-sdk, docker, moto, requests-mock, responses diff --git a/requirements.txt b/requirements.txt index 46839bda..dd6ce10f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,15 +6,15 @@ # acme==0.25.1 alembic-autogenerate-enums==0.0.2 -alembic==0.9.9 # via flask-migrate +alembic==0.9.10 # via flask-migrate aniso8601==3.0.2 # via flask-restful arrow==0.12.1 asn1crypto==0.24.0 # via cryptography asyncpool==1.0 bcrypt==3.1.4 # via flask-bcrypt, paramiko blinker==1.4 # via flask-mail, flask-principal, raven -boto3==1.7.41 -botocore==1.10.41 # via boto3, s3transfer +boto3==1.7.48 +botocore==1.10.48 # via boto3, s3transfer certifi==2018.4.16 cffi==1.11.5 # via bcrypt, cryptography, pynacl click==6.7 # via flask @@ -51,9 +51,9 @@ mock==2.0.0 # via acme ndg-httpsclient==0.5.0 paramiko==2.4.1 pbr==4.0.4 # via mock -pem==17.1.0 +pem==18.1.0 psycopg2==2.7.5 -pyasn1-modules==0.2.1 # via python-ldap +pyasn1-modules==0.2.2 # via python-ldap pyasn1==0.4.3 # via ndg-httpsclient, paramiko, pyasn1-modules, python-ldap, requests pycparser==2.18 # via cffi pyjwt==1.6.4 @@ -63,7 +63,7 @@ pyrfc3339==1.1 # via acme python-dateutil==2.7.3 # via alembic, arrow, botocore python-editor==1.0.3 # via alembic python-ldap==3.1.0 -pytz==2018.4 # via acme, flask-restful, pyrfc3339 +pytz==2018.5 # via acme, flask-restful, pyrfc3339 pyyaml==3.12 # via cloudflare raven[flask]==6.9.0 requests-toolbelt==0.8.0 # via acme @@ -72,8 +72,7 @@ retrying==1.3.3 s3transfer==0.1.13 # via boto3 six==1.11.0 sqlalchemy-utils==0.33.3 -sqlalchemy==1.2.8 # via alembic, flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils +sqlalchemy==1.2.9 # via alembic, flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils tabulate==0.8.2 -tld==0.9 werkzeug==0.14.1 # via flask xmltodict==0.11.0 From 9ef356f59da805f1e27bf4b055be2e797bf4db69 Mon Sep 17 00:00:00 2001 From: Curtis Castrapel Date: Fri, 29 Jun 2018 15:24:31 -0700 Subject: [PATCH 3/9] reformat code (noop) --- lemur/dns_providers/schemas.py | 4 ++-- lemur/dns_providers/service.py | 1 + lemur/dns_providers/views.py | 1 + lemur/plugins/lemur_acme/plugin.py | 6 +++--- lemur/plugins/lemur_acme/tests/test_acme.py | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lemur/dns_providers/schemas.py b/lemur/dns_providers/schemas.py index d871b8ef..05b6471d 100644 --- a/lemur/dns_providers/schemas.py +++ b/lemur/dns_providers/schemas.py @@ -1,8 +1,8 @@ +from marshmallow import fields + from lemur.common.fields import ArrowDateTime from lemur.common.schema import LemurInputSchema, LemurOutputSchema -from marshmallow import fields - class DnsProvidersNestedOutputSchema(LemurOutputSchema): __envelope__ = False diff --git a/lemur/dns_providers/service.py b/lemur/dns_providers/service.py index 442b2c31..c96b864a 100644 --- a/lemur/dns_providers/service.py +++ b/lemur/dns_providers/service.py @@ -1,6 +1,7 @@ import json from flask import current_app + from lemur import database from lemur.dns_providers.models import DnsProvider diff --git a/lemur/dns_providers/views.py b/lemur/dns_providers/views.py index b9543034..1f5b3164 100644 --- a/lemur/dns_providers/views.py +++ b/lemur/dns_providers/views.py @@ -21,6 +21,7 @@ api = Api(mod) class DnsProvidersList(AuthenticatedResource): """ Defines the 'dns_providers' endpoint """ + def __init__(self): self.reqparse = reqparse.RequestParser() super(DnsProvidersList, self).__init__() diff --git a/lemur/plugins/lemur_acme/plugin.py b/lemur/plugins/lemur_acme/plugin.py index 43f5244b..f472a965 100644 --- a/lemur/plugins/lemur_acme/plugin.py +++ b/lemur/plugins/lemur_acme/plugin.py @@ -19,8 +19,8 @@ import OpenSSL.crypto import josepy as jose from acme import challenges, messages from acme.client import BackwardsCompatibleClientV2, ClientNetwork -from acme.messages import Error as AcmeError from acme.errors import PollError, WildcardUnsupportedError +from acme.messages import Error as AcmeError from botocore.exceptions import ClientError from flask import current_app @@ -121,8 +121,8 @@ def request_certificate(acme_client, authorizations, csr, order): raise pem_certificate = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM, - OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, - orderr.fullchain_pem)).decode() + OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, + orderr.fullchain_pem)).decode() pem_certificate_chain = orderr.fullchain_pem[len(pem_certificate):].lstrip() current_app.logger.debug("{0} {1}".format(type(pem_certificate), type(pem_certificate_chain))) diff --git a/lemur/plugins/lemur_acme/tests/test_acme.py b/lemur/plugins/lemur_acme/tests/test_acme.py index f8b58f46..2a358a63 100644 --- a/lemur/plugins/lemur_acme/tests/test_acme.py +++ b/lemur/plugins/lemur_acme/tests/test_acme.py @@ -281,7 +281,8 @@ class TestAcme(unittest.TestCase): @patch('lemur.plugins.lemur_acme.plugin.finalize_authorizations') @patch('lemur.plugins.lemur_acme.plugin.request_certificate') @patch('lemur.plugins.lemur_acme.plugin.authorization_service') - def test_create_certificate(self, mock_authorization_service, mock_request_certificate, mock_finalize_authorizations, mock_get_authorizations, + def test_create_certificate(self, mock_authorization_service, mock_request_certificate, + mock_finalize_authorizations, mock_get_authorizations, mock_current_app, mock_dns_provider_service, mock_acme): provider = plugin.ACMEIssuerPlugin() mock_authority = Mock() From 64132ba92bc1133892ead385bb907657954e086e Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Fri, 18 Aug 2017 15:13:27 +0300 Subject: [PATCH 4/9] Expose certificate dateCreated via API --- lemur/certificates/schemas.py | 1 + lemur/certificates/views.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lemur/certificates/schemas.py b/lemur/certificates/schemas.py index 99e520c4..72b42fb9 100644 --- a/lemur/certificates/schemas.py +++ b/lemur/certificates/schemas.py @@ -187,6 +187,7 @@ class CertificateOutputSchema(LemurOutputSchema): issuer = fields.String() name = fields.String() dns_provider_id = fields.Integer(required=False, allow_none=True) + date_created = ArrowDateTime() rotation = fields.Boolean() diff --git a/lemur/certificates/views.py b/lemur/certificates/views.py index 72cb3b5a..cdfd06a3 100644 --- a/lemur/certificates/views.py +++ b/lemur/certificates/views.py @@ -83,6 +83,7 @@ class CertificatesList(AuthenticatedResource): "serial": "82311058732025924142789179368889309156", "id": 2288, "issuer": "SymantecCorporation", + "dateCreated": "2016-06-03T06:09:42.133769+00:00", "notBefore": "2016-06-03T00:00:00+00:00", "notAfter": "2018-01-12T23:59:59+00:00", "destinations": [], @@ -214,6 +215,7 @@ class CertificatesList(AuthenticatedResource): "serial": "82311058732025924142789179368889309156", "id": 2288, "issuer": "SymantecCorporation", + "dateCreated": "2016-06-03T06:09:42.133769+00:00", "notBefore": "2016-06-03T00:00:00+00:00", "notAfter": "2018-01-12T23:59:59+00:00", "destinations": [], @@ -334,6 +336,7 @@ class CertificatesUpload(AuthenticatedResource): "serial": "82311058732025924142789179368889309156", "id": 2288, "issuer": "SymantecCorporation", + "dateCreated": "2016-06-03T06:09:42.133769+00:00", "notBefore": "2016-06-03T00:00:00+00:00", "notAfter": "2018-01-12T23:59:59+00:00", "destinations": [], @@ -498,6 +501,7 @@ class Certificates(AuthenticatedResource): "serial": "82311058732025924142789179368889309156", "id": 2288, "issuer": "SymantecCorporation", + "dateCreated": "2016-06-03T06:09:42.133769+00:00", "notBefore": "2016-06-03T00:00:00+00:00", "notAfter": "2018-01-12T23:59:59+00:00", "destinations": [], @@ -587,6 +591,7 @@ class Certificates(AuthenticatedResource): "serial": "82311058732025924142789179368889309156", "id": 2288, "issuer": "SymantecCorporation", + "dateCreated": "2016-06-03T06:09:42.133769+00:00", "notBefore": "2016-06-03T00:00:00+00:00", "notAfter": "2018-01-12T23:59:59+00:00", "destinations": [], @@ -700,6 +705,7 @@ class NotificationCertificatesList(AuthenticatedResource): "serial": "82311058732025924142789179368889309156", "id": 2288, "issuer": "SymantecCorporation", + "dateCreated": "2016-06-03T06:09:42.133769+00:00", "notBefore": "2016-06-03T00:00:00+00:00", "notAfter": "2018-01-12T23:59:59+00:00", "destinations": [], @@ -807,6 +813,7 @@ class CertificatesReplacementsList(AuthenticatedResource): "serial": "82311058732025924142789179368889309156", "id": 2288, "issuer": "SymantecCorporation", + "dateCreated": "2016-06-03T06:09:42.133769+00:00", "notBefore": "2016-06-03T00:00:00+00:00", "notAfter": "2018-01-12T23:59:59+00:00", "destinations": [], From b472e5e648c3e004210ae3e88d162753d31045fb Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Tue, 19 Jun 2018 18:41:12 +0300 Subject: [PATCH 5/9] Cache parsed certificate instead of re-parsing for each field Use @cached_property decorator to cache the results of parse_certificate(). This significantly cuts down on the number of times certs need to be parsed for a list view. --- lemur/certificates/models.py | 39 +++++++++++++++----------------- lemur/tests/test_certificates.py | 17 ++++++++++++++ 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/lemur/certificates/models.py b/lemur/certificates/models.py index f88eda0a..ad6949b1 100644 --- a/lemur/certificates/models.py +++ b/lemur/certificates/models.py @@ -21,6 +21,7 @@ from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy import event, Integer, ForeignKey, String, PassiveDefault, func, Column, Text, Boolean from sqlalchemy_utils.types.arrow import ArrowType +from werkzeug.utils import cached_property import lemur.common.utils @@ -142,7 +143,8 @@ class Certificate(db.Model): sensitive_fields = ('private_key',) def __init__(self, **kwargs): - cert = lemur.common.utils.parse_certificate(kwargs['body']) + self.body = kwargs['body'].strip() + cert = self.parsed_cert self.issuer = defaults.issuer(cert) self.cn = defaults.common_name(cert) @@ -159,7 +161,6 @@ class Certificate(db.Model): defaults.certificate_name(self.cn, self.issuer, self.not_before, self.not_after, self.san), self.serial) self.owner = kwargs['owner'] - self.body = kwargs['body'].strip() if kwargs.get('private_key'): self.private_key = kwargs['private_key'].strip() @@ -184,40 +185,39 @@ class Certificate(db.Model): for domain in defaults.domains(cert): self.domains.append(Domain(name=domain)) + @cached_property + def parsed_cert(self): + assert self.body, "Certificate body not set" + return lemur.common.utils.parse_certificate(self.body) + @property def active(self): return self.notify @property def organization(self): - cert = lemur.common.utils.parse_certificate(self.body) - return defaults.organization(cert) + return defaults.organization(self.parsed_cert) @property def organizational_unit(self): - cert = lemur.common.utils.parse_certificate(self.body) - return defaults.organizational_unit(cert) + return defaults.organizational_unit(self.parsed_cert) @property def country(self): - cert = lemur.common.utils.parse_certificate(self.body) - return defaults.country(cert) + return defaults.country(self.parsed_cert) @property def state(self): - cert = lemur.common.utils.parse_certificate(self.body) - return defaults.state(cert) + return defaults.state(self.parsed_cert) @property def location(self): - cert = lemur.common.utils.parse_certificate(self.body) - return defaults.location(cert) + return defaults.location(self.parsed_cert) @property def key_type(self): - cert = lemur.common.utils.parse_certificate(self.body) - if isinstance(cert.public_key(), rsa.RSAPublicKey): - return 'RSA{key_size}'.format(key_size=cert.public_key().key_size) + if isinstance(self.parsed_cert.public_key(), rsa.RSAPublicKey): + return 'RSA{key_size}'.format(key_size=self.parsed_cert.public_key().key_size) @property def validity_remaining(self): @@ -229,13 +229,11 @@ class Certificate(db.Model): @property def subject(self): - cert = lemur.common.utils.parse_certificate(self.body) - return cert.subject + return self.parsed_cert.subject @property def public_key(self): - cert = lemur.common.utils.parse_certificate(self.body) - return cert.public_key() + return self.parsed_cert.public_key() @hybrid_property def expired(self): @@ -300,8 +298,7 @@ class Certificate(db.Model): } try: - cert = lemur.common.utils.parse_certificate(self.body) - for extension in cert.extensions: + for extension in self.parsed_cert.extensions: value = extension.value if isinstance(value, x509.BasicConstraints): return_extensions['basic_constraints'] = value diff --git a/lemur/tests/test_certificates.py b/lemur/tests/test_certificates.py index 98283a9d..3368f88d 100644 --- a/lemur/tests/test_certificates.py +++ b/lemur/tests/test_certificates.py @@ -9,9 +9,11 @@ from cryptography import x509 from cryptography.hazmat.backends import default_backend from marshmallow import ValidationError from freezegun import freeze_time +from mock import patch from lemur.certificates.service import create_csr from lemur.certificates.views import * # noqa +from lemur.common import utils from lemur.domains.models import Domain @@ -66,6 +68,21 @@ def test_get_certificate_primitives(certificate): assert len(primitives) == 24 +def test_certificate_output_schema(session, certificate, issuer_plugin): + from lemur.certificates.schemas import CertificateOutputSchema + + # Clear the cached attribute first + if 'parsed_cert' in certificate.__dict__: + del certificate.__dict__['parsed_cert'] + + # Make sure serialization parses the cert only once (uses cached 'parsed_cert' attribute) + with patch('lemur.common.utils.parse_certificate', side_effect=utils.parse_certificate) as wrapper: + data, errors = CertificateOutputSchema().dump(certificate) + assert data['issuer'] == 'Example' + + assert wrapper.call_count == 1 + + def test_certificate_edit_schema(session): from lemur.certificates.schemas import CertificateEditInputSchema From 149caa5602439d8ed905226a84186c3b399adab9 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Wed, 27 Jun 2018 13:56:39 +0300 Subject: [PATCH 6/9] Clean up module imports Example: * import lemur.common.utils -> from lemur.common import utils * import sqlalchemy.types as types -> from sqlalchemy import types --- lemur/auth/views.py | 2 +- lemur/certificates/models.py | 6 ++---- lemur/pending_certificates/models.py | 5 ++--- lemur/utils.py | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lemur/auth/views.py b/lemur/auth/views.py index 347f0393..7a1bb34c 100644 --- a/lemur/auth/views.py +++ b/lemur/auth/views.py @@ -21,7 +21,7 @@ from lemur.common.utils import get_psuedo_random_string from lemur.users import service as user_service from lemur.roles import service as role_service from lemur.auth.service import create_token, fetch_token_header, get_rsa_public_key -import lemur.auth.ldap as ldap +from lemur.auth import ldap mod = Blueprint('auth', __name__) diff --git a/lemur/certificates/models.py b/lemur/certificates/models.py index ad6949b1..f5b60ad5 100644 --- a/lemur/certificates/models.py +++ b/lemur/certificates/models.py @@ -23,13 +23,11 @@ from sqlalchemy import event, Integer, ForeignKey, String, PassiveDefault, func, from sqlalchemy_utils.types.arrow import ArrowType from werkzeug.utils import cached_property -import lemur.common.utils - from lemur.database import db from lemur.extensions import sentry from lemur.utils import Vault -from lemur.common import defaults +from lemur.common import defaults, utils from lemur.plugins.base import plugins @@ -188,7 +186,7 @@ class Certificate(db.Model): @cached_property def parsed_cert(self): assert self.body, "Certificate body not set" - return lemur.common.utils.parse_certificate(self.body) + return utils.parse_certificate(self.body) @property def active(self): diff --git a/lemur/pending_certificates/models.py b/lemur/pending_certificates/models.py index f8ebc7ab..a43834d4 100644 --- a/lemur/pending_certificates/models.py +++ b/lemur/pending_certificates/models.py @@ -10,9 +10,8 @@ from sqlalchemy import Integer, ForeignKey, String, PassiveDefault, func, Column from sqlalchemy_utils.types.arrow import ArrowType from sqlalchemy_utils import JSONType -import lemur.common.utils from lemur.certificates.models import get_or_increase_name -from lemur.common import defaults +from lemur.common import defaults, utils from lemur.database import db from lemur.utils import Vault @@ -81,7 +80,7 @@ class PendingCertificate(db.Model): dt.now(), dt.now(), False), self.external_id) self.rename = True - self.cn = defaults.common_name(lemur.common.utils.parse_csr(self.csr)) + self.cn = defaults.common_name(utils.parse_csr(self.csr)) self.owner = kwargs['owner'] self.number_attempts = 0 diff --git a/lemur/utils.py b/lemur/utils.py index 6c82657c..1661e3f7 100644 --- a/lemur/utils.py +++ b/lemur/utils.py @@ -9,7 +9,7 @@ import os import tempfile from contextlib import contextmanager -import sqlalchemy.types as types +from sqlalchemy import types from cryptography.fernet import Fernet, MultiFernet from flask import current_app From 2f32014c75d4707e8fcd48ee8865e7eb3fb290db Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Tue, 19 Jun 2018 18:41:12 +0300 Subject: [PATCH 7/9] Cache parsed certificate instead of re-parsing for each field Use @cached_property decorator to cache the results of parse_certificate(). This significantly cuts down on the number of times certs need to be parsed for a list view. --- lemur/certificates/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lemur/certificates/models.py b/lemur/certificates/models.py index f5b60ad5..87ee3b93 100644 --- a/lemur/certificates/models.py +++ b/lemur/certificates/models.py @@ -23,6 +23,8 @@ from sqlalchemy import event, Integer, ForeignKey, String, PassiveDefault, func, from sqlalchemy_utils.types.arrow import ArrowType from werkzeug.utils import cached_property +import lemur.common.utils + from lemur.database import db from lemur.extensions import sentry @@ -186,7 +188,7 @@ class Certificate(db.Model): @cached_property def parsed_cert(self): assert self.body, "Certificate body not set" - return utils.parse_certificate(self.body) + return lemur.common.utils.parse_certificate(self.body) @property def active(self): From ead374db5fa575881f92550921a26d1a19c99818 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Wed, 27 Jun 2018 13:56:39 +0300 Subject: [PATCH 8/9] Clean up module imports Example: * import lemur.common.utils -> from lemur.common import utils * import sqlalchemy.types as types -> from sqlalchemy import types --- lemur/certificates/models.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lemur/certificates/models.py b/lemur/certificates/models.py index 87ee3b93..f5b60ad5 100644 --- a/lemur/certificates/models.py +++ b/lemur/certificates/models.py @@ -23,8 +23,6 @@ from sqlalchemy import event, Integer, ForeignKey, String, PassiveDefault, func, from sqlalchemy_utils.types.arrow import ArrowType from werkzeug.utils import cached_property -import lemur.common.utils - from lemur.database import db from lemur.extensions import sentry @@ -188,7 +186,7 @@ class Certificate(db.Model): @cached_property def parsed_cert(self): assert self.body, "Certificate body not set" - return lemur.common.utils.parse_certificate(self.body) + return utils.parse_certificate(self.body) @property def active(self): From a19a47dba1d8a22ae41e2e6401b7c642c735dca4 Mon Sep 17 00:00:00 2001 From: Curtis Castrapel Date: Thu, 12 Jul 2018 13:24:44 -0700 Subject: [PATCH 9/9] updated requirements --- requirements-dev.txt | 8 ++++---- requirements-docs.txt | 2 +- requirements-tests.txt | 14 +++++++------- requirements.txt | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 4f6d3603..58d6e277 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -10,16 +10,16 @@ certifi==2018.4.16 # via requests cfgv==1.1.0 # via pre-commit chardet==3.0.4 # via requests flake8==3.5.0 -identify==1.1.0 # via pre-commit +identify==1.1.3 # via pre-commit idna==2.7 # via requests -invoke==1.0.0 +invoke==1.1.0 mccabe==0.6.1 # via flake8 nodeenv==1.3.1 pkginfo==1.4.2 # via twine -pre-commit==1.10.2 +pre-commit==1.10.3 pycodestyle==2.3.1 # via flake8 pyflakes==1.6.0 # via flake8 -pyyaml==3.12 # via aspy.yaml, pre-commit +pyyaml==3.13 # via aspy.yaml, pre-commit requests-toolbelt==0.8.0 # via twine requests==2.19.1 # via requests-toolbelt, twine six==1.11.0 # via cfgv, pre-commit diff --git a/requirements-docs.txt b/requirements-docs.txt index 146ddf25..9cfa1b7b 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -79,7 +79,7 @@ six==1.11.0 snowballstemmer==1.2.1 # via sphinx sphinx-rtd-theme==0.4.0 sphinx==1.7.5 -sphinxcontrib-httpdomain==1.6.1 +sphinxcontrib-httpdomain==1.7.0 sphinxcontrib-websupport==1.1.0 # via sphinx sqlalchemy-utils==0.33.3 sqlalchemy==1.2.9 diff --git a/requirements-tests.txt b/requirements-tests.txt index 1da5269f..219c445a 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -8,9 +8,9 @@ asn1crypto==0.24.0 # via cryptography atomicwrites==1.1.5 # via pytest attrs==18.1.0 # via pytest aws-xray-sdk==0.95 # via moto -boto3==1.7.48 # via moto -boto==2.48.0 # via moto -botocore==1.10.48 # via boto3, moto, s3transfer +boto3==1.7.56 # via moto +boto==2.49.0 # via moto +botocore==1.10.56 # via boto3, moto, s3transfer certifi==2018.4.16 # via requests cffi==1.11.5 # via cryptography chardet==3.0.4 # via requests @@ -22,7 +22,7 @@ docker-pycreds==0.3.0 # via docker docker==3.4.1 # via moto docutils==0.14 # via botocore factory-boy==2.11.1 -faker==0.8.16 +faker==0.8.17 flask==1.0.2 # via pytest-flask freezegun==0.3.10 idna==2.7 # via cryptography, requests @@ -36,7 +36,7 @@ mock==2.0.0 # via moto more-itertools==4.2.0 # via pytest moto==1.3.3 nose==1.3.7 -pbr==4.0.4 # via mock +pbr==4.1.0 # via mock pluggy==0.6.0 # via pytest py==1.5.4 # via pytest pyaml==17.12.1 # via moto @@ -44,10 +44,10 @@ pycparser==2.18 # via cffi pyflakes==2.0.0 pytest-flask==0.10.0 pytest-mock==1.10.0 -pytest==3.6.2 +pytest==3.6.3 python-dateutil==2.6.1 # via botocore, faker, freezegun, moto pytz==2018.5 # via moto -pyyaml==3.12 # via pyaml +pyyaml==3.13 # via pyaml requests-mock==1.5.0 requests==2.19.1 # via aws-xray-sdk, docker, moto, requests-mock, responses responses==0.9.0 # via moto diff --git a/requirements.txt b/requirements.txt index dd6ce10f..d80d7e09 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ # # pip-compile --no-index --output-file requirements.txt requirements.in # -acme==0.25.1 +acme==0.26.0 alembic-autogenerate-enums==0.0.2 alembic==0.9.10 # via flask-migrate aniso8601==3.0.2 # via flask-restful @@ -13,8 +13,8 @@ asn1crypto==0.24.0 # via cryptography asyncpool==1.0 bcrypt==3.1.4 # via flask-bcrypt, paramiko blinker==1.4 # via flask-mail, flask-principal, raven -boto3==1.7.48 -botocore==1.10.48 # via boto3, s3transfer +boto3==1.7.56 +botocore==1.10.56 # via boto3, s3transfer certifi==2018.4.16 cffi==1.11.5 # via bcrypt, cryptography, pynacl click==6.7 # via flask @@ -34,7 +34,7 @@ flask-script==2.0.6 flask-sqlalchemy==2.3.2 flask==0.12 future==0.16.0 -gunicorn==19.8.1 +gunicorn==19.9.0 idna==2.7 # via cryptography inflection==0.3.1 itsdangerous==0.24 # via flask @@ -50,7 +50,7 @@ marshmallow==2.15.3 mock==2.0.0 # via acme ndg-httpsclient==0.5.0 paramiko==2.4.1 -pbr==4.0.4 # via mock +pbr==4.1.0 # via mock pem==18.1.0 psycopg2==2.7.5 pyasn1-modules==0.2.2 # via python-ldap @@ -64,7 +64,7 @@ python-dateutil==2.7.3 # via alembic, arrow, botocore python-editor==1.0.3 # via alembic python-ldap==3.1.0 pytz==2018.5 # via acme, flask-restful, pyrfc3339 -pyyaml==3.12 # via cloudflare +pyyaml==3.13 # via cloudflare raven[flask]==6.9.0 requests-toolbelt==0.8.0 # via acme requests[security]==2.11.1