Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Solaris 9 support #57

Merged
merged 1 commit into from
May 12, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This module has been tested to work on the following systems using Puppet v3 wit

* EL 5
* EL 6
* Solaris 9
* Solaris 10
* Solaris 11
* Suse 9
Expand Down
29 changes: 26 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,29 @@
}
'Solaris': {
case $::kernelrelease {
'5.9': {
$default_pam_auth_lines = [ 'login auth requisite pam_authtok_get.so.1',
'login auth required pam_dhkeys.so.1',
'login auth required pam_unix_auth.so.1',
'login auth required pam_dial_auth.so.1',
'passwd auth required pam_passwd_auth.so.1',
'other auth requisite pam_authtok_get.so.1',
'other auth required pam_dhkeys.so.1',
'other auth required pam_unix_auth.so.1']

$default_pam_account_lines = ['cron account required pam_projects.so.1',
'cron account required pam_unix_account.so.1',
'other account requisite pam_roles.so.1',
'other account required pam_projects.so.1',
'other account required pam_unix_account.so.1']

$default_pam_password_lines = [ 'other password required pam_dhkeys.so.1',
'other password requisite pam_authtok_get.so.1',
'other password requisite pam_authtok_check.so.1',
'other password required pam_authtok_store.so.1']

$default_pam_session_lines = ['other session required pam_unix_session.so.1']
}
'5.10': {
$default_pam_auth_lines = [ 'login auth requisite pam_authtok_get.so.1',
'login auth required pam_dhkeys.so.1',
Expand Down Expand Up @@ -404,7 +427,7 @@
}

default: {
fail("Pam is only supported on Solaris 10 and 11. Your kernelrelease is identified as <${::kernelrelease}>.")
fail("Pam is only supported on Solaris 9, 10 and 11. Your kernelrelease is identified as <${::kernelrelease}>.")
}
}
}
Expand Down Expand Up @@ -732,7 +755,7 @@

'Solaris': {
case $::kernelrelease {
'5.10': {
'5.9','5.10': {
file { 'pam_conf':
ensure => file,
path => $pam_conf_file,
Expand All @@ -753,7 +776,7 @@
}
}
default: {
fail("Pam is only supported on Solaris 10 and 11. Your kernelrelease is identified as <${::kernelrelease}>.")
fail("Pam is only supported on Solaris 9, 10 and 11. Your kernelrelease is identified as <${::kernelrelease}>.")
}
}
}
Expand Down
66 changes: 63 additions & 3 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@
end
end

context 'with defaults params on Solaris 9' do
context 'with defaults params on Solaris 8' do
let(:facts) do
{ :osfamily => 'Solaris',
:kernelrelease => '5.9',
:kernelrelease => '5.8',
}
end

it 'should fail' do
expect {
should contain_class('pam')
}.to raise_error(Puppet::Error,/Pam is only supported on Solaris 10 and 11. Your kernelrelease is identified as <5.9>./)
}.to raise_error(Puppet::Error,/Pam is only supported on Solaris 9, 10 and 11. Your kernelrelease is identified as <5.8>./)
end
end
end
Expand Down Expand Up @@ -156,6 +156,17 @@
}
end

context 'with default params on Solaris 9' do
let :facts do
{
:osfamily => 'Solaris',
:kernelrelease => '5.9',
}
end

it { should_not contain_package('pam_package') }
end

context 'with default params on Solaris 10' do
let :facts do
{
Expand Down Expand Up @@ -934,6 +945,55 @@
}
end

context 'with default params on osfamily Solaris with kernelrelease 5.9' do
let :facts do
{
:osfamily => 'Solaris',
:kernelrelease => '5.9',
}
end

it {
should contain_file('pam_conf').with({
'ensure' => 'file',
'path' => '/etc/pam.conf',
'owner' => 'root',
'group' => 'sys',
'mode' => '0644',
})
}

it { should contain_file('pam_conf').with_content("# This file is being maintained by Puppet.
# DO NOT EDIT
# Auth
login auth requisite pam_authtok_get.so.1
login auth required pam_dhkeys.so.1
login auth required pam_unix_auth.so.1
login auth required pam_dial_auth.so.1
passwd auth required pam_passwd_auth.so.1
other auth requisite pam_authtok_get.so.1
other auth required pam_dhkeys.so.1
other auth required pam_unix_auth.so.1

# Account
cron account required pam_projects.so.1
cron account required pam_unix_account.so.1
other account requisite pam_roles.so.1
other account required pam_projects.so.1
other account required pam_unix_account.so.1

# Password
other password required pam_dhkeys.so.1
other password requisite pam_authtok_get.so.1
other password requisite pam_authtok_check.so.1
other password required pam_authtok_store.so.1

# Session
other session required pam_unix_session.so.1
")
}
end

context 'with default params on osfamily Solaris with kernelrelease 5.10' do
let :facts do
{
Expand Down