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

Fixes #30962 - fix dhcpd.conf acl #620

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions manifests/proxydhcp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@
exec { "Allow ${foreman_proxy::user} to read ${path}":
command => "setfacl -R -m u:${foreman_proxy::user}:rx ${path}",
m-bucher marked this conversation as resolved.
Show resolved Hide resolved
path => ['/bin', '/usr/bin'],
unless => "getfacl -p ${path} | grep user:${foreman_proxy::user}:r-x",
Copy link
Author

Choose a reason for hiding this comment

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

I am pretty sure we have to remove this line, because it prevents the permissions of files within those directories from being fixed, if the permission of the directory has not changed.

Copy link
Member

Choose a reason for hiding this comment

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

Removing this line means it's no longer idempotent.

require => Package['acl'],
require => [
Package['acl'],
Class['dhcp'],
],
}
}

Expand Down
6 changes: 2 additions & 4 deletions spec/classes/foreman_proxy__proxydhcp__spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@
case facts[:osfamily]
when 'RedHat', 'Debian'
it do should contain_exec('Allow foreman-proxy to read /etc/dhcp').
with_command('setfacl -R -m u:foreman-proxy:rx /etc/dhcp').
with_unless('getfacl -p /etc/dhcp | grep user:foreman-proxy:r-x')
with_command('setfacl -R -m u:foreman-proxy:rx /etc/dhcp')
end
else
it { should_not contain_exec('Allow foreman-proxy to read /etc/dhcp') }
Expand All @@ -89,8 +88,7 @@
case facts[:osfamily]
when 'RedHat', 'Debian'
it do should contain_exec("Allow foreman-proxy to read #{leases_dir}").
with_command("setfacl -R -m u:foreman-proxy:rx #{leases_dir}").
with_unless("getfacl -p #{leases_dir} | grep user:foreman-proxy:r-x")
with_command("setfacl -R -m u:foreman-proxy:rx #{leases_dir}")
end
else
it { should_not contain_exec("Allow foreman-proxy to read #{leases_dir}") }
Expand Down