puppetlabs-stdlib/lib/puppet
Matt Bostock 97320ab421 Add a function to validate an x509 RSA key pair
Add a function to validate an x509 RSA certificate and key pair, as
commonly used for TLS certificates.

The rationale behind this is that we store our TLS certificates and
private keys in Hiera YAML files, and poor indentation or formatting in
the YAML file could cause a valid certificate to be considered invalid.

Will cause the Puppet run to fail if:

- an invalid certificate is detected
- an invalid RSA key is detected
- the certificate does not match the key, i.e. the certificate
  has not been signed by the supplied key

The test certificates I've used in the spec tests were generated using
the Go standard library:

    $ go run $GOROOT/src/crypto/tls/generate_cert.go -host localhost

Example output:

    ==> cache-1.router: Error: Not a valid RSA key: Neither PUB key nor PRIV key:: nested asn1 error at /var/govuk/puppet/modules/nginx/manifests/config/ssl.pp:30 on node cache-1.router.dev.gov.uk
2016-01-08 11:09:45 +00:00
..
functions (MODULES-2516) Adds an is_a() function 2015-09-14 18:26:25 +01:00
parser/functions Add a function to validate an x509 RSA key pair 2016-01-08 11:09:45 +00:00
provider/file_line allow match parameter to influence ensure => absent behavior. 2015-08-06 13:44:32 -07:00
type (MODULES-2421) improve description of file_line 2015-10-13 15:03:26 +01:00