-
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
[Heartbeat] Drop only inheritable cap set and defer setuid to node fork #33584
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
//go:build linux || darwin | ||
// +build linux darwin | ||
//go:build linux | ||
// +build linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pdeathsig
is Linux only, removing darwin
from build tags to reflect that
Pinging @elastic/uptime (Team:Uptime) |
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
/test |
/test |
Tested the following scenarios:
io:job could not be initialized: script monitors cannot be run as root
root@30728e612bb0:/usr/share/heartbeat# cat /proc/{8,23}/status | grep -E 'Name|Cap|Uid|Groups|Umask'
Name: heartbeat
Uid: 1000 1000 1000 1000
Groups: 0 1000
CapInh: 0000000000000000
CapPrm: 0000000000002000
CapEff: 0000000000002000
CapBnd: 00000000a80425fb
CapAmb: 0000000000000000
Name: node
Uid: 1000 1000 1000 1000
Groups: 0 1000
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 00000000a80425fb
CapAmb: 0000000000000000
root@dc536c6b5a5b:/usr/share/elastic-agent# cat /proc/{44,120}/status | grep -E 'Name|Cap|Uid|Groups|Umask'
Name: heartbeat
Umask: 0007
Uid: 0 0 0 0
Groups: 0
CapInh: 0000000000000000
CapPrm: 00000000a80425fb
CapEff: 00000000a80425fb
CapBnd: 00000000a80425fb
CapAmb: 0000000000000000
Name: node
Umask: 0007
Uid: 1000 1000 1000 1000
Groups: 0
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 00000000a80425fb
CapAmb: 0000000000000000
root@ad2b16ed53b1:/usr/share/elastic-agent# cat /proc/{44,121}/status | grep -E 'Name|Cap|Uid|Groups|Umask'
Name: heartbeat
Umask: 0007
Uid: 1000 1000 1000 1000
Groups: 0 1000
CapInh: 0000000000000000
CapPrm: 0000000000002080
CapEff: 0000000000002080
CapBnd: 00000000a80425fb
CapAmb: 0000000000000000
Name: node
Umask: 0007
Uid: 1000 1000 1000 1000
Groups: 0 1000
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 00000000a80425fb
CapAmb: 0000000000000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…rk (#33584) * [Heartbeat] Drop only inheritable cap set and defer setuid to node fork * Update heartbeat/security/security.go * Fix linter * Fix linter, add definition for darwin * Fix linter for darwin * Fix linter * Fix linter * Add changelog Co-authored-by: Andrew Cholakian <[email protected]>
What does this PR do?
Fixes #33292.
Only drop
inheritable
cap set and movesetuid/setgid
to node fork.Still need to validate with inline and zip urls.
Process tree:
Caps:
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Build
heartbeat
locally and mount it into anelastic-agent-complete
container.