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

add support for selinux login #356

Merged
merged 10 commits into from
Jul 23, 2022
Merged

add support for selinux login #356

merged 10 commits into from
Jul 23, 2022

Conversation

bshelton
Copy link
Contributor

Pull Request (PR) description

This is a PR to add basic support for selinux logins. This will allow mapping of linux users or groups to a selinux user.

This Pull Request (PR) fixes the following issues

Fixes #166

@@ -89,6 +91,9 @@
if $exec_restorecon {
create_resources ( 'selinux::exec_restorecon', $exec_restorecon )
}
if $login {
Copy link
Member

Choose a reason for hiding this comment

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

while this style is consistent with the rest of the class, it doesn't meet best practices. using create_resources is deprecated. Instead I sugges to default $login to an empty hash and iterate on it

$login.each |$login_name, $login_attributes {
  selinux::login { $login_name:
    * => $login_attributes,
  }
}

Copy link
Member

Choose a reason for hiding this comment

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

you can drop the if $login. $login.each will notice that $login is empty and not iterate on it.

# @param selinux_user The selinux user to map to
#
define selinux::login (
String $selinux_login_name,
Copy link
Member

Choose a reason for hiding this comment

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

can you make the datatypes more strict? At the moment they would allow empty strings:

Suggested change
String $selinux_login_name,
String[1] $selinux_login_name,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep.. sorry I'm lacking in experience with Ruby.

manifests/init.pp Outdated Show resolved Hide resolved
bshelton and others added 2 commits July 22, 2022 22:06
Co-authored-by: Tim Meusel <tim@bastelfreak.de>
@bastelfreak bastelfreak added the enhancement New feature or request label Jul 23, 2022
@bastelfreak
Copy link
Member

thanks for the work!

@bastelfreak bastelfreak merged commit ac96050 into voxpupuli:master Jul 23, 2022
EmRowlands pushed a commit to EmRowlands/puppet-selinux that referenced this pull request Mar 29, 2023
* add support for selinux login

* cleanup linting

* documented param for login

* remove empty line

* remove useless vars

* use to_s

* add in fixes for PR review

* add |

* Update manifests/init.pp

Co-authored-by: Tim Meusel <tim@bastelfreak.de>

* drop if statement

Co-authored-by: Brock Shelton <brock.shelton@oracle.com>
Co-authored-by: Tim Meusel <tim@bastelfreak.de>
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.

selinux::users && selinux::logins
2 participants