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

Avoid puppet errors when SELinux is disabled #295

Merged
merged 1 commit into from
Dec 7, 2019
Merged

Avoid puppet errors when SELinux is disabled #295

merged 1 commit into from
Dec 7, 2019

Conversation

blackknight36
Copy link
Contributor

Fixes #286. Puppet will no longer display a runtime error when applying a manifest on a node with selinux disabled. These changes essentially make the selinux::boolean, selinux::fcontext, and selinux::port types do nothing when SELinux is disabled.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Could you have a look at rubocop?

manifests/boolean.pp Outdated Show resolved Hide resolved
Updated selinux types to avoid runtime errors when SELinux is disabled.
selinux::boolean, selinux::fcontext, and selinux::port will now essentially
do nothing when SELinux is disabled.
Copy link
Contributor

@oranenj oranenj left a comment

Choose a reason for hiding this comment

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

Looks good. I suppose users who disable SELinux aren't prone to doing it by accident, so we might as well not make noise about it.

@oranenj oranenj requested a review from ekohl December 7, 2019 09:11
@oranenj
Copy link
Contributor

oranenj commented Dec 7, 2019

@ekohl can you take another look and merge if there are no issues?

value => $value,
persistent => $persistent,
# Do nothing unless SELinux is enabled
if $facts['selinux'] {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the selinux fact a hash though (thus always true)?

selinux (map) — Represents information about Security-Enhanced Linux (SELinux).
config_mode (string) — The configured SELinux mode.
config_policy (string) — The configured SELinux policy.
current_mode (string) — The current SELinux mode.
enabled (boolean) — True if SELinux is enabled or false if not.
enforced (boolean) — True if SELinux policy is enforced or false if not.
policy_version (string) — The version of the SELinux policy.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, my mistake. selinux is a boolean legacy fact. The new fact is os['selinux']

Copy link
Member

Choose a reason for hiding this comment

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

Which you've already covered in great detail in this thread. I'll get my coat... :)

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Thanks!

@ekohl ekohl added the enhancement New feature or request label Dec 7, 2019
@ekohl ekohl merged commit 77673e0 into voxpupuli:master Dec 7, 2019
@jorhett
Copy link

jorhett commented May 2, 2020

This needs to be done for selinux_permissive too

@ekohl
Copy link
Member

ekohl commented May 3, 2020

Could you open a new issue/pr for that? Comments on a closed PR generally don't result in any code change.

@blackknight36
Copy link
Contributor Author

@jorhett It should be a simple fix to handle systems running in permissive mode. Can you create a new issue regarding this? This PR has already been merged.

EmRowlands pushed a commit to EmRowlands/puppet-selinux that referenced this pull request Mar 29, 2023
Avoid puppet errors when SELinux is disabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Puppet errors on nodes with SELinux disabled
5 participants