Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This commit separates the functionality of saving and writing template configuration. #182

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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