diff --git a/docs/administration.rst b/docs/administration.rst
index 9f377119..846a4c34 100644
--- a/docs/administration.rst
+++ b/docs/administration.rst
@@ -172,6 +172,17 @@ Specifying the `SQLALCHEMY_MAX_OVERFLOW` to 0 will enforce limit to not create c
PUBLIC_CA_MAX_VALIDITY_DAYS = 365
+.. data:: DEFAULT_MAX_VALIDITY_DAYS
+ :noindex:
+ Use this config to override the default limit of 1095 days (3 years) of validity. Any CA which is not listed in
+ PUBLIC_CA_AUTHORITY_NAMES will be using this validity to display date range on UI. Below example overrides the
+ default validity of 1095 days and sets it to 365 days.
+
+ ::
+
+ DEFAULT_MAX_VALIDITY_DAYS = 365
+
+
.. data:: DEBUG_DUMP
:noindex:
@@ -229,7 +240,7 @@ and are used when Lemur creates the CSR for your certificates.
::
- LEMUR_DEFAULT_ORGANIZATIONAL_UNIT = "Operations"
+ LEMUR_DEFAULT_ORGANIZATIONAL_UNIT = ""
.. data:: LEMUR_DEFAULT_ISSUER_PLUGIN
diff --git a/lemur/authorities/schemas.py b/lemur/authorities/schemas.py
index c78aec94..0700c15b 100644
--- a/lemur/authorities/schemas.py
+++ b/lemur/authorities/schemas.py
@@ -109,6 +109,7 @@ class RootAuthorityCertificateOutputSchema(LemurOutputSchema):
cn = fields.String()
not_after = fields.DateTime()
not_before = fields.DateTime()
+ max_issuance_days = fields.Integer()
owner = fields.Email()
status = fields.Boolean()
user = fields.Nested(UserNestedOutputSchema)
@@ -134,6 +135,7 @@ class AuthorityNestedOutputSchema(LemurOutputSchema):
owner = fields.Email()
plugin = fields.Nested(PluginOutputSchema)
active = fields.Boolean()
+ authority_certificate = fields.Nested(RootAuthorityCertificateOutputSchema, only=["max_issuance_days"])
authority_update_schema = AuthorityUpdateSchema()
diff --git a/lemur/certificates/models.py b/lemur/certificates/models.py
index 58630ee6..5f6c4ba9 100644
--- a/lemur/certificates/models.py
+++ b/lemur/certificates/models.py
@@ -311,6 +311,14 @@ class Certificate(db.Model):
def validity_range(self):
return self.not_after - self.not_before
+ @property
+ def max_issuance_days(self):
+ public_CA = current_app.config.get("PUBLIC_CA_AUTHORITY_NAMES", [])
+ if self.name.lower() in [ca.lower() for ca in public_CA]:
+ return current_app.config.get("PUBLIC_CA_MAX_VALIDITY_DAYS", 397)
+
+ return current_app.config.get("DEFAULT_MAX_VALIDITY_DAYS", 1095) # 3 years default
+
@property
def subject(self):
return self.parsed_cert.subject
diff --git a/lemur/static/app/angular/authorities/authority/distinguishedName.tpl.html b/lemur/static/app/angular/authorities/authority/distinguishedName.tpl.html
index 33b0ba4b..c6a7d312 100644
--- a/lemur/static/app/angular/authorities/authority/distinguishedName.tpl.html
+++ b/lemur/static/app/angular/authorities/authority/distinguishedName.tpl.html
@@ -46,8 +46,7 @@
Organizational Unit