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

Allow change of file mode for generated files #70

Closed
hoggle64 opened this issue Aug 28, 2017 · 7 comments
Closed

Allow change of file mode for generated files #70

hoggle64 opened this issue Aug 28, 2017 · 7 comments
Labels
enhancement New feature or request

Comments

@hoggle64
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.10.4
  • Ruby: 1.8.7
  • Distribution: Redhat 6.9
  • Module version: 2.0.0

We need to fix security issues reported by OpenScap. One of those issues points out that the permissions of files which were installed by a RPM should always stay the same.
This module changes the permissions of:

  • /etc/cron.daily/logrotate
  • /etc/logrotate.conf
    though.

What are you seeing

Permission are getting changed during the Puppet run:

Notice: /Stage[main]/Logrotate::Config/Logrotate::Cron[daily]/File[/etc/cron.daily/logrotate]/mode: mode changed '0700' to '0555'
Notice: /Stage[main]/Logrotate::Defaults/Logrotate::Conf[/etc/logrotate.conf]/File[/etc/logrotate.conf]/mode: mode changed '0644' to '0444'

What behaviour did you expect instead

No mode change of files which were delivered by a RPM package.

@juniorsysadmin juniorsysadmin added the enhancement New feature or request label Sep 29, 2017
@juniorsysadmin juniorsysadmin changed the title permissions of original RPM files Allow change of file mode for generated files Sep 29, 2017
@juniorsysadmin
Copy link
Member

Fix would require adding file mode parameters to cron defined type, and also a parameter somewhere else to change mode for /etc/logrotate.conf

@hoggle64
Copy link
Author

hoggle64 commented Sep 29, 2017

Sorry - I disagree.

The mode for /etc/logrotate.conf ist explicitly set inside conf.pp:
file { $name: ensure => $ensure, owner => $logrotate::root_user, group => $logrotate::root_group, mode => '0444', content => template('logrotate/etc/logrotate.conf.erb'), require => Package['logrotate'], }
Setting the file mode at this point makes no sense.

...Fix would require adding file mode parameters to cron defined type...

If I switch it of with
logrotate::manage_cron_daily: false
this problem is gone.

@juniorsysadmin
Copy link
Member

@hoggle64 Miscommunication on my part here. My comment was outlining potential code in a new Pull Request that would be needed to fix your problem.

@hoggle64
Copy link
Author

hoggle64 commented Oct 9, 2017

o.k. - thanks for the update

@juniorsysadmin juniorsysadmin self-assigned this Dec 6, 2017
@TJM
Copy link

TJM commented Mar 30, 2018

+1 - We are also being dinged for OpenSCAP (security scan)

It would be nice, if these parameters were added, if they matched the RPM permissions by default :)

# rpm -V logrotate
SM5....T.  c /etc/cron.daily/logrotate
SM5....T.  c /etc/logrotate.conf
# ls -l /etc/logrotate.conf /etc/cron.daily/logrotate
-r-xr-xr-x. 1 root root 313 Mar 16 16:01 /etc/cron.daily/logrotate
-r--r--r--. 1 root root 175 Mar 16 16:01 /etc/logrotate.conf
# rpm -qlv logrotate | head -2
-rwx------    1 root    root                      219 Jan 24  2017 /etc/cron.daily/logrotate
-rw-r--r--    1 root    root                      662 Jul 31  2013 /etc/logrotate.conf

@bastelfreak
Copy link
Member

@TJM could you provide a fix for that?

@juniorsysadmin juniorsysadmin removed their assignment Mar 31, 2018
@TJM
Copy link

TJM commented Apr 2, 2018

@bastelfreak would it be wrong to convert to module hiera data to add this feature? :-/

TJM added a commit to TJM/puppet-logrotate that referenced this issue Apr 3, 2018
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

No branches or pull requests

4 participants