Merge branch 'master' into issuer-retry
This commit is contained in:
commit
a9d3b7a676
|
@ -1,5 +1,5 @@
|
||||||
language: python
|
language: python
|
||||||
dist: xenial
|
dist: bionic
|
||||||
|
|
||||||
node_js:
|
node_js:
|
||||||
- "6.2.0"
|
- "6.2.0"
|
||||||
|
|
|
@ -560,20 +560,21 @@ def query_common_name(common_name, args):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
owner = args.pop("owner")
|
owner = args.pop("owner")
|
||||||
if not owner:
|
|
||||||
owner = "%"
|
|
||||||
|
|
||||||
# only not expired certificates
|
# only not expired certificates
|
||||||
current_time = arrow.utcnow()
|
current_time = arrow.utcnow()
|
||||||
|
|
||||||
result = (
|
query = Certificate.query.filter(Certificate.not_after >= current_time.format("YYYY-MM-DD"))\
|
||||||
Certificate.query.filter(Certificate.cn.ilike(common_name))
|
.filter(not_(Certificate.revoked))\
|
||||||
.filter(Certificate.owner.ilike(owner))
|
.filter(not_(Certificate.replaced.any())) # ignore rotated certificates to avoid duplicates
|
||||||
.filter(Certificate.not_after >= current_time.format("YYYY-MM-DD"))
|
|
||||||
.all()
|
|
||||||
)
|
|
||||||
|
|
||||||
return result
|
if owner:
|
||||||
|
query = query.filter(Certificate.owner.ilike(owner))
|
||||||
|
|
||||||
|
if common_name != "%":
|
||||||
|
# if common_name is a wildcard ('%'), no need to include it in the query
|
||||||
|
query = query.filter(Certificate.cn.ilike(common_name))
|
||||||
|
|
||||||
|
return query.all()
|
||||||
|
|
||||||
|
|
||||||
def create_csr(**csr_config):
|
def create_csr(**csr_config):
|
||||||
|
|
Loading…
Reference in New Issue