-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Move umask
from code to service files
#29708
Move umask
from code to service files
#29708
Conversation
This pull request does not have a backport label. Could you fix it @rdner? 🙏
NOTE: |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
/test |
This pull request is now in conflicts. Could you fix it? 🙏
|
…ider umask (elastic#20584) (elastic#28347)" This reverts commit ecd68db.
Before this the `umask` value was hard-coded in `libbeat`. It caused some confusion among the users since file permission configuration was practically ignored by a beat on the level of the binary. It's been decided that we move `umask` to the service files, so the distribution is secured by default but it still allows the users to set the value if they choose to.
umask is not hard-coded anymore and the test assumes that.
1fb7853
to
0cfe073
Compare
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
The failing e2e test does not seem to be related to the change:
So, I think it's safe to merge the PR. |
Detailed testing steps:
filebeat.inputs:
- type: log
paths:
- "/home/user/input/input.log"
output.file:
path: "/home/user/output_folder/"
filename: "output_file.log"
permissions: 0666
echo "some message" >> /home/user/input/input.log
|
Hi @jlind23 This ticket has been validated and found working fine. Below are the detailed observation and steps followed: Before setting umask 027
Observation: output.log file is generated with 664 permissions. After setting umask 027
Observation: output.log file is generated with 640 permissions. Screenshot: @rdner Thanks for helping us out in validating same. Thanks |
Enhancement
What does this PR do?
Before this the
umask
value was hard-coded inlibbeat
. It causedsome confusion among the users since file permission configuration was
practically ignored by a beat on the level of the binary. It's been
decided that we move
umask
to the service files, so the distributionis secured by default but it still allows the users to set the value
if they choose to.
Why is it important?
The issue started as a security concern here #14005
Then was addressed by adding a hard-coded umask for all files created by
libbeat
#14119Later documented here #28347
We've got some feedback from our customers about confusion and lack of documentation. Examples can be found here #20584 (comment)
Checklist
- [ ] I have commented my code, particularly in hard-to-understand areas- [ ] I have made corresponding change to the default configuration files- [ ] I have added tests that prove my fix is effective or that my feature worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
umask 0027
commandI made sure that all current permission defaults in beats are secure (set to
0600
):libbeat
Output files
beats/libbeat/outputs/fileout/config.go
Line 41 in cbdba8a
beats/libbeat/_meta/config/output-file.reference.yml.tmpl
Line 33 in cbdba8a
Log files
beats/libbeat/logp/config.go
Line 78 in cbdba8a
beats/libbeat/_meta/config/logging.reference.yml.tmpl
Line 58 in cbdba8a
filebeat
beats/filebeat/config/config.go
Line 65 in cbdba8a
beats/filebeat/_meta/config/filebeat.global.reference.yml.tmpl
Line 10 in cbdba8a
How to test this PR locally
I configured filebeat to have a file output with 666 permissions.
For that one can use the following config section in the filebeat config file:
Before this change this would results in a file with
640
permissions, after this change it's644
which lets users to make files available to the world as they request.After setting
umask 027
prior to running the filebeat binary the output file is created with640
as expected.Related issues