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

make config files readonly to daemons #324

Merged
merged 1 commit into from
Sep 6, 2019

Conversation

anarcat
Copy link

@anarcat anarcat commented Jun 14, 2019

Pull Request (PR) description

It's bad practice to allow daemons to modify their own config
files. This pattern seems to be common across this module, and I
cannot think of a good reason why, as there is little chance (say) an
exporter should have to modify its own config file.

This reverts the policy by ensuring only minimal permissions are set
on config files and directories deployed by Puppet. Only two
directories are writable after this change:

  • /var/lib/prometheus
  • /usr/local/share/prometheus

And I'm not even sure about the latter.

This Pull Request (PR) fixes the following issues

No issue was filed, but this problem was identified while working on the Debian packaging PR (#303) because the permissions on the files deployed by the Debian package would be broken.

@@ -177,7 +177,7 @@

file { $config_dir:
ensure => 'directory',
owner => $user,
owner => 'root',
Copy link
Member

Choose a reason for hiding this comment

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

Wasn't there an issue on BSD and this needed to be 0 instead of root? I'm not 100% sure anymore.

Copy link
Author

Choose a reason for hiding this comment

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

no, that was only the group that is wheel instead of root, and where you use gid=0. this is the owner, and root definitely exists on bsd.

@bastelfreak bastelfreak added needs-feedback Further information is requested needs-rebase labels Jul 11, 2019
@bastelfreak
Copy link
Member

Hi @anarcat, can you please rebase?

@anarcat
Copy link
Author

anarcat commented Jul 11, 2019 via email

@bastelfreak
Copy link
Member

Ping @anarcat

It's bad practice to allow daemons to modify their own config
files. This pattern seems to be common across this module, and I
cannot think of a good reason why, as there is little chance (say) an
exporter should have to modify its own config file.

This reverts the policy by ensuring only minimal permissions are set
on config files and directories deployed by Puppet. Only two
directories are writable after this change:

 * /var/lib/prometheus
 * /usr/local/share/prometheus

And I'm not even sure about the latter.
@anarcat
Copy link
Author

anarcat commented Sep 6, 2019

@bastelfreak pong, rebased.

@bastelfreak bastelfreak added enhancement New feature or request and removed needs-feedback Further information is requested needs-rebase labels Sep 6, 2019
@bastelfreak bastelfreak merged commit a42ad6b into voxpupuli:master Sep 6, 2019
@anarcat anarcat deleted the fix-perms branch September 6, 2019 18:33
Rovanion pushed a commit to Rovanion/puppet-prometheus that referenced this pull request May 5, 2021
make config files readonly to daemons
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.

2 participants