2016-09-22 12:43:57 +00:00
|
|
|
---
|
|
|
|
title: About the ini Resource
|
|
|
|
---
|
|
|
|
|
|
|
|
# ini
|
|
|
|
|
|
|
|
Use the `ini` InSpec audit resource to test settings in an INI file.
|
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
<br>
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
## Syntax
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
An `ini` resource block declares the configuration settings to be tested:
|
|
|
|
|
|
|
|
describe ini('path') do
|
|
|
|
its('setting_name') { should eq 'value' }
|
|
|
|
end
|
|
|
|
|
|
|
|
where
|
|
|
|
|
|
|
|
* `'setting_name'` is a synchronization setting defined in the INI file
|
|
|
|
* `('path')` is the path to the INI file
|
|
|
|
* `{ should eq 'value' }` is the value that is expected
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
describe ini('path/to/ini_file.ini') do
|
|
|
|
its('port') { should eq '143' }
|
|
|
|
its('server') { should eq '192.0.2.62' }
|
|
|
|
end
|
|
|
|
|
2017-10-03 21:35:10 +00:00
|
|
|
<br>
|
2016-09-22 12:43:57 +00:00
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
## Examples
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
The following examples show how to use this InSpec audit resource.
|
|
|
|
|
2016-09-27 19:03:23 +00:00
|
|
|
### Test SMTP settings in a PHP INI file
|
2016-09-22 12:43:57 +00:00
|
|
|
|
|
|
|
For example, a PHP INI file located at contains the following settings:
|
|
|
|
|
|
|
|
; SMTP = smtp.gmail.com
|
|
|
|
; smtp_port = 465
|
|
|
|
|
|
|
|
and can be tested like this:
|
|
|
|
|
|
|
|
describe ini(/etc/php5/apache2/php.ini) do
|
|
|
|
its('smtp_port') { should eq('465') }
|
|
|
|
end
|
2017-10-03 21:35:10 +00:00
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
|
|
## Matchers
|
|
|
|
|
|
|
|
For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
|