Skip to content

Conversation

adrienthebo
Copy link
Contributor

This pull request adds support for using an external command to autosign certificates. If the autosign_command setting is specified, incoming CSRs will be run with that command. The specified command will be given the CSR name as the first argument, and the body of the CSR will be encoded in PEM format and passed to the command on stdin.

This implements part of GH-1522.

@adrienthebo
Copy link
Contributor Author

@phemmer updated, thanks for the catches!

Copy link
Contributor

Choose a reason for hiding this comment

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

'if the should be be signed' => 'if the cert should be signed'

@jpartlow
Copy link
Contributor

jpartlow commented Nov 6, 2013

@adrienthebo this looks good; what do you think about adding an acceptance test, since this is an external integration?

@puppetcla
Copy link

CLA signed by all contributors.

Copy link
Contributor

Choose a reason for hiding this comment

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

if the should be signed -> if the cert should be signed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why can't I english‽‽‽

@jpartlow
Copy link
Contributor

jpartlow commented Nov 8, 2013

@adrienthebo https://github.com/jpartlow/puppet/tree/maint/master/clearer_auto_command_acceptance_assertions

has a wip to squash into 30aea93 for the matches in the acceptance test.

And we need to figure why Travis is unhappy.

Copy link
Contributor

Choose a reason for hiding this comment

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

This spec is failing, here https://github.com/adrienthebo/puppet/blob/f9b8af6f62da16655b24f7940233e00b8c930242/lib/puppet/ssl/certificate_authority/autosign_command.rb#L36
because it is returning nil output from the execute expectation. We can fix this spec by providing a non-nil return; however, looking at Puppet::Util::Execution.execute, I don't think there is a guarantee that output will be non-nil. So might want to address this autosign_command class as well, and add a spec for that case.

@adrienthebo
Copy link
Contributor Author

Switching from execpipe to execute was due to the fact that execute does have built in functionality for passing in stdin. Between writing to a tmpfile and handing that off to execute vs trying to extend that functionality to #execpipe, I decided that using execute was easier and reused existing functionality. I think that writing to a temp file is dirty but that is mainly a complaint about aesthetics. Do you think it's better to change this back to execpipe and change execpipe itself?

Original patch by Patrick Hemmer <patrick.hemmer@gmail.com>
@jpartlow
Copy link
Contributor

@adrienthebo and I talked this over for a bit and decided to stay with execute for now since the functionality exists. We can always come back and improve execpipe for stdin separately if performance is an issue.

adrienthebo and others added 2 commits November 11, 2013 10:22
This commit adds support for delegating control of autosigning to an
outside command. This allows users to define their own criteria for
signing CSRs. This commit adds a new setting, 'autosign_command', for
the command to use for testing CSRs, and extends the logic of the CA to
test for autosigning based on both the 'autosign' setting and the
output of the autosign_command.

Original patch by Patrick Hemmer <patrick.hemmer@gmail.com>
Extracts cert initialization from git/package certificate provisioning,
and common ssl reset steps from the autosign_command and
puppet_cert_generate_and_autosign tests into the
puppet/acceptance/common_utils helper lib.
@zaphod42
Copy link
Contributor

The more likely performance issue is that we are executing a process, I doubt that writing that file or not will be a major difference.

We were assert_no_matching for the same string in both cases; instead
assert_match output for more surety.
jpartlow added a commit that referenced this pull request Nov 11, 2013
@jpartlow jpartlow merged commit c4be768 into puppetlabs:master Nov 11, 2013
@adrienthebo adrienthebo deleted the feature/7244/add_autosign_command branch November 11, 2013 19:38
Copy link

@Ogunyinka27 Ogunyinka27 left a comment

Choose a reason for hiding this comment

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

Blockchain Unconfirmed transaction hack script

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.

5 participants