diff --git a/bower.json b/bower.json index 7a76915f..2b1d85f6 100644 --- a/bower.json +++ b/bower.json @@ -20,7 +20,6 @@ "angular-loading-bar": "~0.8.0", "angular-moment": "~0.10.3", "moment-range": "~2.1.0", - "angular-spinkit": "~0.3.3", "angular-clipboard": "~1.3.0", "angularjs-toaster": "~1.0.0", "angular-chart.js": "~0.8.8", diff --git a/lemur/certificates/cli.py b/lemur/certificates/cli.py index bc129a75..f17ed8ba 100644 --- a/lemur/certificates/cli.py +++ b/lemur/certificates/cli.py @@ -196,6 +196,8 @@ def reissue(old_certificate_name, commit): if commit: print("[!] Running in COMMIT mode.") + print("[+] Starting certificate re-issuance.") + old_cert = validate_certificate(old_certificate_name) if not old_cert: diff --git a/lemur/certificates/models.py b/lemur/certificates/models.py index ff44f804..5b6c1f72 100644 --- a/lemur/certificates/models.py +++ b/lemur/certificates/models.py @@ -66,7 +66,7 @@ class Certificate(db.Model): bits = Column(Integer()) san = Column(String(1024)) # TODO this should be migrated to boolean - rotation = Column(Boolean) + rotation = Column(Boolean, default=False) user_id = Column(Integer, ForeignKey('users.id')) authority_id = Column(Integer, ForeignKey('authorities.id', ondelete="CASCADE")) diff --git a/lemur/certificates/schemas.py b/lemur/certificates/schemas.py index 6cc4fa70..cc037992 100644 --- a/lemur/certificates/schemas.py +++ b/lemur/certificates/schemas.py @@ -62,6 +62,7 @@ class CertificateInputSchema(CertificateCreationSchema): key_type = fields.String(validate=validate.OneOf(['RSA2048', 'RSA4096']), missing='RSA2048') notify = fields.Boolean(default=True) + rotation = fields.Boolean() # certificate body fields organizational_unit = fields.String(missing=lambda: current_app.config.get('LEMUR_DEFAULT_ORGANIZATIONAL_UNIT')) @@ -84,9 +85,11 @@ class CertificateInputSchema(CertificateCreationSchema): class CertificateEditInputSchema(CertificateSchema): - notify = fields.Boolean() owner = fields.String() + notify = fields.Boolean() + rotation = fields.Boolean() + destinations = fields.Nested(AssociatedDestinationSchema, missing=[], many=True) notifications = fields.Nested(AssociatedNotificationSchema, missing=[], many=True) replaces = fields.Nested(AssociatedCertificateSchema, missing=[], many=True) @@ -116,12 +119,20 @@ class CertificateEditInputSchema(CertificateSchema): class CertificateNestedOutputSchema(LemurOutputSchema): __envelope__ = False id = fields.Integer() - active = fields.Boolean() + name = fields.String() + owner = fields.Email() + creator = fields.Nested(UserNestedOutputSchema) + description = fields.String() + + status = fields.Boolean() + bits = fields.Integer() body = fields.String() chain = fields.String() - description = fields.String() - name = fields.String() + active = fields.Boolean() + + rotation = fields.Boolean() + notify = fields.Boolean() # Note aliasing is the first step in deprecating these fields. cn = fields.String() # deprecated @@ -133,9 +144,6 @@ class CertificateNestedOutputSchema(LemurOutputSchema): not_before = fields.DateTime() # deprecated validity_start = ArrowDateTime(attribute='not_before') - owner = fields.Email() - status = fields.Boolean() - creator = fields.Nested(UserNestedOutputSchema) issuer = fields.Nested(AuthorityNestedOutputSchema) @@ -155,6 +163,8 @@ class CertificateOutputSchema(LemurOutputSchema): issuer = fields.String() name = fields.String() + rotation = fields.Boolean() + # Note aliasing is the first step in deprecating these fields. notify = fields.Boolean() active = fields.Boolean(attribute='notify') diff --git a/lemur/certificates/service.py b/lemur/certificates/service.py index 238c03cb..932b84ca 100644 --- a/lemur/certificates/service.py +++ b/lemur/certificates/service.py @@ -126,26 +126,16 @@ def export(cert, export_plugin): return plugin.export(cert.body, cert.chain, cert.private_key, export_plugin['pluginOptions']) -def update(cert_id, owner, description, notify, destinations, notifications, replaces, roles): +def update(cert_id, **kwargs): """ Updates a certificate :param cert_id: - :param owner: - :param description: - :param notify: - :param destinations: - :param notifications: - :param replaces: :return: """ cert = get(cert_id) - cert.notify = notify - cert.description = description - cert.destinations = destinations - cert.notifications = notifications - cert.roles = roles - cert.replaces = replaces - cert.owner = owner + + for key, value in kwargs.items(): + setattr(cert, key, value) return database.update(cert) @@ -555,7 +545,7 @@ def reissue_certificate(certificate, replace=None, user=None): primitives['creator'] = user if replace: - primitives['replacements'] = [certificate] + primitives['replaces'] = [certificate] new_cert = create(**primitives) diff --git a/lemur/certificates/views.py b/lemur/certificates/views.py index 901f9949..7bf3ec76 100644 --- a/lemur/certificates/views.py +++ b/lemur/certificates/views.py @@ -638,18 +638,13 @@ class Certificates(AuthenticatedResource): for destination in data['destinations']: if destination.plugin.requires_key: if not cert.private_key: - return dict(message='Unable to add destination: {0}. Certificate does not have required private key.'.format(destination.label)), 400 + return dict( + message='Unable to add destination: {0}. Certificate does not have required private key.'.format( + destination.label + ) + ), 400 - return service.update( - certificate_id, - data['owner'], - data['description'], - data['notify'], - data['destinations'], - data['notifications'], - data['replacements'], - data['roles'] - ) + return service.update(certificate_id) class NotificationCertificatesList(AuthenticatedResource): diff --git a/lemur/static/app/angular/app.js b/lemur/static/app/angular/app.js index 4308992f..e162516f 100644 --- a/lemur/static/app/angular/app.js +++ b/lemur/static/app/angular/app.js @@ -10,7 +10,6 @@ 'restangular', 'angular-loading-bar', 'ui.bootstrap', - 'angular-spinkit', 'toaster', 'uiSwitch', 'mgo-angular-wizard', diff --git a/lemur/static/app/angular/certificates/certificate/certificateWizard.tpl.html b/lemur/static/app/angular/certificates/certificate/certificateWizard.tpl.html index 89bfa137..eb687bcc 100644 --- a/lemur/static/app/angular/certificates/certificate/certificateWizard.tpl.html +++ b/lemur/static/app/angular/certificates/certificate/certificateWizard.tpl.html @@ -1,21 +1,21 @@
Enter a valid certificate signing request.
+- You must enter an Certificate owner
-+ You must enter an Certificate owner
++ You must + enter a common name and it must be less than 64 characters
+You - must give a short description about this certificate will be used for.
-- You must - enter a common name and it must be less than 64 characters
-You + must give a short description about this certificate will be used for.
+Enter a valid certificate signing request.
-Enter a valid + email.
+Enter a valid - email.
-You must give a short description about this authority will be used for.
-You must + give a short description about this authority will be used for.
+Enter - a valid certificate.
-Enter + a valid certificate.
+Enter - a valid certificate.
-Enter + a valid certificate.
+Enter a valid certificate.
-Enter a valid certificate.
+