Skip to content

Commit 30c78fc

Browse files
committed
Add Certificate Authority functionality for AD
1 parent 8147b99 commit 30c78fc

File tree

6 files changed

+803
-23
lines changed

6 files changed

+803
-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
@@ -333,3 +333,29 @@ def get_attr(data: dict[str, Any], key: str, default: Any | None = None) -> Any
333333
return default
334334
return value[0] if len(value) == 1 else value
335335
return value
336+
337+
338+
def parse_cert_info(output: str) -> dict[str, list[str]]:
339+
"""
340+
Parse certutil output into dictionary.
341+
342+
:param output: certutil output.
343+
:type output: str
344+
:returns: Dictionary of certificate attributes.
345+
:rtype: dict[str, list[str]]
346+
"""
347+
lines = [line.strip() for line in (output or "").splitlines() if line.strip()]
348+
return attrs_parse(lines)
349+
350+
351+
def parse_ad_object_info(output: str) -> dict[str, list[str]]:
352+
"""
353+
Parse AD object output into dictionary.
354+
355+
:param output: PowerShell AD object output.
356+
:type output: str
357+
:returns: Dictionary of AD object attributes.
358+
:rtype: dict[str, list[str]]
359+
"""
360+
lines = [line.strip() for line in (output or "").splitlines() if line.strip()]
361+
return attrs_parse(lines)

0 commit comments

Comments
 (0)