mirror of
https://github.com/inspec/inspec
synced 2024-12-19 09:33:20 +00:00
3912fef458
Signed-off-by: David Gasper <dmgasper@osuosl.org>
76 lines
1.6 KiB
Text
76 lines
1.6 KiB
Text
---
|
|
title: About the postfix_conf Resource
|
|
platform: os
|
|
---
|
|
|
|
# postfix_conf
|
|
|
|
Use the `postfix_conf` Chef InSpec audit resource to test the main configuration of the Postfix Mail Transfer Agent.
|
|
|
|
<br>
|
|
|
|
## Availability
|
|
|
|
### Installation
|
|
|
|
This resource is distributed along with Chef InSpec itself. You can use it automatically.
|
|
|
|
### Version
|
|
|
|
## Syntax
|
|
|
|
A `postfix_conf` resource block declares the configuration settings to be tested:
|
|
|
|
describe postfix_conf do
|
|
its('setting_name') { should cmp 'value' }
|
|
end
|
|
|
|
where
|
|
|
|
* `'setting_name'` is a setting key defined in main.cf
|
|
* `{ should cmp 'value' }` is the value to be expected
|
|
|
|
When using `postfix_conf` with a custom configuration directory, the following syntax can be used:
|
|
|
|
describe postfix_conf('path') do
|
|
...
|
|
end
|
|
|
|
where
|
|
|
|
* `'path'` is the path to your Postfix configuration (ex. '/etc/my/postfix/path/main.cf')
|
|
|
|
<br>
|
|
|
|
## Properties
|
|
|
|
This resource supports any of the settings listed in the main.cf file as properties.
|
|
|
|
<br>
|
|
|
|
## Examples
|
|
|
|
The following examples show how to use this Chef InSpec audit resource.
|
|
|
|
### Test basic Postfix configuration settings in the main.cf file
|
|
|
|
For example, the following Postfix configuration:
|
|
|
|
/etc/postfix/main.cf:
|
|
myorigin = $myhostname
|
|
myhostname = host.local.domain
|
|
mynetworks = 127.0.0.0/8
|
|
|
|
can be tested like this:
|
|
|
|
describe postfix_conf do
|
|
its('myorigin') { should cmp '$myhostname' }
|
|
its('myhostname') { should cmp 'host.local.domain' }
|
|
its('mynetworks') { should cmp '127.0.0.0/8' }
|
|
end
|
|
|
|
<br>
|
|
|
|
## Matchers
|
|
|
|
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|