Skip to content

Commit

Permalink
Improve CA info
Browse files Browse the repository at this point in the history
  • Loading branch information
wil committed Nov 25, 2024
1 parent 9238d16 commit 8b751fe
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.75
1.0.76
44 changes: 30 additions & 14 deletions ldeep/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,23 +735,39 @@ def list_pkis(self, kwargs):
if verbose:
attributes = self.engine.all_attributes()
else:
attributes = ["dNSHostName", "objectClass"]
attributes = [
"cACertificateDN",
"certificateTemplates",
"dNSHostName",
"name",
]

self.display(
self.engine.query(
self.engine.PKI_FILTER(),
attributes,
base=",".join(
[
"CN=Enrollment Services,CN=Public Key Services,CN=Services",
self.engine.ldap.server.info.other[
"configurationNamingContext"
][0],
]
),
ca_info = self.engine.query(
self.engine.PKI_FILTER(),
attributes,
base=",".join(
[
"CN=Enrollment Services,CN=Public Key Services,CN=Services",
self.engine.ldap.server.info.other["configurationNamingContext"][0],
]
),
verbose,
)
if verbose:
self.display(ca_info, verbose)
return
else:
ca_number = 1
print("Certificate Authorities")
for ca in ca_info:
print(ca_number)
print(f"{'CA Name':<30}: {ca.get('name')}")
print(f"{'DNS Name':<30}: {ca.get('dNSHostName')}")
print(f"{'Certificate Subject':<30}: {ca.get('cACertificateDN')}")
if ca.get("certificateTemplates"):
print(f"{'Associated Templates':<30}")
for template in ca.get("certificateTemplates"):
print(f"{' ' * 32}{template}")
ca_number += 1

def list_templates(self, kwargs):
"""
Expand Down

0 comments on commit 8b751fe

Please sign in to comment.