Skip to content

Fixes #33733 - generate key for db encryption #235

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

Merged
merged 2 commits into from
Oct 20, 2021
Merged
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
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 '+/' '-_' > ${pulpcore::database_key_file}",
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
1 change: 1 addition & 0 deletions spec/classes/pulpcore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
.without_content(%r{sslmode})
.without_content(%r{WORKER_TTL})
is_expected.to contain_file('/etc/pulp')
is_expected.to contain_file('/etc/pulp/certs/database_fields.symmetric.key')
is_expected.to contain_file('/var/lib/pulp')
is_expected.to contain_file('/var/lib/pulp/sync_imports')
is_expected.to contain_file('/var/lib/pulp/assets')
Expand Down