300 points · by signa11 · 2y ago · 99 comments
(Source: I worked on osquery's core and tables for 2-3 years for various clients, and my company employs several of the current maintainers.)
sockets() {
(osqueryi --list --separator ',' | column -t -s ',') <<EOF
SELECT s.local_port, p.cmdline
FROM process_open_sockets AS s
INNER JOIN processes AS p
ON s.pid = p.pid
WHERE s.state = 'LISTEN'
ORDER BY p.cmdline;
EOF
}(In terms of general purpose/flexible tooling, I'm not aware of a close replacement for osquery.)
shouldn't lsof with some awk munging get you there ?
edit-01:
for example
lsof -iTCP -sTCP:LISTEN -n -P | awk '{print $1, substr($0, index($0,$9))}'
might be useful enough ? fwiw, it does give me something useful on my machine alias ports="lsof -iTCP -sTCP:LISTEN -n -P | awk '{print \$1, substr(\$0, index(\$0,\$9))}'"[1] Steampipe (https://steampipe.io/)
[2] InfraSQL (https://iasql.com/)
iasql seems to be AWS only, but good for them for taking this on: https://github.com/alantech/iasql/blob/v0.1.9/src/services/c... My heart goes out to anyone having to touch AWS IAM canonicalization
What's an issue preventing you from deploying osquery in your org?
First-person testimony.
Systems administration is the art of protecting everyone with less access from footguns while still and especially enabling their use of effective tools.
First-person testimony.
Next step is "clairvoyance", where we predict perf based on the SQL when you're in the query editor
It really really messes with windows defender too.
> allows your junior sysadmins to take down all your machines at once or cause mystery performance blips that someone else has to diagnose for a year
Sounds like you have extremely poor administrative management of your computer systems.
Case in point, a simple "select * from processes" takes a solid 3 seconds of kernel time on my laptop.
Now you might say, "well that's clearly a dumb idea because osquery certainly relies on vtab's colUsed field to avoid querying all sorts of expensive stuff when it doesn't have to so you really should only query what you need" and that's of course 100% true. But it's also a senior developer thought. Easy to see how an inexperienced person might make mistakes like this with any one of the dozens or hundreds of tables offered by osquery and cause performance issues.
In terms of security, well it is clearly a kitchen sink project (there's a prometheus client in there, for example: https://osquery.io/schema/5.11.0/#prometheus_metrics), so there's a huge breadth of interfaces it talks to and files controlled by all sorts of people it parses, and the default does seem to be privileged usage, which is the general ballpark where AV engines and their highly dubious track record live.
The formula osquery uses to report performance: https://github.com/fleetdm/fleet/issues/16123
The raison d'etre of this thing is to allow interactive ad hoc exploration of large-scale systems. It is, in other words, a thoroughly bad idea.
Seems pretty straightforward as a start.
In my head I feel like I say "ess-cue-lite" pretty much every time.
And when you apply FUSE (or FUSE-T or NFS or WebDAV) to its archive format "sqlar", getting a file system called "sqlarfs", then pronounce it as "sclarfs", rhyming with snarfs/scarfs/barfs.
Reading up on the history parts in the Wikipedia article, the German language version presents it as if SQL was the Oracle (Relational Software Inc) implementation of IBM's Sequel, the English page says the name was shortened due to trademark issues, before mentioning any implementation outside IBM. That would make Sequel and SQL the same thing, just rebranded early on. It also lists a clever (b)acronym and two other reasons for why they called it sequel before shortening, so it seems like there's a decent amount of mystery around the name. Almost as if it happened before the invention of writing.
(I don't know whether they still use it in-house.)
[1]: https://blog.trailofbits.com/2019/04/18/announcing-the-commu...
There’s also a podcast episode on it with two of the creators: "The story behind the creation of osquery" https://fleetdm.com/podcasts/the-future-of-device-management...
> 5 years ago
> Today we are excited to announce the creation of the osquery foundation. Please read the Linux Foundation's official announcement. We have created an osquery/foundation repository on GitHub to host the technical charter.
> The official repository has been renamed from facebook/osquery to osquery/osquery.
I'd like to build a Go binary with mattn/go-sqlite3 with osquery vtables included.
or you can use it in a server/client setting through some other project, but probably not you wanted
https://www.linkedin.com/in/ramosjohnny/ https://www.linkedin.com/in/marpaia/
Do another album and add a stop in Tampa.
Airwatch the Endpoint management system was working to incorporate this. It was pretty good. Unfortunately they were acquired by VMware which tried to maneuver the product into pretty unrelated VDI tech (Horizon). And of course VMware is completely in the shitcan now with everything being discontinued. We moved to Intune in the end. Which was not better by the way (nobody buys Microsoft because they're great, just because of the network effect). But it does have better long term outlook (no pun intended).
But it was a good product while it lasted. The osquery integration was really useful for custom scripts. AirWatch had linux support 4 years ago even though Intune is only starting with that (and it hardly works).
Airwatch/Workspace One was a terrible product even before the acquisitions. You may want to try FleetDM, an MDM product that deeply integrates osquery (an intersecting set of people are responsible for the two).
It really made me laugh when Gartner put Intune in their magical Quadrant but not airwatch as Intune wasn't even feature complete at that point for basic mobile uses. I'm sure those Gartner guys just talk to the sales suits but don't actually try the products.
But now we're stuck with Intune due to decisions made at top level.
Is there even an established, reliable alternative to intune for Windows? I don’t know.
(it's got an extra layer of metadata with examples. Supports markdown in the yaml for most fields. Contributions welcome!!)