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

Support os umask #152

Merged
merged 33 commits into from
Sep 7, 2018
Merged

Support os umask #152

merged 33 commits into from
Sep 7, 2018

Conversation

hdep
Copy link
Contributor

@hdep hdep commented Aug 22, 2018

As discussed in #147 here is a PR which do the following :

  • create system_umask variable,
  • if unset then ensure that /etc/profile.d/umask.sh is removed
  • if set to a value like 027 deploy /etc/profile.d/umask.sh and set the value

I test it on Debian 9 and works as expected so far.

Let me know if I need to change something.

Copy link
Contributor

@timstoop timstoop left a comment

Choose a reason for hiding this comment

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

It's good practise to base a PR on the current master, so you do not get changes in there that have not yet been merged or should be part of another PR.

@@ -214,5 +216,8 @@
password_hash => $grub_password_hash,
boot_without_password => $boot_without_password,
}
class { 'os_hardening::umask':
Copy link
Contributor

Choose a reason for hiding this comment

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

I kind of feel like this should not be a separate module but part of login_defs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

login_defs class is clearly made for managing /etc/login.defs, I don't see why it should manage umask, unless I set umask value in login.defs file which is not the case

README.md Outdated
@@ -12,6 +12,7 @@ This Puppet module provides secure configuration of your base OS with hardening.

* Puppet OpenSource or Enterprise
* [Module stdlib](https://forge.puppet.com/puppetlabs/stdlib)
* [Module sysctl](https://forge.puppet.com/thias/sysctl)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be part of this PR.

Copy link
Member

Choose a reason for hiding this comment

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

yes, please rebase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes of course, sorry i'm new with git stuff, will try to fix this out.

@@ -1,2 +1,3 @@
# MANAGED BY PUPPET
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also not be part of this PR.

@@ -1,2 +1,3 @@
# MANAGED BY PUPPET
Copy link
Contributor

Choose a reason for hiding this comment

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

Nor should this be part of this PR.

@hdep
Copy link
Contributor Author

hdep commented Aug 24, 2018

Is the rebase correct at this stage ?


}


Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove a few of these empty lines.

Copy link
Member

@mcgege mcgege left a comment

Choose a reason for hiding this comment

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

Please run a pdk validate on your code, there are some code style errors ...

LICENSE Outdated Show resolved Hide resolved
@@ -0,0 +1,2 @@
# MANAGED BY PUPPET
umask <%= @system_umask %>
Copy link
Member

Choose a reason for hiding this comment

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

Missing newline?

class os_hardening::umask (
$system_umask = undef,

){
Copy link
Member

Choose a reason for hiding this comment

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

Please add a whitespace between these brackets

@mcgege mcgege added this to the 2.2.0 milestone Aug 27, 2018
@mcgege mcgege self-assigned this Aug 27, 2018
@mcgege
Copy link
Member

mcgege commented Aug 27, 2018

Will look into this again when I'm back from my holiday (2 weeks) ...

@mcgege
Copy link
Member

mcgege commented Sep 7, 2018

@hdep I have now tested this PR against my distributions (CentOS 7.5, OpenSUSE 15.0, Ubuntu 16.04.5), and on all systems I get this error message on login (and the umask is not changed):

: octal number out of range

I have set the parameter like this: system_umask => '027' (also tried it with '0027'), and the file /etc/profile.d/umask.sh is created correctly.

I'm at loss here ... can you test this also on another distribution?

@hdep
Copy link
Contributor Author

hdep commented Sep 7, 2018

I had an issue with my text editor which switch end of line from LF to CR/LF.
Last commit should correct this.

@mcgege
Copy link
Member

mcgege commented Sep 7, 2018

Ha, right, I didn't see this ... and now it works on all distros!
Just two more things:

  1. Also correct the eof in the two other files
  2. Please add the parameter to the README.md

@hdep
Copy link
Contributor Author

hdep commented Sep 7, 2018

The EOL for umask.p and init.pp is set to LF on my side there is nothing to change.

@mcgege mcgege merged commit 29a9280 into dev-sec:master Sep 7, 2018
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.

3 participants