-
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
Add RPM packaging #9092
Add RPM packaging #9092
Conversation
Pinging @elastic/secops |
} | ||
var cFun cFunctions | ||
|
||
librpm, err := dlopen.GetHandle(librpmNames) |
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.
This handle is never Closed().
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.
Yes, it's not, but I cannot just add a defer
because I cannot call the functions from it, it panics. It's currently a singleton so it exists only once per process. Putting it in the Metricset structure would be possible, but requires a bigger refactoring of the whole module. Let me know if you think it's worth doing it anyway.
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.
That should be find then. I guess I missed the if cFun == nil
check surrounding its usage.
+ test that the exec and the programmatic method give the same results.
Tested the resulting RPM on Centos.
18606ec
to
4579eb4
Compare
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.
It should be good to merge after adding that platform filter to the magefile.go.
} | ||
var cFun cFunctions | ||
|
||
librpm, err := dlopen.GetHandle(librpmNames) |
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.
That should be find then. I guess I missed the if cFun == nil
check surrounding its usage.
"linux/ppc64le": installLinuxPPC64LE, | ||
"linux/s390x": installLinuxS390X, | ||
|
||
//"linux/ppc64": installLinuxPpc64, |
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.
A few lines up in init()
add a filter to prevent mage package
from attempting to build these targets.
mage.Platforms = mage.Platforms.Filter("!linux/ppc64 !linux/mips64")
This is similar to what journalbeat has but with the linux
selector.
Lines 35 to 38 in 1411852
func init() { | |
mage.BeatDescription = "Journalbeat ships systemd journal entries to Elasticsearch or Logstash." | |
mage.Platforms = mage.Platforms.Filter("linux !linux/ppc64 !linux/mips64") |
Superseded by #10429 |
This adds support for programmatically reading the list of RPM packages. The previous version was using exec (called the rpm binary), but we'd like to keep Auditbeat exec free, because execs are currently blocked by seccomp, as a security feature.
Using the model from Journalbeat, the new code uses
dlopen
get the relevant C functions and calls them using CGo. This means thatlibrpm
is not a hard dependency, but only for when this functionality is needed.Ready for reviews, but there's a couple of things left to do:
mage package
(we need librpm-devel).rpm
commmand, but that test is skipped on on non-Redhat systems. Currently, we run all tests in a Debian based docker image.Part of #8725.