From 388ba4d14789b251c504a7d96382900e145433bc Mon Sep 17 00:00:00 2001 From: Kent Johansson Date: Thu, 5 Dec 2013 12:11:36 +0100 Subject: [PATCH 1/3] Add option to specify banner content --- README.md | 24 ++++++++++++++++++ manifests/init.pp | 23 +++++++++++++++++ spec/classes/init_spec.rb | 53 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) diff --git a/README.md b/README.md index 787997d..8ecb836 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,30 @@ Banner option in sshd_config. - *Default*: 'none' +sshd_banner_content +------------------- +Banner content in sshd_config_banner + +- *Default*: undef + +sshd_banner_owner +----------------- +sshd_config_banner owner + +- *Default*: 'root' + +sshd_banner_group +----------------- +sshd_config_banner group + +- *Default*: 'root' + +sshd_banner_mode +---------------- +sshd_config_banner mode + +- *Default*: '0644' + sshd_config_xauth_location -------------------------- XAuthLocation option in sshd_config. diff --git a/manifests/init.pp b/manifests/init.pp index 67a7bff..e471539 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -26,6 +26,10 @@ class ssh ( $sshd_config_print_motd = 'yes', $sshd_config_use_dns = 'yes', $sshd_config_banner = 'none', + $sshd_banner_content = undef, + $sshd_banner_owner = 'root', + $sshd_banner_group = 'root', + $sshd_banner_mode = '0644', $sshd_config_xauth_location = '/usr/bin/xauth', $sshd_config_subsystem_sftp = 'USE_DEFAULTS', $service_ensure = 'running', @@ -53,6 +57,13 @@ class ssh ( validate_re($sshd_use_pam, '^(yes|no)$', "sshd_use_pam may be either 'yes' or 'no' and is set to <${sshd_use_pam}>.") if is_integer($sshd_client_alive_interval) == false { fail("sshd_client_alive_interval must be an integer and is set to <${sshd_client_alive_interval}>.") } + if $sshd_config_banner != 'none' { + validate_absolute_path($sshd_config_banner) + } + if $sshd_banner_content != undef and $sshd_config_banner == 'none' { + fail("sshd_config_banner must be set to be able to use sshd_banner_content") + } + case type($ssh_config_sendenv_xmodifiers) { 'string': { $ssh_config_sendenv_xmodifiers_real = str2bool($ssh_config_sendenv_xmodifiers) @@ -171,6 +182,18 @@ class ssh ( require => Package['ssh_packages'], } + if $sshd_config_banner != 'none' and $sshd_banner_content != undef { + file { 'sshd_banner' : + ensure => file, + path => $sshd_config_banner, + mode => $sshd_banner_mode, + owner => $sshd_banner_owner, + group => $sshd_banner_group, + content => $sshd_banner_content, + require => Package['ssh_packages'], + } + } + case $manage_root_ssh_config { 'true': { diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index fe39e47..97f4d4d 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -405,6 +405,7 @@ describe 'ssh' do :sshd_config_print_motd => 'no', :sshd_config_use_dns => 'no', :sshd_config_banner => '/etc/sshd_banner', + :sshd_banner_content => 'textinbanner', :sshd_config_xauth_location => '/opt/ssh/bin/xauth', :sshd_config_subsystem_sftp => '/opt/ssh/bin/sftp', :sshd_password_authentication => 'no', @@ -441,6 +442,18 @@ describe 'ssh' do it { should contain_file('sshd_config').with_content(/^X11Forwarding no$/) } it { should contain_file('sshd_config').with_content(/^UsePAM no$/) } it { should contain_file('sshd_config').with_content(/^ClientAliveInterval 242$/) } + + it { + should contain_file('sshd_banner').with({ + 'ensure' => 'file', + 'path' => '/etc/sshd_banner', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'content' => 'textinbanner', + 'require' => 'Package[ssh_packages]', + }) + } end context 'with manage_root_ssh_config set to \'true\' on valid osfamily' do @@ -616,6 +629,46 @@ describe 'ssh' do end end + context 'with sshd_config_banner set to invalid value on valid osfamily' do + let :facts do + { + :fqdn => 'monkey.example.com', + :osfamily => 'RedHat', + :sshrsakey => 'AAAAB3NzaC1yc2EAAAABIwAAAQEArGElx46pD6NNnlxVaTbp0ZJMgBKCmbTCT3RaeCk0ZUJtQ8wkcwTtqIXmmiuFsynUT0DFSd8UIodnBOPqitimmooAVAiAi30TtJVzADfPScMiUnBJKZajIBkEMkwUcqsfh630jyBvLPE/kyQcxbEeGtbu1DG3monkeymanOBW1AKc5o+cJLXcInLnbowMG7NXzujT3BRYn/9s5vtT1V9cuZJs4XLRXQ50NluxJI7sVfRPVvQI9EMbTS4AFBXUej3yfgaLSV+nPZC/lmJ2gR4t/tKvMFF9m16f8IcZKK7o0rK7v81G/tREbOT5YhcKLK+0wBfR6RsmHzwy4EddZloyLQ==' + } + end + let :params do + { :sshd_config_banner => 'invalid/path' } + end + + it 'should fail' do + expect { + should include_class('ssh') + }.to raise_error(Puppet::Error,/is not an absolute path/) + end + end + context 'with sshd_banner_content set and with default value on sshd_config_banner on valid osfamily' do + let :facts do + { + :fqdn => 'monkey.example.com', + :osfamily => 'RedHat', + :sshrsakey => 'AAAAB3NzaC1yc2EAAAABIwAAAQEArGElx46pD6NNnlxVaTbp0ZJMgBKCmbTCT3RaeCk0ZUJtQ8wkcwTtqIXmmiuFsynUT0DFSd8UIodnBOPqitimmooAVAiAi30TtJVzADfPScMiUnBJKZajIBkEMkwUcqsfh630jyBvLPE/kyQcxbEeGtbu1DG3monkeymanOBW1AKc5o+cJLXcInLnbowMG7NXzujT3BRYn/9s5vtT1V9cuZJs4XLRXQ50NluxJI7sVfRPVvQI9EMbTS4AFBXUej3yfgaLSV+nPZC/lmJ2gR4t/tKvMFF9m16f8IcZKK7o0rK7v81G/tREbOT5YhcKLK+0wBfR6RsmHzwy4EddZloyLQ==' + } + end + let :params do + { + :sshd_banner_content => 'textinbanner' + } + end + + it 'should fail' do + expect { + should include_class('ssh') + }.to raise_error(Puppet::Error,/sshd_config_banner must be set to be able to use sshd_banner_content/) + end + end + + context 'with ssh_config_sendenv_xmodifiers set to invalid type, array' do let :facts do { From 8ed84f7e189197581bfb137466edb5f99e1c7c0b Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Sat, 21 Dec 2013 02:05:37 -0500 Subject: [PATCH 2/3] Update to work with new version of rspec-puppet --- spec/classes/init_spec.rb | 70 +++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 97f4d4d..08446b0 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -9,9 +9,12 @@ describe 'ssh' do :sshrsakey => 'AAAAB3NzaC1yc2EAAAABIwAAAQEArGElx46pD6NNnlxVaTbp0ZJMgBKCmbTCT3RaeCk0ZUJtQ8wkcwTtqIXmmiuFsynUT0DFSd8UIodnBOPqitimmooAVAiAi30TtJVzADfPScMiUnBJKZajIBkEMkwUcqsfh630jyBvLPE/kyQcxbEeGtbu1DG3monkeymanOBW1AKc5o+cJLXcInLnbowMG7NXzujT3BRYn/9s5vtT1V9cuZJs4XLRXQ50NluxJI7sVfRPVvQI9EMbTS4AFBXUej3yfgaLSV+nPZC/lmJ2gR4t/tKvMFF9m16f8IcZKK7o0rK7v81G/tREbOT5YhcKLK+0wBfR6RsmHzwy4EddZloyLQ==' } end - it { should include_class('ssh')} - it { should_not include_class('common')} + it { should compile.with_all_deps } + + it { should contain_class('ssh')} + + it { should_not contain_class('common')} it { should contain_package('ssh_packages').with({ @@ -91,9 +94,11 @@ describe 'ssh' do :sshrsakey => 'AAAAB3NzaC1yc2EAAAABIwAAAQEArGElx46pD6NNnlxVaTbp0ZJMgBKCmbTCT3RaeCk0ZUJtQ8wkcwTtqIXmmiuFsynUT0DFSd8UIodnBOPqitimmooAVAiAi30TtJVzADfPScMiUnBJKZajIBkEMkwUcqsfh630jyBvLPE/kyQcxbEeGtbu1DG3monkeymanOBW1AKc5o+cJLXcInLnbowMG7NXzujT3BRYn/9s5vtT1V9cuZJs4XLRXQ50NluxJI7sVfRPVvQI9EMbTS4AFBXUej3yfgaLSV+nPZC/lmJ2gR4t/tKvMFF9m16f8IcZKK7o0rK7v81G/tREbOT5YhcKLK+0wBfR6RsmHzwy4EddZloyLQ==' } end - it { should include_class('ssh')} + it { should compile.with_all_deps } - it { should_not include_class('common')} + it { should contain_class('ssh')} + + it { should_not contain_class('common')} it { should contain_package('ssh_packages').with({ @@ -174,9 +179,11 @@ describe 'ssh' do :sshrsakey => 'AAAAB3NzaC1yc2EAAAABIwAAAQEArGElx46pD6NNnlxVaTbp0ZJMgBKCmbTCT3RaeCk0ZUJtQ8wkcwTtqIXmmiuFsynUT0DFSd8UIodnBOPqitimmooAVAiAi30TtJVzADfPScMiUnBJKZajIBkEMkwUcqsfh630jyBvLPE/kyQcxbEeGtbu1DG3monkeymanOBW1AKc5o+cJLXcInLnbowMG7NXzujT3BRYn/9s5vtT1V9cuZJs4XLRXQ50NluxJI7sVfRPVvQI9EMbTS4AFBXUej3yfgaLSV+nPZC/lmJ2gR4t/tKvMFF9m16f8IcZKK7o0rK7v81G/tREbOT5YhcKLK+0wBfR6RsmHzwy4EddZloyLQ==' } end - it { should include_class('ssh')} + it { should compile.with_all_deps } - it { should_not include_class('common')} + it { should contain_class('ssh')} + + it { should_not contain_class('common')} it { should contain_package('ssh_packages').with({ @@ -257,9 +264,11 @@ describe 'ssh' do :sshrsakey => 'AAAAB3NzaC1yc2EAAAABIwAAAQEArGElx46pD6NNnlxVaTbp0ZJMgBKCmbTCT3RaeCk0ZUJtQ8wkcwTtqIXmmiuFsynUT0DFSd8UIodnBOPqitimmooAVAiAi30TtJVzADfPScMiUnBJKZajIBkEMkwUcqsfh630jyBvLPE/kyQcxbEeGtbu1DG3monkeymanOBW1AKc5o+cJLXcInLnbowMG7NXzujT3BRYn/9s5vtT1V9cuZJs4XLRXQ50NluxJI7sVfRPVvQI9EMbTS4AFBXUej3yfgaLSV+nPZC/lmJ2gR4t/tKvMFF9m16f8IcZKK7o0rK7v81G/tREbOT5YhcKLK+0wBfR6RsmHzwy4EddZloyLQ==' } end - it { should include_class('ssh')} + it { should compile.with_all_deps } - it { should_not include_class('common')} + it { should contain_class('ssh')} + + it { should_not contain_class('common')} it { should contain_package('ssh_packages').with({ @@ -346,7 +355,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/ssh supports osfamilies RedHat, Suse and Debian. Detected osfamily is ./) end end @@ -368,6 +377,8 @@ describe 'ssh' do } end + it { should compile.with_all_deps } + it { should contain_file('ssh_config').with({ 'ensure' => 'file', @@ -416,6 +427,8 @@ describe 'ssh' do } end + it { should compile.with_all_deps } + it { should contain_file('sshd_config').with({ 'ensure' => 'file', @@ -469,9 +482,11 @@ describe 'ssh' do { :manage_root_ssh_config => 'true' } end - it { should include_class('ssh')} + it { should compile.with_all_deps } - it { should include_class('common')} + it { should contain_class('ssh')} + + it { should contain_class('common')} it { should contain_file('root_ssh_dir').with({ @@ -509,7 +524,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/sshd_config_port must be a valid number and is set to <22invalid>./) end end @@ -529,7 +544,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/manage_root_ssh_config is and must be \'true\' or \'false\'./) end end @@ -548,7 +563,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/sshd_password_authentication may be either \'yes\' or \'no\' and is set to ./) end end @@ -567,7 +582,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/sshd_allow_tcp_forwarding may be either \'yes\' or \'no\' and is set to ./) end end @@ -586,7 +601,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/sshd_x11_forwarding may be either \'yes\' or \'no\' and is set to ./) end end @@ -605,7 +620,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/sshd_use_pam may be either \'yes\' or \'no\' and is set to ./) end end @@ -624,7 +639,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/sshd_client_alive_interval must be an integer and is set to ./) end end @@ -643,10 +658,11 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/is not an absolute path/) end end + context 'with sshd_banner_content set and with default value on sshd_config_banner on valid osfamily' do let :facts do { @@ -663,7 +679,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/sshd_config_banner must be set to be able to use sshd_banner_content/) end end @@ -683,7 +699,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error,/ssh_config_sendenv_xmodifiers type must be true or false./) end end @@ -702,6 +718,8 @@ describe 'ssh' do } end + it { should compile.with_all_deps } + it { should contain_file('ssh_config').with_content(/^ SendEnv XMODIFIERS$/) } end @@ -717,9 +735,11 @@ describe 'ssh' do { :manage_firewall => true } end - it { should include_class('ssh')} + it { should compile.with_all_deps } - it { should_not include_class('common')} + it { should contain_class('ssh')} + + it { should_not contain_class('common')} it { should contain_firewall('22 open port 22 for SSH').with({ @@ -754,6 +774,8 @@ describe 'ssh' do } } } } + it { should compile.with_all_deps } + it { should contain_ssh_authorized_key('root_for_userX').with({ 'ensure' => 'present', @@ -787,7 +809,7 @@ describe 'ssh' do it 'should fail' do expect { - should include_class('ssh') + should contain_class('ssh') }.to raise_error(Puppet::Error) end end From 42efd6ebfcc42eb8067e9e082fae9c2cd23f79ed Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Sat, 21 Dec 2013 02:21:06 -0500 Subject: [PATCH 3/3] Clean up contributions and improve spec tests --- .gitignore | 1 + README.md | 8 ++++---- manifests/init.pp | 26 +++++++++++++------------- spec/classes/init_spec.rb | 20 ++++++++++---------- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 4bc8945..2e7f696 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ metadata.json coverage/ spec/fixtures/modules/* Gemfile.lock +spec/fixtures/ diff --git a/README.md b/README.md index 8ecb836..b0fe70c 100644 --- a/README.md +++ b/README.md @@ -136,25 +136,25 @@ Banner option in sshd_config. sshd_banner_content ------------------- -Banner content in sshd_config_banner +content parameter for file specified in sshd_config_banner - *Default*: undef sshd_banner_owner ----------------- -sshd_config_banner owner +owner parameter for file specified in sshd_config_banner - *Default*: 'root' sshd_banner_group ----------------- -sshd_config_banner group +group parameter for file specified in sshd_config_banner - *Default*: 'root' sshd_banner_mode ---------------- -sshd_config_banner mode +mode parameter for file specified in sshd_config_banner - *Default*: '0644' diff --git a/manifests/init.pp b/manifests/init.pp index e471539..fa40f78 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -50,18 +50,18 @@ class ssh ( ) { # validate params - validate_re($sshd_config_port, '^\d+$', "sshd_config_port must be a valid number and is set to <${sshd_config_port}>") - validate_re($sshd_password_authentication, '^(yes|no)$', "sshd_password_authentication may be either 'yes' or 'no' and is set to <${sshd_password_authentication}>.") - validate_re($sshd_allow_tcp_forwarding, '^(yes|no)$', "sshd_allow_tcp_forwarding may be either 'yes' or 'no' and is set to <${sshd_allow_tcp_forwarding}>.") - validate_re($sshd_x11_forwarding, '^(yes|no)$', "sshd_x11_forwarding may be either 'yes' or 'no' and is set to <${sshd_x11_forwarding}>.") - validate_re($sshd_use_pam, '^(yes|no)$', "sshd_use_pam may be either 'yes' or 'no' and is set to <${sshd_use_pam}>.") - if is_integer($sshd_client_alive_interval) == false { fail("sshd_client_alive_interval must be an integer and is set to <${sshd_client_alive_interval}>.") } + validate_re($sshd_config_port, '^\d+$', "ssh::sshd_config_port must be a valid number and is set to <${sshd_config_port}>.") + validate_re($sshd_password_authentication, '^(yes|no)$', "ssh::sshd_password_authentication may be either 'yes' or 'no' and is set to <${sshd_password_authentication}>.") + validate_re($sshd_allow_tcp_forwarding, '^(yes|no)$', "ssh::sshd_allow_tcp_forwarding may be either 'yes' or 'no' and is set to <${sshd_allow_tcp_forwarding}>.") + validate_re($sshd_x11_forwarding, '^(yes|no)$', "ssh::sshd_x11_forwarding may be either 'yes' or 'no' and is set to <${sshd_x11_forwarding}>.") + validate_re($sshd_use_pam, '^(yes|no)$', "ssh::sshd_use_pam may be either 'yes' or 'no' and is set to <${sshd_use_pam}>.") + if is_integer($sshd_client_alive_interval) == false { fail("ssh::sshd_client_alive_interval must be an integer and is set to <${sshd_client_alive_interval}>.") } if $sshd_config_banner != 'none' { validate_absolute_path($sshd_config_banner) } if $sshd_banner_content != undef and $sshd_config_banner == 'none' { - fail("sshd_config_banner must be set to be able to use sshd_banner_content") + fail("ssh::sshd_config_banner must be set to be able to use sshd_banner_content.") } case type($ssh_config_sendenv_xmodifiers) { @@ -72,7 +72,7 @@ class ssh ( $ssh_config_sendenv_xmodifiers_real = $ssh_config_sendenv_xmodifiers } default: { - fail("ssh_config_sendenv_xmodifiers type must be true or false.") + fail("ssh::ssh_config_sendenv_xmodifiers type must be true or false.") } } @@ -81,7 +81,7 @@ class ssh ( # noop } default: { - fail("permit_root_login may be either 'yes', 'without-password', 'forced-commands-only' or 'no' and is set to <${permit_root_login}>") + fail("ssh::permit_root_login may be either 'yes', 'without-password', 'forced-commands-only' or 'no' and is set to <${permit_root_login}>.") } } @@ -93,7 +93,7 @@ class ssh ( $key = $::sshdsakey } default: { - fail("ssh_key_type must be 'ssh-rsa', 'rsa', 'ssh-dsa', or 'dsa' and is <${ssh_key_type}>") + fail("ssh::ssh_key_type must be 'ssh-rsa', 'rsa', 'ssh-dsa', or 'dsa' and is <${ssh_key_type}>.") } } @@ -102,7 +102,7 @@ class ssh ( # noop } default: { - fail("purge_keys must be 'true' or 'false' and is <${purge_keys}>") + fail("ssh::purge_keys must be 'true' or 'false' and is <${purge_keys}>.") } } @@ -186,9 +186,9 @@ class ssh ( file { 'sshd_banner' : ensure => file, path => $sshd_config_banner, - mode => $sshd_banner_mode, owner => $sshd_banner_owner, group => $sshd_banner_group, + mode => $sshd_banner_mode, content => $sshd_banner_content, require => Package['ssh_packages'], } @@ -223,7 +223,7 @@ class ssh ( # noop } default: { - fail("manage_root_ssh_config is <${manage_root_ssh_config}> and must be \'true\' or \'false\'.") + fail("ssh::manage_root_ssh_config is <${manage_root_ssh_config}> and must be \'true\' or \'false\'.") } } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 08446b0..c4393b0 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -356,7 +356,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/ssh supports osfamilies RedHat, Suse and Debian. Detected osfamily is ./) + }.to raise_error(Puppet::Error,/^ssh supports osfamilies RedHat, Suse and Debian. Detected osfamily is \./) end end @@ -525,7 +525,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/sshd_config_port must be a valid number and is set to <22invalid>./) + }.to raise_error(Puppet::Error,/^ssh::sshd_config_port must be a valid number and is set to <22invalid>\./) end end @@ -545,7 +545,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/manage_root_ssh_config is and must be \'true\' or \'false\'./) + }.to raise_error(Puppet::Error,/^ssh::manage_root_ssh_config is and must be \'true\' or \'false\'\./) end end @@ -564,7 +564,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/sshd_password_authentication may be either \'yes\' or \'no\' and is set to ./) + }.to raise_error(Puppet::Error,/^ssh::sshd_password_authentication may be either \'yes\' or \'no\' and is set to \./) end end @@ -583,7 +583,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/sshd_allow_tcp_forwarding may be either \'yes\' or \'no\' and is set to ./) + }.to raise_error(Puppet::Error,/^ssh::sshd_allow_tcp_forwarding may be either \'yes\' or \'no\' and is set to \./) end end @@ -602,7 +602,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/sshd_x11_forwarding may be either \'yes\' or \'no\' and is set to ./) + }.to raise_error(Puppet::Error,/^ssh::sshd_x11_forwarding may be either \'yes\' or \'no\' and is set to \./) end end @@ -621,7 +621,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/sshd_use_pam may be either \'yes\' or \'no\' and is set to ./) + }.to raise_error(Puppet::Error,/^ssh::sshd_use_pam may be either \'yes\' or \'no\' and is set to \./) end end @@ -640,7 +640,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/sshd_client_alive_interval must be an integer and is set to ./) + }.to raise_error(Puppet::Error,/^ssh::sshd_client_alive_interval must be an integer and is set to \./) end end @@ -680,7 +680,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/sshd_config_banner must be set to be able to use sshd_banner_content/) + }.to raise_error(Puppet::Error,/^ssh::sshd_config_banner must be set to be able to use sshd_banner_content\./) end end @@ -700,7 +700,7 @@ describe 'ssh' do it 'should fail' do expect { should contain_class('ssh') - }.to raise_error(Puppet::Error,/ssh_config_sendenv_xmodifiers type must be true or false./) + }.to raise_error(Puppet::Error,/^ssh::ssh_config_sendenv_xmodifiers type must be true or false\./) end end