Skip to content

Commit

Permalink
Fixes #33733 - generate key for db encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsherrill committed Oct 20, 2021
1 parent bb9f167 commit bab2fa6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configures pulp3
# @api private
class pulpcore::config {
file { $pulpcore::config_dir:
file { [$pulpcore::config_dir, $pulpcore::certs_dir]:
ensure => directory,
owner => 'root',
group => 'root',
Expand Down Expand Up @@ -51,4 +51,17 @@
mode => '0770',
}

exec { 'Create database symmetric key':
path => ['/bin', '/usr/bin'],
command => "openssl rand -base64 32 | tr '+/' '-_' > /etc/pulp/certs/database_fields.symmetric.key",
creates => $pulpcore::database_key_file,
}

file { $pulpcore::database_key_file:
owner => 'root',
group => $pulpcore::group,
mode => '0640',
require => Exec['Create database symmetric key'],
}

}
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
Enum['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'] $log_level = 'INFO',
) {
$settings_file = "${config_dir}/settings.py"
$certs_dir = "${config_dir}/certs/"
$database_key_file = "${certs_dir}/database_fields.symmetric.key"

contain pulpcore::install
contain pulpcore::database
Expand Down

0 comments on commit bab2fa6

Please sign in to comment.