Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Commit 8c77eac

Browse files
author
mpgn
committed
Update module adcs
1 parent d90709b commit 8c77eac

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

cme/modules/adcs.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CMEModule:
1717

1818
def options(self, context, module_options):
1919
'''
20-
SERVER PKI Enrollment Server to enumerate templates for. Default is None.
20+
SERVER PKI Enrollment Server to enumerate templates for. Default is None, use CN name
2121
'''
2222
self.context = context
2323
self.regex = re.compile('(https?://.+)')
@@ -34,7 +34,7 @@ def on_login(self, context, connection):
3434
search_filter = '(objectClass=pKIEnrollmentService)'
3535
else:
3636
search_filter = '(distinguishedName=CN={},CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,'.format(self.server)
37-
self.context.log.highlight('Using PKI Enrollment Server: {}'.format(self.server))
37+
self.context.log.highlight('Using PKI CN: {}'.format(self.server))
3838

3939
context.log.debug("Starting LDAP search with search filter '{}'".format(search_filter))
4040

@@ -43,7 +43,7 @@ def on_login(self, context, connection):
4343

4444
if self.server is None:
4545
resp = connection.ldapConnection.search(searchFilter=search_filter,
46-
attributes=['dNSHostName', 'msPKI-Enrollment-Servers'],
46+
attributes=[],
4747
sizeLimit=0, searchControls=[sc],
4848
perRecordCallback=self.process_servers,
4949
searchBase='CN=Configuration,' + connection.ldapConnection._baseDN)
@@ -66,13 +66,17 @@ def process_servers(self, item):
6666

6767
urls = []
6868
host_name = None
69+
cn = None
6970

7071
try:
71-
7272
for attribute in item['attributes']:
7373

74+
75+
7476
if str(attribute['type']) == 'dNSHostName':
7577
host_name = attribute['vals'][0].asOctets().decode('utf-8')
78+
if str(attribute['type']) == 'cn':
79+
cn = attribute['vals'][0].asOctets().decode('utf-8')
7680

7781
elif str(attribute['type']) == 'msPKI-Enrollment-Servers':
7882

@@ -93,6 +97,9 @@ def process_servers(self, item):
9397
if host_name:
9498
self.context.log.highlight('Found PKI Enrollment Server: {}'.format(host_name))
9599

100+
if cn:
101+
self.context.log.highlight('Found CN: {}'.format(cn))
102+
96103
for url in urls:
97104
self.context.log.highlight('Found PKI Enrollment WebService: {}'.format(url))
98105

0 commit comments

Comments
 (0)