Skip to content

Commit

Permalink
Copy server cert for Foreman Proxy using file resource
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Mar 26, 2024
1 parent d43d1a1 commit 8a33911
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions manifests/foreman_proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,22 @@
$foreman_proxy_client_cert_name = "${hostname}-foreman-proxy-client"
$foreman_proxy_ssl_client_bundle = "${pki_dir}/private/${foreman_proxy_client_cert_name}-bundle.pem"

$proxy_cert_path = "${certs::ssl_build_dir}/${hostname}/${proxy_cert_name}"

if $server_cert {
cert { $proxy_cert_name:
ensure => present,
hostname => $hostname,
cname => $cname,
generate => $generate,
regenerate => $regenerate,
deploy => false,
custom_pubkey => $server_cert,
custom_privkey => $server_key,
custom_req => $server_cert_req,
build_dir => $certs::ssl_build_dir,
file { "${proxy_cert_path}.crt":
ensure => file,
source => $server_cert,
owner => 'root',
group => 'root',
mode => '0440',
}
file { "${proxy_cert_path}.key":
ensure => file,
source => $server_key,
owner => 'root',
group => 'root',
mode => '0440',
}
} else {
# cert for ssl of foreman-proxy
Expand All @@ -68,6 +72,12 @@
deploy => false,
password_file => $ca_key_password_file,
build_dir => $certs::ssl_build_dir,
} ->
file { "${proxy_cert_path}.crt":
ensure => file,
owner => 'root',
group => 'root',
mode => '0440',
}
}

Expand Down Expand Up @@ -101,7 +111,7 @@
cert_owner => $owner,
cert_group => $group,
cert_mode => $public_key_mode,
require => Cert[$proxy_cert_name],
require => File["${proxy_cert_path}.crt"],
}

file { $proxy_ca_cert:
Expand Down

0 comments on commit 8a33911

Please sign in to comment.