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

Create pki_dir structure only when deployed #436

Closed
wants to merge 3 commits into from
Closed
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
21 changes: 15 additions & 6 deletions manifests/ca.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
ensure => absent,
}

file { $ssl_build_dir:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0700',
}

file { $ca_key_password_file:
ensure => file,
content => $ca_key_password,
Expand All @@ -47,7 +54,7 @@
generate => $generate,
deploy => false,
password_file => $ca_key_password_file,
build_dir => $certs::ssl_build_dir,
build_dir => $ssl_build_dir,
}
$default_ca = Ca[$default_ca_name]

Expand All @@ -57,15 +64,15 @@
generate => $generate,
deploy => false,
custom_pubkey => $certs::server_ca_cert,
build_dir => $certs::ssl_build_dir,
build_dir => $ssl_build_dir,
}
} else {
ca { $server_ca_name:
ensure => present,
generate => $generate,
deploy => false,
custom_pubkey => "${certs::ssl_build_dir}/${default_ca_name}.crt",
build_dir => $certs::ssl_build_dir,
custom_pubkey => "${ssl_build_dir}/${default_ca_name}.crt",
build_dir => $ssl_build_dir,
}
}

Expand All @@ -78,6 +85,8 @@
}

if $deploy {
include certs::config

# Ensure CA key deployed to /etc/pki/katello/private no longer exists
# The CA key is not used by anything from this directory and does not need to be deployed
file { $ca_key:
Expand All @@ -86,15 +95,15 @@

file { $certs::katello_default_ca_cert:
ensure => file,
source => "${certs::ssl_build_dir}/${default_ca_name}.crt",
source => "${ssl_build_dir}/${default_ca_name}.crt",
owner => 'root',
group => 'root',
mode => '0644',
}

file { $katello_server_ca_cert:
ensure => file,
source => "${certs::ssl_build_dir}/${server_ca_name}.crt",
source => "${ssl_build_dir}/${server_ca_name}.crt",
owner => $owner,
group => $group,
mode => '0644',
Expand Down
7 changes: 0 additions & 7 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
Stdlib::Absolutepath $pki_dir = $certs::pki_dir,
String $group = $certs::group,
) {
file { $certs::ssl_build_dir:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0700',
}

file { $pki_dir:
ensure => directory,
owner => 'root',
Expand Down
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,9 @@
}

contain certs::install
contain certs::config
contain certs::ca

Class['certs::install'] ->
Class['certs::config'] ->
Class['certs::ca']

$default_ca = $certs::ca::default_ca
Expand Down
2 changes: 2 additions & 0 deletions manifests/keypair.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
Boolean $key_decrypt = false,
Optional[Stdlib::Absolutepath] $key_password_file = undef,
) {
include certs::config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This inclusion breaks all of the tests, I do not think it is needed.


private_key { $key_file:
ensure => $key_ensure,
source => "${source_dir}/${title}.key",
Expand Down
2 changes: 2 additions & 0 deletions manifests/qpid.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
$nss_db_dir = $certs::ssltools::nssdb::nss_db_dir
$nss_db_password_file = $certs::ssltools::nssdb::nss_db_password_file

include certs::config

$client_cert = "${pki_dir}/certs/${qpid_cert_name}.crt"
$client_key = "${pki_dir}/private/${qpid_cert_name}.key"

Expand Down
Loading