-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Update linux block_device and disk_encryption source data to simple sysfs implementation #8182
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
Update linux block_device and disk_encryption source data to simple sysfs implementation #8182
Conversation
Would this implementation also allow |
I could definitely look at making that possible. |
e542a40
to
5eee8db
Compare
@Smjert I think you said you could review this PR this week? |
Yes I began looking into it today but other things got my priority; I'll be able to finish my review by eod tomorrow. |
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.
While I don't think there are major issues, I'm a bit concerned on the support for the various combinations of distros and disk setups.
Would it be possible to know on which distros and which setups has this been tested on?
5eee8db
to
c186ab1
Compare
Very sorry I have taken a long time to get back to this. I've tested these changes on Ubuntu 22.04, CentOS 7, and openSUSE 15.4. For disk setups I've been mostly testing with the below on my openSUSE device:
|
c186ab1
to
82d8516
Compare
82d8516
to
642c1ec
Compare
Hey there, Arch Linux has been building osquery with the I'm working on building an osquery package with this patch and deploying it across my own base of ~15 bare-metal Arch systems. and will report back once I have some useful data. |
Update with my results - this PR merged cleanly to the latest @Smjert - would you mind taking a fresh look at this? In my experience sysfs is pretty stable. If distro compatibility is a priority, I think leaving this PR unmerged is actually doing more harm than good. If it's not already on your radar, @carlsmedstad maintains a patch set to build osquery on Arch, which can be viewed here. I haven't checked each of these patches individually to determine which ones are necessary for building on modern Ubuntu, but at a quick glance it looks like a lot of them are general library compatibility updates. Obviously you'll want to omit the patches that disable libdpkg. :) Separately from Carl's tree there's also a trivial patch to fix building on gcc 15. The sysfs tree on my system appears as follows. The
The serial number can be read from |
@Micah-Kolide do you have bandwidth to fix serial number and vendor fields using the info above? If not, I'm happy to rebase your branch, start a new PR and see that through. |
Hey @fuhry, thank you for taking a look at this PR and testing it as well! I can definitely look at making a commit to fix the serial and vendor fields. |
…nd block devices tables
… device data, and update parent device accesses
642c1ec
to
33cdc09
Compare
Fixes #8033
Purpose of this PR is to remove Linux's
disk_encryption
reliance onblock_devices
. We want a list of all block devices by name and a way to access their parent device, so I walk sysfs for that.libudev accesses block devices primarily in the same way, but with a lot of other options. Those options aren't utilized in osquery's current implementation. Since we don't use them I figured I could take out libudevs usage in our Linux
block_device
anddisk_encryption
table generations.I've added
block_device_enumeration
as a fairly simple traversal of sysfs to access all of the relevant data we previously were collecting. This should also be easy to add to if other data is desired down the road.