-
Notifications
You must be signed in to change notification settings - Fork 47
Feature/pure ruby ssl implementation for root certificate issuer check #71
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
Conversation
… output to work with both openssl 1.0 and openssl 1.1 formatting
…ve to check-ssl-anchor.rb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, needs a rebase.
bin/check-ssl-root-issuer.rb
Outdated
default: 'RFC2253', | ||
required: false | ||
|
||
def validate_opts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple thoughts:
- I think we should we still add validation to the options passed in themselves. if I pass in an invalid value I see no reason to run this code here
- I think we should add conditional logic, if I specify something other than those two options the way the code is written it will attempt to validate with
RFC2253
regardless of what is passed in - should we add a qualifier here that this is specific to format or do you intend that we would keep adding more validation to this?
Maybe that should be something we pass in and can try something like this? (not sure if this is valid)
def validate_format_opts(config[:format])
OpenSSL::X509::Name::config[:format]
end
# I am pretty sure this will work but is dangerous and could lead easily to code injection
# that being said if we validate the options beforehand I think that is sufficient mitigation
# (which I would call out in a comment) and will make sense right before the rubocop
# disable as I am sure it will (rightly so) yell at us as its incredibly dangerous but powerful
# if wielded properly
def validate_format_opts(config[:format])
eval "OpenSSL::X509::Name::#{config[:format]}"
end
if we cant specify it like that then we could always use if, elif, else or case statements to handle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I've updated the logic to use mixin's cli option value validation method.
…ibraries internal validation for allowed values.
@jspaleta let me know if you need any help appeasing the cops, in the case of the eval please do indicate in a comment that the validation is done at user input so should be safe in this case. |
Rubocop fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
One minor fixup in the changelog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jspaleta do you want to merge this and prep a release or do you want me to? I can probably get to it this evening if you don't get to it sooner. |
sensu-plugins#71) * Add option to treat anchor as a regexp. Fix parsing of openssl client output to work with both openssl 1.0 and openssl 1.1 formatting * updates to make travis and rubocop happy * Add pure ruby implementation of check-ssl-root-issuer.rb as alternative to check-ssl-anchor.rb * make rubocop happy * add test for check-ssl-root-issuer * update changelog and README with new plugin information * remove files changed in PR sensu-plugins#70, unrelated to this new feature * Update logic for validating issuer name format options. Using mixin libraries internal validation for allowed values.
Pull Request Checklist
This is to address use of openssl command line tool in the check-ssl-anchor with an alternative implementation of the same logic using pure base ruby packages.
This is an outgrowth of the clean up done in PR #70
Probably should merge PR #70 first.
General
Update Changelog
RuboCop passes
Existing tests pass
New Plugins
Tests
Add the plugin to the README
Purpose
Provide full ruby implementation of similar logic to
check-ssl-anchor.rb
without requireing openssl cmdline tool.Known Compatibility Issues