OSQuery - Monitoring System Process
- 2. WHO AM I ?WHO AM I ?
Intern @ Practical DevSecOps
Undergrad @ Vit Chennai
Have interest over Mobile,Web,Cloud Security
Currently Looking for Internship
- 7. WHY OS QUERY ?WHY OS QUERY ?
Easy to use
Supports almost all platform
Easy to get information about different System
- 8. BASIC QUERIESBASIC QUERIES
Runs in User-context mode
.show - shows basic configuration
.help - shows help name
.table - shows list of table
.schema <table> - show the column
- 10. SELECT * FROM uptime;
SELECT * FROM os_version;
SELECT * FROM system_info;
- 11. JOINJOIN
Used to join the table
select count(*) from users;
select * from users limit 1;
select uid , username from users;
select uid , username from users where username like 's%';
select uid , username from users where username like '%s';
select pid, name from processes limit 5;
select p.pid , p.name, u.username from processes p join users
- 13. BASIC OS-QUERY CONFIGURATIONBASIC OS-QUERY CONFIGURATION
Should be stored in the
/etc/osquery/osquery.conf
{
"options": {
"config_plugin": "filesystem",
"logger_plugin": "filesystem",
"logger_path": "/var/log/osquery",
"disable_logging": "false",
"log_result_events": "true",
"schedule_splay_percent": "10",
"pidfile": "/var/osquery/osquery.pidfile",
"events_expiry": "3600",
"database_path": "/var/osquery/osquery.db",
"verbose": "false",
"worker_threads": "2",
"enable_monitor": "true",
"disable_events": "false",
- 15. PACKSPACKS
Packs are the way to group the query for Specific
Task
Default one can be found in
/usr/share/osquery/packs/
It has the following information
Intervals
Which platform to perform
Which action to use
- 16. BASIC USE CASE (FILE-BASIC USE CASE (FILE-
INTEGRATION MONITORING)INTEGRATION MONITORING)
sudo nano etcosqueryosquery.conf
{
"options": {
"config_plugin": "filesystem",
"logger_plugin": "filesystem",
"logger_path": "/var/log/osquery",
"disable_logging": "false",
"schedule_splay_percent": "10",
"pidfile": "/var/osquery/osquery.pidfile",
"events_expiry": "3600",
"database_path": "/var/osquery/osquery.db",
"verbose": "false",
"worker_threads": "2",
"disable_events": "false",
"disable_audit": "false",
"audit_allow_config": "true",
- 17. CREATING PACKCREATING PACK
sudo nano
/usr/share/osquery/packs/fim.conf
{
"queries": {
"file_events": {
"query": "SELECT * FROM file_events;",
"removed": false,
"interval": 300
}
},
"file_paths": {
"important": [
"/home/joshua/important/%%"
]
}