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

Refs #32885: Add puppet user to user_groups only if server or client certificate contains puppet path #938

Merged
merged 1 commit into from
Jun 25, 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
8 changes: 7 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
}

if $foreman::manage_user {
if $foreman::puppet_ssldir in $foreman::server_ssl_key or $foreman::puppet_ssldir in $foreman::client_ssl_key {
$_user_groups = $foreman::user_groups + ['puppet']
} else {
$_user_groups = $foreman::user_groups
}

group { $foreman::group:
ensure => 'present',
}
Expand All @@ -83,7 +89,7 @@
comment => 'Foreman',
home => $foreman::app_root,
gid => $foreman::group,
groups => $foreman::user_groups,
groups => unique($_user_groups),
}
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$manage_user = true
$user = 'foreman'
$group = 'foreman'
$user_groups = ['puppet']
$user_groups = []
$rails_env = 'production'
$version = 'present'
$plugin_version = 'present'
Expand Down
4 changes: 3 additions & 1 deletion spec/acceptance/hieradata/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ foreman::server_ssl_cert: /etc/foreman-certs/certificate.pem
foreman::server_ssl_chain: /etc/foreman-certs/certificate.pem
foreman::server_ssl_crl: ""
foreman::server_ssl_key: /etc/foreman-certs/key.pem
foreman::user_groups: []
foreman::client_ssl_ca: /etc/foreman-certs/certificate.pem
foreman::client_ssl_cert: /etc/foreman-certs/certificate.pem
foreman::client_ssl_key: /etc/foreman-certs/key.pem
ekohl marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 13 additions & 0 deletions spec/classes/foreman_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,19 @@
it { should_not contain_class('redis::instance') }
end
end

describe 'with non-Puppet SSL certificates' do
let(:params) do
super().merge(
server_ssl_key: '/etc/pki/localhost.key',
server_ssl_cert: '/etc/pki/localhost.crt',
client_ssl_key: '/etc/pki/localhost.key',
client_ssl_cert: '/etc/pki/localhost.crt',
)
end

it { should contain_user('foreman').with('groups' => []) }
end
end
end
end