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 08b7c0e
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions manifests/foreman_proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,25 @@
$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',
}

$require_cert = File["${proxy_cert_path}.crt"]
} else {
# cert for ssl of foreman-proxy
cert { $proxy_cert_name:
Expand All @@ -69,6 +75,9 @@
password_file => $ca_key_password_file,
build_dir => $certs::ssl_build_dir,
}


Check failure on line 79 in manifests/foreman_proxy.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

there should be no two consecutive empty lines (check: manifest_whitespace_two_empty_lines)
$require_cert = Cert[$apache_cert_name]

Check warning on line 80 in manifests/foreman_proxy.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

top-scope variable being used without an explicit namespace (check: variable_scope)
}

# cert for authentication of foreman_proxy against foreman
Expand Down Expand Up @@ -101,7 +110,7 @@
cert_owner => $owner,
cert_group => $group,
cert_mode => $public_key_mode,
require => Cert[$proxy_cert_name],
require => $require_cert,
}

file { $proxy_ca_cert:
Expand Down

0 comments on commit 08b7c0e

Please sign in to comment.