Possible alternative to https://github.com/voxpupuli/puppet-vault_lookup/pull/21
This solution uses a second dispatch instead of having either an almost
entirely duplicated function or introducing a 2nd optional parameter.
UNTESTED!!
If a lookup function raises an exception, the whole catalog compilation will fail. This PR adds the ability to configure the lookup to not raise and instead simply log and return nil if it encounters an error, so that the users can structure their manifests to only conditionally depend on the result of the lookup.
We're not sure if this is useful or not, and are looking for use cases and feedback on the approach.
Fixes #13
This PR adds support to query just a single element of a secret, and return it as a Sensitive string. This makes it easier to pass a specific secret to another resource, as you don't have to deal with a hash of elements.
This PR add support for Vault Namespaces.
It supersede #28
n/a
this call created more issues then it is obvoius, maybe this is why it was made deprecated.
it reuses default ssl validator from Puppet.
this validator magically not working with anything but puppet master or server which uses puppet CA cert.
I simply created required SSLContext because in puppet docs I could not find how to create it easier.
Idealy it should be cached between invocation of functions, however I could not find a way how to do it.
<!--
Thank you for contributing to this project!
-->
<!--
Replace this comment with a description of your pull request.
-->
<!--
Replace this comment with the list of issues or n/a.
Use format:
Fixes #123
Fixes #124
-->
Adds path information for data lookup errors when needed
As of now when puppet fails to apply catalog vault_lookup returns message with no clue where error happens:
Error: Failed to apply catalog: Received 403 response code from vault at vault.local for secret lookup (api errors: ["1 error occurred:\n\t* permission denied\n\n"])
With proposed change you can see which lookup actually related to the problem:
Error: Failed to apply catalog: Received 403 response code from vault at vault.local for secret/data/puppet/service/graylog/s1/config lookup (api errors: ["1 error occurred:\n\t* permission denied\n\n"])
This PR adds support to use AppRole Vault's auth method.
It also adds support for configuring vault_lookup
function using a configuration file as in https://github.com/voxpupuli/puppet-prometheus_reporter/blob/master/lib/puppet/reports/prometheus.rb#L12
<!--
Thank you for contributing to this project!
-->
After trying this module out -- I found I could not use it in actual "useful" way yet. I have a path ssl/test which has two keys under it -- cert and key. When I retrieve that, I am unable to get at the either of the subkeys in any way I could figure out. If I am just missing it, please let me know how. =) But I couldn't, for example, do $d['cert'] or any form of that that I could discover. Puppet rejected it as "this is not a hash, it is an object". I saw a few semi weird "double deferred" solutions but they weren't quite working either. I whipped up what is basically a copy of the lookup function but that accepts a key argument. It is working great in my setup so far.
Please note I do not want you to merge/accept this as is -- I would like a chance to clean it up, add some tests, etc before it is potentially merged.
I don't really like doubling up on the functions within the Puppet function definition -- in fact at first I tried to do a quick lookup_key that actually called lookup, unwrapped the return, pulled the key, rewrapped that, and returned it. However I was in a bit of a hurry and did it this way for the moment.
Good? Bad? Meh? Seemed like a quick way to get at what I needed. =) If you like the idea but have some suggestions on how to improve it please send them my way. I've also left it open to maintainer edits so have at it. (I'm using master in production currently)
n/a
This PR removes the use of the deprecated http_instance method and replaces it with the suggested connection method instead.
Using the new connection interface, it's possible to specify an SSL context, and therefore whether or not to verify SSL connections. I've implemented this as an optional parameter that defaults to true (ie: the default behaviour should remain unchanged).
By parameterizing SSL verification, it's possible to connect to established Vault instances over HTTPS, that are outside of the PKI chain established by the Puppet server. Given that the plugin currently allows the option of HTTP connections, it doesn't seem less secure to also optionally disable SSL verification.
I'm not very familiar with Ruby development, so I've not modified any of the existing tests, but if there aren't any objections to this new approach, I'm happy to try and write tests covering the new functionality, and reflecting the change in Puppet API interface use. Anecdotally, I have tested this with my own Vault (1.1.0) server and Puppet setup (6.4.0) and it works under normal use.
n/a
<!--
Thank you for contributing to this project!
-->
<!--
Fixes #7
-->
<!--
Thank you for contributing to this project!
-->
<!--
This PR contains changes for module to use up-to-date Pupper::HTTP::Client, which will allow puppet agents to access Vault secured with other Certificate Authority certificates, including Letsencrypt. That will also allow Vault to work with multiple Puppet Servers (or Masters), of course each Puppet Server CA will need to be imported into Vault auth/cert/certs/ with a different name.
Changes to the module are compatible with old module, and will not change its function.
To use Vault secured with other CAs, 2 other changes are needed on every Puppet agent configuration that need to access this module:
- Disable certificate revocation, in /etc/puppet/puppet.conf add line
certificate_revocation = false
- It is also required add bundle of CAs at the end of "/etc/puppet/ssl/certs/ca.pem"
for example for Letsencrypt CAs we added
- Let's Encrypt Authority X3
- ISRG Root X1
- ISRG Root X2
These can be found and copied from CA bundle files, on Debian they are in "/etc/ssl/certs/ca-certificates.crt" or on RedHat in "/etc/pki/tls/certs/ca-bundle.crt"
-->
<!--
Replace this comment with the list of issues or n/a.
n/a
-->
The primary goal is to check CI status…
<!--
Replace this comment with the list of issues or n/a.
Use format:
Fixes #123
Fixes #124
-->
updated to use puppet.runtime[:http] to remove deprecated function, added namespace support, added function to access particular key, added option to use combination of cert and approle auth methods for more security
<!--
Thank you for contributing to this project!
-->
<!--
updated to use puppet.runtime[:http] to remove deprecated function, added namespace support, added function to access particular key, added option to use combination of cert and approle auth methods for more security
-->
<!--
n/a
-->
Puppet added a new http client in version 6.11. There wasn't a
compelling reason to port this, until 7.16 when that http client gained
the ability to use the system CA store. This meant that it could begin
trusting certificates not issued by Puppet's CA.
This conditionally ports to the new client where available, and uses the
system CA store as of 7.16.
Co-authored-by: vamsinm vamsi.nainavarapu.vaap9t@statefarm.com
Co-authored-by: Christos Papageorgiou christos.papageorgioy@gmail.com
Co-authored-by: Josh Cooper 737664+joshcooper@users.noreply.github.com