Skip to content

Commit

Permalink
Merge pull request #50 from lsst-it/IT-3962/no-passphrases-in-logs
Browse files Browse the repository at this point in the history
prevent passphrases passed to install scripts from printing in logs
  • Loading branch information
mattock authored Sep 13, 2022
2 parents a4df4b6 + 159dd3c commit 92762aa
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion manifests/install/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
timeout => 0,
unless => "cat /etc/ipa/default.conf | grep -i \"${easy_ipa::domain}\"",
creates => '/etc/ipa/default.conf',
logoutput => 'on_failure',
logoutput => false, # prevent passphrases from appearing in puppet log
before => Service['sssd'],
provider => 'shell',
require => Package['ipa-client'],
Expand Down
2 changes: 1 addition & 1 deletion manifests/install/server/master.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
timeout => 0,
unless => '/usr/sbin/ipactl status >/dev/null 2>&1',
creates => '/etc/ipa/default.conf',
logoutput => 'on_failure',
logoutput => false, # prevent passphrases from appearing in puppet log
notify => Easy_ipa::Helpers::Flushcache["server_${easy_ipa::ipa_server_fqdn}"],
before => Service['sssd'],
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/install/server/replica.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
timeout => 0,
unless => '/usr/sbin/ipactl status >/dev/null 2>&1',
creates => '/etc/ipa/default.conf',
logoutput => 'on_failure',
logoutput => false, # prevent passphrases from appearing in puppet log
notify => Easy_ipa::Helpers::Flushcache["server_${easy_ipa::ipa_server_fqdn}"],
before => Service['sssd'],
}
Expand Down
47 changes: 38 additions & 9 deletions spec/classes/ipa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@
end

it do
is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with_command(%r{--idstart=10000})
is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with_command(%r{--idmax=20000})
is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with(
logoutput: false
).
with_command(%r{--idstart=10000}).
with_command(%r{--idmax=20000})
end
end

Expand All @@ -95,7 +98,9 @@
end

it do
is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with_command(%r{--idstart=10000})
is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with(
logoutput: false
).with_command(%r{--idstart=10000})
is_expected.not_to contain_exec('server_install_ipa.rpsec.example.lan').with_command(%r{--idmax})
end
end
Expand All @@ -114,7 +119,11 @@
super().merge(configure_ssh: false)
end

it { is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with_command(%r{--no-ssh(?!d)}) }
it {
is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with(
logoutput: false
).with_command(%r{--no-ssh(?!d)})
}
end
end

Expand All @@ -132,7 +141,11 @@
super().merge(configure_sshd: false)
end

it { is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with_command(%r{--no-sshd}) }
it {
is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with(
logoutput: false
).with_command(%r{--no-sshd})
}
end
end

Expand Down Expand Up @@ -255,7 +268,11 @@
super().merge(configure_ssh: false)
end

it { is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with_command(%r{--no-ssh(?!d)}) }
it {
is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with(
logoutput: false
).with_command(%r{--no-ssh(?!d)})
}
end
end

Expand All @@ -273,7 +290,11 @@
super().merge(configure_sshd: false)
end

it { is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with_command(%r{--no-sshd}) }
it {
is_expected.to contain_exec('server_install_ipa.rpsec.example.lan').with(
logoutput: false
).with_command(%r{--no-sshd})
}
end
end

Expand Down Expand Up @@ -354,7 +375,11 @@
super().merge(configure_ssh: false)
end

it { is_expected.to contain_exec('client_install_ipa.rpsec.example.lan').with_command(%r{--no-ssh(?!d)}) }
it {
is_expected.to contain_exec('client_install_ipa.rpsec.example.lan').with(
logoutput: false
).with_command(%r{--no-ssh(?!d)})
}
end
end

Expand All @@ -372,7 +397,11 @@
super().merge(configure_sshd: false)
end

it { is_expected.to contain_exec('client_install_ipa.rpsec.example.lan').with_command(%r{--no-sshd}) }
it {
is_expected.to contain_exec('client_install_ipa.rpsec.example.lan').with(
logoutput: false
).with_command(%r{--no-sshd})
}
end
end

Expand Down

0 comments on commit 92762aa

Please sign in to comment.