Skip to content

Commit

Permalink
This commit separates the functionality of saving template configurat…
Browse files Browse the repository at this point in the history
…ion and writing template configuration. This closes issue ly4k#181
  • Loading branch information
NocteDefensor committed Nov 14, 2023
1 parent 2780d53 commit 03a151a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion certipy/commands/parsers/template.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def add_subparser(subparsers: argparse._SubParsersAction) -> Tuple[str, Callable
action="store_true",
help="Save the old configuration",
)

group.add_argument(
"-write-template",
action="store_true",
help="Write vulnerable properties to existing template or applies specified configuration to existing template",
)
group = subparser.add_argument_group("connection options")
group.add_argument(
"-scheme",
Expand Down
6 changes: 4 additions & 2 deletions certipy/commands/template.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(
template: str = None,
configuration: str = None,
save_old: bool = False,
write_template: bool = False,
scheme: str = "ldaps",
connection: LDAPConnection = None,
**kwargs,
Expand All @@ -70,7 +71,7 @@ def __init__(
self.save_old = save_old
self.scheme = scheme
self.kwargs = kwargs

self.write_template = write_template
self._connection = connection

@property
Expand Down Expand Up @@ -173,7 +174,8 @@ def set_configuration(self) -> bool:
"Saved old configuration for %s to %s"
% (repr(self.template_name), repr(out_file))
)

if self.write_template == False:
exit()
changes = {}
for key in old_configuration["raw_attributes"].keys():
if key in PROTECTED_ATTRIBUTES:
Expand Down

0 comments on commit 03a151a

Please sign in to comment.