-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(inspec): add tests based on existing Serverspec tests (#168)
* ci(kitchen): use `openssh.config` as `state_top` * Semi-automated using myii/ssf-formula#33 * test(pillar): remove deprecated option and disabled method * https://travis-ci.org/myii/openssh-formula/jobs/585340845#L1811-L1813: * test(pillar): use same SSH options as used by Travis * Using existing options locks out after `kitchen converge` (before `verify`) * https://travis-ci.org/myii/openssh-formula/jobs/585356835#L2957-L2965: * test(inspec): add tests based on existing Serverspec tests * Follows on from #166
- Loading branch information
Showing
6 changed files
with
83 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,7 @@ suites: | |
state_top: | ||
base: | ||
'*': | ||
- openssh | ||
- openssh.config | ||
pillars: | ||
top.sls: | ||
base: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Overide by Platform | ||
root_group = 'root' | ||
if platform[:family] == 'freebsd' | ||
root_group = 'wheel' | ||
end | ||
|
||
control 'openssh configuration' do | ||
title 'should match desired lines' | ||
|
||
describe file('/etc/ssh/sshd_config') do | ||
it { should be_file } | ||
its('mode') { should cmp '0644' } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into root_group } | ||
its('content') { should include 'ChallengeResponseAuthentication no' } | ||
its('content') { should include 'X11Forwarding yes' } | ||
its('content') { should include 'PrintMotd no' } | ||
its('content') { should include 'AcceptEnv LANG LC_*' } | ||
its('content') { should include 'Subsystem sftp /usr/lib/openssh/sftp-server' } | ||
its('content') { should include 'UsePAM yes' } | ||
end | ||
|
||
describe file('/etc/ssh/ssh_config') do | ||
it { should be_file } | ||
its('mode') { should cmp '0644' } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into root_group } | ||
its('content') { should include 'Host *' } | ||
its('content') { should include ' GSSAPIAuthentication yes' } | ||
its('content') { should include ' HashKnownHosts yes' } | ||
its('content') { should include ' SendEnv LANG LC_*' } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Overide by Platform | ||
package_name = 'openssh-server' | ||
if platform[:family] == 'suse' | ||
package_name = 'openssh' | ||
end | ||
|
||
control 'openssh package' do | ||
title 'should be installed' | ||
|
||
describe package(package_name) do | ||
it { should be_installed } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Overide by Platform | ||
service_name = 'sshd' | ||
if platform[:family] == 'debian' | ||
service_name = 'ssh' | ||
end | ||
|
||
control 'openssh service' do | ||
impact 0.5 | ||
title 'should be running and enabled' | ||
|
||
describe service(service_name) do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters