Skip to content

Commit c55f41c

Browse files
committed
Add Certificate Authority functionality for AD
1 parent 65963d1 commit c55f41c

File tree

6 files changed

+668
-23
lines changed

6 files changed

+668
-23
lines changed

sssd_test_framework/hosts/ad.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ def restore(self, backup_data: Any | None) -> None:
307307
}}
308308
}}
309309
310+
# Clean up certificate directories
311+
if (Test-Path "C:\pki") {{
312+
Write-Host "Cleaning up certificate directories in C:\pki"
313+
Remove-Item "C:\pki" -Recurse -Force -ErrorAction SilentlyContinue
314+
}}
315+
310316
# If we got here, make sure we exit with 0
311317
Exit 0
312318
""",

sssd_test_framework/misc/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,3 +313,29 @@ def get_attr(data: dict[str, Any], key: str, default: Any | None = None) -> Any
313313
return default
314314
return value[0] if len(value) == 1 else value
315315
return value
316+
317+
318+
def parse_cert_info(output: str) -> dict[str, list[str]]:
319+
"""
320+
Parse certutil output into dictionary.
321+
322+
:param output: certutil output.
323+
:type output: str
324+
:returns: Dictionary of certificate attributes.
325+
:rtype: dict[str, list[str]]
326+
"""
327+
lines = [line.strip() for line in (output or "").splitlines() if line.strip()]
328+
return attrs_parse(lines)
329+
330+
331+
def parse_ad_object_info(output: str) -> dict[str, list[str]]:
332+
"""
333+
Parse AD object output into dictionary.
334+
335+
:param output: PowerShell AD object output.
336+
:type output: str
337+
:returns: Dictionary of AD object attributes.
338+
:rtype: dict[str, list[str]]
339+
"""
340+
lines = [line.strip() for line in (output or "").splitlines() if line.strip()]
341+
return attrs_parse(lines)

0 commit comments

Comments
 (0)