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

Do not set recursive ACLs on dhcp #621

Merged
merged 1 commit into from
Oct 12, 2020
Merged

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Oct 7, 2020

The cause for this change is the correct chaining. Previously there was no guarantee when the ACL was applied. In practice it was often done as: File[/etc/dhcp] -> Exec[setfacl] -> File[/etc/dhcp/dhcpd.conf]

This meant the dhcpd.conf file didn't receive the ACL anyway. After chaining to Class['dhcp'] (to guarantee all files existed) it turns out that /etc/dhcp/dhcpd.conf would become executable. That resulted in idempotency problems.

The Proxy needs to read dhcpd.conf, but that's guaranteed to be mode 0644 by theforeman/dhcp. Only the DHCP dir itself can have mode 0750 (owned by root:root) which is why the ACL is needed. By making it non-recursive and done after Class[dhcp] these problems are avoided.

This is an alternative to #620. Once merged to master, it should be cherry picked. In 14.1-stable it should also create a specific ACL on dhcpd.conf since there the mode is set to 0640.

My test env is still running so currently a draft.

The cause for this change is the correct chaining. Previously there was
no guarantee when the ACL was applied. In practice it was often done as:
File[/etc/dhcp] -> Exec[setfacl] -> File[/etc/dhcp/dhcpd.conf]

This meant the dhcpd.conf file didn't receive the ACL anyway. After
chaining to Class['dhcp'] (to guarantee all files existed) it turns out
that /etc/dhcp/dhcpd.conf would become executable. That resulted in
idempotency problems.

The Proxy needs to read dhcpd.conf, but that's guaranteed to be mode
0644 by theforeman/dhcp. Only the DHCP dir itself can have mode 0750
(owned by root:root) which is why the ACL is needed. By making it
non-recursive and done after Class[dhcp] these problems are avoided.
@ekohl ekohl marked this pull request as ready for review October 7, 2020 10:48
@ekohl
Copy link
Member Author

ekohl commented Oct 7, 2020

While working on this, I can't figure out why we set the ACL on the leases dir since that defaults to 0755. @ehelms do you remember why you did this in bde9c88?

@m-bucher
Copy link

m-bucher commented Oct 7, 2020

@ekohl can you add a reference the issue on redmine: https://projects.theforeman.org/issues/30962

@ekohl
Copy link
Member Author

ekohl commented Oct 8, 2020

I think it doesn't really refer to that issue. 30962 only affects the stable branch, but this is not the cherry pick.

@ehelms
Copy link
Member

ehelms commented Oct 8, 2020

I can recall only the context that https://projects.theforeman.org/issues/20683 and the associated RH bugzilla provide.

Copy link
Member

@ehelms ehelms left a comment

Choose a reason for hiding this comment

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

From my limited knowledge, and looking at the code

@ehelms ehelms merged commit 807b102 into theforeman:master Oct 12, 2020
@wbclark wbclark added the Bug label Oct 30, 2020
@ekohl ekohl deleted the no-recursive-acl branch August 4, 2022 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants