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

Added support for defining custom provisioners in profile #73

Merged
merged 1 commit into from
Sep 6, 2017

Conversation

pix
Copy link
Contributor

@pix pix commented Sep 6, 2017

I made the packer provisioning area customizable using the profile.

I added a packer section:

    "packer": {
        "_comment": "See https://www.packer.io/docs/templates/provisioners.html for syntax"
        "provisioners": [
            {
                "type": "powershell",
                "inline": ["dir c:\\"]
            }
        ]
    }

Which is copied at the end of the packer.json templates.
It allows users to add custom powershell commands (or even scripts) directly.

We use this to push custom packages (using a custom repository) using chocolatey.

Copy link
Member

@obilodeau obilodeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea and I especially like the fact that you've put it in profiles and not in the configuration.

👍 pending the minor indentation changes.


{% if ida_path %},
{% include 'snippets/ida_remote_64.json' %},
{% include 'snippets/ida_remote_32.json' %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

{% endif %}
{% if packer_extra_provisioners %}
{% for p in packer_extra_provisioners %}
,{{ p | tojson }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation


{% if packer_extra_provisioners %}
{% for p in packer_extra_provisioners %}
,{{ p | tojson }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation


{% if packer_extra_provisioners %}
{% for p in packer_extra_provisioners %}
,{{ p | tojson }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please indent


{% if packer_extra_provisioners %}
{% for p in packer_extra_provisioners %}
,{{ p | tojson }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please indent this line (it's under the for loop)

@@ -31,10 +31,14 @@
{% if tools_path %},
{% include 'snippets/tools.json' %}
{% endif %}
{% if ida_path %},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines got removed to fix the space/tab indent mixing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I noticed that. Thanks! My vim config is still badly configured for javascript/json, at some point I'll rewrite everything into 4 spaces but not now.

@pix
Copy link
Contributor Author

pix commented Sep 6, 2017

This should be ok now :)

@obilodeau
Copy link
Member

I'm ok with your changes. I'll ask for a review from @Svieg since this affects users and future direction. If he doesn't comment in 1-2 days I'll merge.

@obilodeau obilodeau requested a review from Svieg September 6, 2017 14:48
@Svieg
Copy link
Collaborator

Svieg commented Sep 6, 2017

I think it's a cool idea so look at my comment and I'd be happy to merge that :)

@@ -487,6 +487,11 @@ def prepare_profile(template, config):
for package_mod in profile["package"]:
package(profile_name, package_mod["package"], fd)

if "packer" in profile:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to add other fields to the packer attribute? For example, If there's only provisionners, I'd delete packer and make it clearer IMO. Also, if you plan to add other fields other than provisionners, what would they be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept in mind the possibility because I might plan on adding support for post-processors (mostly shell like this in order to allow some workflow processinng after the box generation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept in mind the possibility because I might plan on adding support for post-processors (mostly shell1 like this in order to allow some workflow processinng after the box generation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, I need to fix a missing comma in default-profile.js, right under comment, I on the train right now.

@Svieg Svieg merged commit 10611c6 into GoSecure:master Sep 6, 2017
obilodeau added a commit that referenced this pull request Sep 6, 2017
@pix
Copy link
Contributor Author

pix commented Sep 6, 2017

Crap. Too late, I was missing coverage in the train. default-profile.js is lacking a comma right under "_comment"

obilodeau added a commit that referenced this pull request Sep 6, 2017
@obilodeau
Copy link
Member

No worries. It's fixed in master. See f086475.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants