Hey everyone, I've been looking for a few hours, a...
# general
t
Hey everyone, I've been looking for a few hours, and I can't figure out how to use the
process_events
table - does anyone know where the documentation is?
Copy code
root@ubuntu:/etc/osquery# cat osquery.flags
--audit_allow_config=true
--audit_allow_sockets
--audit_persist=true
--audit_allow_process_events=true
--disable_audit=false
--events_expiry=1
--events_max=500000
--logger_min_status=1
--logger_plugin=filesystem
--watchdog_memory_limit=350
--watchdog_utilization_limit=130
Copy code
$ sudo osqueryi --flagfile /etc/osquery/osquery.flags
Using a virtual database. Need help, type '.help'
osquery> select * from process_events;
W0102 16:44:29.887578 30811 virtual_table.cpp:930] Table process_events is event-based but events are disabled
W0102 16:44:29.887630 30811 virtual_table.cpp:937] Please see the table documentation: <https://osquery.io/schema/#process_events>
I don't have auditd enabled, and osquery is running as root.
j
have you tried
--audit_allow_process_events=true
?
t
Yeah, that's in the configuration - I think that this configuration file is being read by osquery, but I'm not sure how to tell.
j
run
select * from osquery_flags;
to see
t
@João Godinho, @theopolis: do you know if there's an easy way to tell if osquery is configured to record process events?
Copy code
osquery> select name, value from osquery_flags where name LIKE '%audit%process%';
+---------------------------------+-------+
| name                            | value |
+---------------------------------+-------+
| audit_allow_fork_process_events | false |
| audit_allow_process_events      | true  |
+---------------------------------+-------+
osquery> select * from process_events;
W0102 16:54:41.409562 31005 virtual_table.cpp:930] Table process_events is event-based but events are disabled
W0102 16:54:41.409584 31005 virtual_table.cpp:937] Please see the table documentation: <https://osquery.io/schema/#process_events>
I've implemented this end-to-end in the past using netlink sockets, but not quite sure how to do it with osquery.
j
have you tried
select * from osquery_events;
trigger some event on another shell, and checking this table again? if the number of events changes?
t
Sure, I think the relevant flags are • disable_events, should be false • disable_audit, should be false • audit_allow_process_events, should be true
All the other
%audit%
and
%event%
flags tweak the type of events and performance option, they are relevant but those three above are the most important
t
TIL: there's a
disable_events
flag - I'll change that from
true
to
false
.
j
shouldn’t that flag be macos only?
t
no idea, first day trying to use it
s
that flag is macos and linux. (I forget if it’s windows)
t
@theopolis, @João Godinho: got it to work after setting
disable_events
to
false
- wasn't aware that the flag existed, thanks for your help everyone!
t
also check out
select * from osquery_events;
j
I misread the docs, although it’s not obvious you need it for linux, from this section: https://osquery.readthedocs.io/en/stable/deployment/process-auditing/#linux-process-auditing
t
there is an
active
column that tells you if the publisher (the internal thing that is sending events to tables) and subscribers (the tables themselves) are working
t
Looks good to me, thanks!
Copy code
osquery> select name, publisher, subscriptions, events, active from osquery_events where name like '%process_%events%';
+---------------------+---------------------+---------------+--------+--------+
| name                | publisher           | subscriptions | events | active |
+---------------------+---------------------+---------------+--------+--------+
| process_events      | auditeventpublisher | 1             | 14     | 1      |
| process_file_events | auditeventpublisher | 0             | 0      | 0      |
+---------------------+---------------------+---------------+--------+--------+
🎉 2
active
is set to 1 for the
process_events
publisher. 👌
y
@seph that flag is also for windows, IIRC
at least, i’ve been setting it as if it works on windows 😅
s
Then windows needs it. I bet I’m confusing it with
disable_audit
t
Does anyone know if there's an osquery flag that toggles support for Thrift on/off? I was working on some Python code that retrieves process events via the Thrift API, but I'm not sure why the transport is failing after adding support for events. 🤷
Super new to osquery event tables, these are pretty nooby questions.
s
I’d recommend asking new questiosn in new slack threads
t
Yeah, thought so, thanks.