doc review

Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com>
This commit is contained in:
Deepa Kumaraswamy 2022-05-13 20:26:58 +05:30
parent b087b4b38f
commit d49f3c5f45

View file

@ -13,16 +13,15 @@ platform = "unix"
Use the `x509_private_key` Chef InSpec audit resource to test the x509 private key. Use the `x509_private_key` Chef InSpec audit resource to test the x509 private key.
## Availability ## Availability
### Installation ### Installation
This resource is distributed along with Chef InSpec itself. The Chef InSpec distributes this resource.
## Syntax ## Syntax
A `x509_private_key` Chef InSpec audit resource allows to test the x509 private key. An `x509_private_key` Chef InSpec audit resource allows you to test the x509 private key.
```ruby ```ruby
describe x509_private_key("/home/x509_private_key.pem", "key_password") do describe x509_private_key("/home/x509_private_key.pem", "key_password") do
@ -31,22 +30,23 @@ A `x509_private_key` Chef InSpec audit resource allows to test the x509 private
it { should have_matching_certificate("/home/x509_certificate.crt") } it { should have_matching_certificate("/home/x509_certificate.crt") }
end end
``` ```
> where > where
> >
> - `"/home/x509_private_key.pem"` is the path of the private key > - `"/home/x509_private_key.pem"` is the path of the private key.
> - `"key_password"` is the password of the private key. This is optional for private keys without password. > - `"key_password"` is the password of the private key. This is optional for private keys without password.
> - `be_valid`, `be_encrypted` and `have_matching_certificate` are matchers of this resource > - `be_valid`, `be_encrypted`, and `have_matching_certificate` are matchers of this resource
> - `"/home/x509_certificate.crt"` is a x509 certificate generated using the given private key. > - `"/home/x509_certificate.crt"` is a x509 certificate generated using the specified private key.
## Matchers ## Matchers
For a full list of available matchers, please visit our [matchers page](https://docs.chef.io/inspec/matchers/). For a full list of available matchers, please visit the [matchers page](https://docs.chef.io/inspec/matchers/).
The specific matchers of this resource are: `be_valid`, `be_encrypted` and `have_matching_certificate` The specific matchers of this resource are: `be_valid`, `be_encrypted`, and `have_matching_certificate`.
### be_valid ### be_valid
The `be_valid` matcher tests if the given private key is valid. The `be_valid` matcher tests if the specified private key is valid.
```ruby ```ruby
it { should be_valid } it { should be_valid }
@ -54,7 +54,7 @@ The `be_valid` matcher tests if the given private key is valid.
### be_encrypted ### be_encrypted
The `be_encrypted` matcher tests if the given private key is encrypted. The `be_encrypted` matcher tests if the specified private key is encrypted.
```ruby ```ruby
it { should be_encrypted } it { should be_encrypted }
@ -69,9 +69,10 @@ The `have_matching_certificate` matcher tests if the x509 private key has a matc
``` ```
## Examples ## Examples
The following examples show how to use this Chef InSpec audit resource. The following examples show how to use this Chef InSpec audit resource.
### Check if the x509 private key is valid. ### Checks if the x509 private key is valid
`be_valid` checks if the x509 private key is valid. `be_valid` checks if the x509 private key is valid.
@ -81,7 +82,7 @@ The following examples show how to use this Chef InSpec audit resource.
end end
``` ```
### Check if the x509 private key is valid without password. ### Checks if the x509 private key is valid without a password
`be_valid` checks if the x509 private key is valid. `be_valid` checks if the x509 private key is valid.
@ -91,7 +92,7 @@ The following examples show how to use this Chef InSpec audit resource.
end end
``` ```
### Check if the x509 private key is encrypted. ### Checks if the x509 private key is encrypted
`be_encrypted` checks if the x509 private key is encrypted. `be_encrypted` checks if the x509 private key is encrypted.
@ -101,7 +102,7 @@ The following examples show how to use this Chef InSpec audit resource.
end end
``` ```
### Check if the x509 private key has a matching certificate. ### Checks if the x509 private key has a matching certificate
`be_valid` checks if the x509 private key has a matching certificate. `be_valid` checks if the x509 private key has a matching certificate.