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

Use puppet-openssl and remove use of katello-certs-tool #453

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
11 changes: 7 additions & 4 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
fixtures:
repositories:
extlib: "https://github.com/voxpupuli/puppet-extlib"
foreman: "https://github.com/theforeman/puppet-foreman"
redis: "https://github.com/voxpupuli/puppet-redis"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib"
extlib: "https://github.com/voxpupuli/puppet-extlib"
foreman: "https://github.com/theforeman/puppet-foreman"
openssl:
repo: "https://github.com/ehelms/puppet-openssl"
branch: "ca-password"
redis: "https://github.com/voxpupuli/puppet-redis"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib"
40 changes: 40 additions & 0 deletions fixtures/katello-certs-tool-ca/katello-default-ca.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-----BEGIN CERTIFICATE-----
MIIG/zCCBOegAwIBAgIUEJSPbzfROxOw3z7dxrx7JZ8DmvEwDQYJKoZIhvcNAQEL
BQAwgYExCzAJBgNVBAYTAlVTMRcwFQYDVQQIDA5Ob3J0aCBDYXJvbGluYTEQMA4G
A1UEBwwHUmFsZWlnaDEQMA4GA1UECgwHS2F0ZWxsbzEUMBIGA1UECwwLU29tZU9y
Z1VuaXQxHzAdBgNVBAMMFmNlbnRvczgtNjQuZXhhbXBsZS5jb20wHhcNMjQwNTIw
MjIzNTI5WhcNMzgwMTE3MjIzNTI5WjCBgTELMAkGA1UEBhMCVVMxFzAVBgNVBAgM
Dk5vcnRoIENhcm9saW5h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/katello-default-ca.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIJrTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIOklCZ8PO84QCAggA
MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBBr1RbWYKKKaEbyQpATz7vABIIJ
UEEj0gg4PP+JNEwcroBIvyNWaa+dTaOWQGp6yt6ewHpXB9a1gclci4XbyX7Jtw8S
WTOSR1vGrOARFTgLoXMLwy/XEKvm0ljKdWt8P1OMcYvbQnMvxs3Wq2xB7XIpF0iL
2/M2MD8c7OFEutJ583uXfyT2PjJjbHR+GQf0feeef5Q8s4s92+QNEGclFDqwWYOK
3zpINt6JD2XuyoLuJQW0NfsMZxy8FbefOrV4ThEunxQ8dfmBMrGEn5i2yylzqNLN
oR6Zlk/0LYBGgSNAMfCBSyTscHed0kwr4ggI7EUcjEd7q1eSDLFIh9jEpGook18e
eczkIu3BR5EcQafnnCn9+qNwDwFcbTxtSly7ol6zMaRas/ABja+ULHVoD31elI77
6hGCQNTDwywn4sq5JAMC23A4uqVvHZBh5+kF/cr+YeItOZgVqj3gL1PxK0yZRoL9
aHmqvYykvBnyrrIhaP08uCRGp7n6mzpx+oxyfXvzByOVwFw7TFe3sgiBPDzxwzGt
3qumvdQWhDoOa6bdoiaVou/dWrWOIWj+qpCPF3GZRzCDDBMMVSmtzncDJw20cBXG
7PwcMEqhFLkrxGCh0i6yHGxH8djxIxdkzsjd1GStLEdooRk4tuyfblu3teizM7sb
OtjR6anCpEZpil83q/o3CUs/9jNsJ9DxoYERUSONzUStpCWHHZwpPjx88BTCLch+
USO8XbhbVMccSp2ZdRrjxjhpR1Wc3sjwprVmcGBlvaOhOA3tg+AIi8dQwWEUxN34
1EQqKbdtcKNvaj2SrM7+ljG9CxO4N13UfE0SNAihDsFFT7Br8C+0cf4Io4egvY2N
eEjlZUSaY2xkCzKpkHb/fH3CGQvh9sGx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IJUi6UCF+ibiILREehSBUmR9oE5jQrz
GRL8zu4/8sP+mw9LA0sxL5DG0eX6x/lJ4VTMFAlUiJH5DWt5bW9zNke5rMnTrBmN
spQ/vkC1W5YTH9RY5H6d5Sa1ft/OJbWqrbxAB5U73YCx4a18lb0r6Nkqb8JcYUCU
FamldCh+SbP3xYt9Mn7COqEM6jyUNyjXW8zew8Ksm9Ii
-----END ENCRYPTED PRIVATE KEY-----
1 change: 1 addition & 0 deletions fixtures/katello-certs-tool-ca/katello-default-ca.pwd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WJiNgAHTJia2249gwxCGk9VT
40 changes: 40 additions & 0 deletions fixtures/katello-certs-tool-ca/katello-server-ca.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-----BEGIN CERTIFICATE-----
MIIG/zCCBOegAwIBAgIUEJSPbzfROxOw3z7dxrx7JZ8DmvEwDQYJKoZIhvcNAQEL
BQAwgYExCzAJBgNVBAYTAlVTMRcwFQYDVQQIDA5Ob3J0aCBDYXJvbGluYTEQMA4G
A1UEBwwHUmFsZWlnaDEQMA4GA1UECgwHS2F0ZWxsbzEUMBIGA1UECwwLU29tZU9y
Z1VuaXQxHzAdBgNVBAMMFmNlbnRvczgtNjQuZXhhbXBsZS5jb20wHhcNMjQwNTIw
MjIzNTI5WhcNMzgwMTE3MjIzNTI5WjCBgTELMAkGA1UEBhMCVVMxFzAVBgNVBAgM
Dk5vcnRoIENhcm9saW5hMRAwDgYDVQQHDAdSYWxlaWdoMRAwDgYDVQQKDAdLYXRl
bGxvMRQwEgYDVQQLDAtTb21lT3JnVW5pdDEfMB0GA1UEAwwWY2VudG9zOC02NC5l
eGFtcGxlLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALaSYmvi
t4ocOb2h71lqfCx/e/11I+uA9JIYvdYv3JIDgyXqqM6hLJJZU0rHEcVcE+dUDw2L
UB2Sg+S1vXM4LhpBTKUvXpc6tlDFPNUszifIlk6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j283
0TsTsN8+3ca8eyWfA5rxMA0GCSqGSIb3DQEBCwUAA4ICAQBvhQKiEmKr9oGpgTQ3
MHg+5iJsFyLL5IPN7JHp8tuFzX5+pHaLl4sgmNIOVxL1Ft4I0JkgPimFViqsJPAz
trUl5mZBW1MchA7H7+Qi/ZCctpk0fi04WeM+O0tpm9OPzlGGL5mQekCDQ1S7p+3M
xnk+rnIT6nmgqV5rg9cM+228Rd4cngU3HNsM8xx91UXKjz5eL9DIotl3iVU9wsQ1
X1Pi6+qHMPp7JrXBYmqbxTCDupBWpgWYyb4uw63TO/MVQBjck9RLgx3++hR7WUnC
VG0ONFPN41InSu+0EdA0fbM7zC3MjlwsX3WSPI39THRVQfyRrrglPMlt7bW8d5eb
gILD/e0kn1J0OmFchj5v3eUWdbCMnKCelJkhlwDGpirRu+kXRKy0zFGDkR+z8kvz
YBIdDEFyJ4qINAWNP4HHQkHUd/aDpHSbfAojVwEj1lsdHO4LJqpBp/LulBPm86D7
hBj86kv7YqXn/vOlZ4iGAoeA94PXORABZdPIlfkLGTRbHRPp2BcT06piwB8hwaAL
XrjWptfB3C1CFn81K86m6aBAkz83EYC+YkED23HVpUwpDEaViuDtUt74SfxuvW8H
/W+sZzlezCgwdIpkuC9M64HyHPuIuIbu0zZVSeMHvHwEbRMJeq3rwOZsuPLDkT3K
gxbEhBEPxtdiAzmH3W9+isXTng==
-----END CERTIFICATE-----
76 changes: 41 additions & 35 deletions manifests/apache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
String $city = $certs::city,
String $org = $certs::org,
String $org_unit = $certs::org_unit,
String $expiration = $certs::expiration,
Variant[Integer, String] $expiration = $certs::expiration,
Copy link
Member

Choose a reason for hiding this comment

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

I'd be open to a PR that already changes it from Strings to Integers prior to merging this.

Stdlib::Absolutepath $ca_key_password_file = $certs::ca_key_password_file,
String $group = $certs::group,
) inherits certs {
Expand All @@ -71,7 +71,7 @@

$apache_cert_path = "${certs::ssl_build_dir}/${hostname}/${apache_cert_name}"

if $server_cert {
if $generate {
ensure_resource(
'file',
"${certs::ssl_build_dir}/${hostname}",
Expand All @@ -82,41 +82,47 @@
'mode' => '0750',
}
)
file { "${apache_cert_path}.crt":
ensure => file,
source => $server_cert,
owner => 'root',
group => 'root',
mode => '0440',
}
file { "${apache_cert_path}.key":
ensure => file,
source => $server_key,
owner => 'root',
group => 'root',
mode => '0440',
}

$require_cert = File["${apache_cert_path}.crt"]
} else {
cert { $apache_cert_name:
ensure => present,
hostname => $hostname,
cname => $cname,
country => $country,
state => $state,
city => $city,
org => $org,
org_unit => $org_unit,
expiration => $expiration,
ca => $certs::default_ca,
generate => $generate,
regenerate => $regenerate,
password_file => $ca_key_password_file,
build_dir => $certs::ssl_build_dir,
}
if $server_cert {
file { "${apache_cert_path}.crt":
ensure => file,
source => $server_cert,
owner => 'root',
group => 'root',
mode => '0440',
}
file { "${apache_cert_path}.key":
ensure => file,
source => $server_key,
owner => 'root',
group => 'root',
mode => '0440',
}

$require_cert = File["${apache_cert_path}.crt"]
} else {
openssl::certificate::x509 { $apache_cert_name:
ensure => present,
commonname => $hostname,
country => $country,
state => $state,
locality => $city,
organization => $org,
unit => $org_unit,
altnames => $cname,
extkeyusage => ['serverAuth', 'clientAuth'],
days => $expiration,
base_dir => "${certs::ssl_build_dir}/${hostname}",
key_size => 4096,
force => true,
encrypted => false,
ca => "${certs::ssl_build_dir}/${certs::default_ca_name}.crt",
cakey => "${certs::ssl_build_dir}/${certs::default_ca_name}.key",
cakey_password => $certs::ca_key_password,
}

$require_cert = Cert[$apache_cert_name]
$require_cert = X509_cert["${apache_cert_path}.crt"]
}
}

if $deploy {
Expand Down
93 changes: 47 additions & 46 deletions manifests/ca.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,42 @@
) {
$server_ca_path = "${certs::ssl_build_dir}/${server_ca_name}.crt"

file { "${certs::pki_dir}/private/${default_ca_name}.pwd":
ensure => absent,
}

file { $ca_key_password_file:
ensure => file,
content => $ca_key_password,
owner => 'root',
group => 'root',
mode => '0400',
show_diff => false,
} ~>
ca { $default_ca_name:
ensure => present,
common_name => $ca_common_name,
country => $country,
state => $state,
city => $city,
org => $org,
org_unit => $org_unit,
expiration => $ca_expiration,
generate => $generate,
password_file => $ca_key_password_file,
build_dir => $certs::ssl_build_dir,
}

openssl::config { "${certs::ssl_build_dir}/ca.cnf":
ensure => 'present',
commonname => $certs::node_fqdn,
country => $country,
state => $state,
locality => $city,
organization => $org,
unit => $org_unit,
default_keyfile => "${default_ca_name}.key",
basicconstraints => ['CA:true'],
keyusages => ['digitalSignature', 'keyEncipherment', 'keyCertSign', 'cRLSign'],
extendedkeyusages => ['serverAuth', 'clientAuth'],
}

ssl_pkey { "${certs::ssl_build_dir}/${default_ca_name}.key":
ensure => 'present',
password => $ca_key_password,
size => '4096',
}

x509_cert { "${certs::ssl_build_dir}/${default_ca_name}.crt":
ensure => 'present',
private_key => "${certs::ssl_build_dir}/${default_ca_name}.key",
days => $ca_expiration,
template => "${certs::ssl_build_dir}/ca.cnf",
password => $ca_key_password,
require => File["${certs::ssl_build_dir}/ca.cnf"],
}

if $certs::server_ca_cert {
Expand All @@ -59,43 +71,32 @@
}
} else {
file { $server_ca_path:
ensure => file,
source => "${certs::ssl_build_dir}/${default_ca_name}.crt",
owner => 'root',
group => 'root',
mode => '0644',
}
}

if $generate {
file { "${certs::ssl_build_dir}/KATELLO-TRUSTED-SSL-CERT":
ensure => link,
target => $server_ca_path,
require => File[$server_ca_path],
ensure => file,
source => "${certs::ssl_build_dir}/${default_ca_name}.crt",
owner => 'root',
group => 'root',
mode => '0644',
require => X509_cert["${certs::ssl_build_dir}/${default_ca_name}.crt"],
}
}

if $deploy {
# 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:
ensure => absent,
}

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

file { $katello_server_ca_cert:
ensure => file,
source => $server_ca_path,
owner => $owner,
group => $group,
mode => '0644',
ensure => file,
source => $server_ca_path,
owner => $owner,
group => $group,
mode => '0644',
require => File[$server_ca_path],
}
}
}
Loading
Loading