Skip to content

Commit

Permalink
Deploy the CA password file to ssl build directory
Browse files Browse the repository at this point in the history
As the pki_dir is intended for deployment rather than generation,
and the CA password file is needed primarily for certificate generation
it should reside in the build directory.
  • Loading branch information
ehelms authored and ekohl committed Sep 22, 2023
1 parent dd726d7 commit 4ba477a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions manifests/ca.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
String $ca_key_password = $certs::ca_key_password,
Stdlib::Absolutepath $ca_key_password_file = $certs::ca_key_password_file,
) {
file { "${certs::pki_dir}/private/${default_ca_name}.pwd":
ensure => absent,
}

file { $ca_key_password_file:
ensure => file,
content => $ca_key_password,
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
$ca_cert = "${pki_dir}/certs/${default_ca_name}.crt"
$ca_cert_stripped = "${pki_dir}/certs/${default_ca_name}-stripped.crt"
$ca_key_password = extlib::cache_data('foreman_cache_data', 'ca_key_password', extlib::random_password(24))
$ca_key_password_file = "${pki_dir}/private/${default_ca_name}.pwd"
$ca_key_password_file = "${ssl_build_dir}/${default_ca_name}.pwd"

$katello_server_ca_cert = "${pki_dir}/certs/${server_ca_name}.crt"
$katello_default_ca_cert = "${pki_dir}/certs/${default_ca_name}.crt"
Expand Down
8 changes: 8 additions & 0 deletions spec/acceptance/certs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@
describe package("katello-server-ca") do
it { should_not be_installed }
end

describe file('/root/ssl-build/katello-default-ca.pwd') do
it { should exist }
end

describe file('/etc/pki/katello/private/katello-default-ca.pwd') do
it { should_not exist }
end
end

context 'with deploy false' do
Expand Down

0 comments on commit 4ba477a

Please sign in to comment.