catalog

. Getting Started
. install guide for OS X and Linux
. Features Overview
. Logging
. query example

1. Getting Started

osquery is an operating system instrumentation framework for OS X and Linux. The tools make low-level operating system analytics and monitoring both performant and intuitive.
osquery exposes an operating system as a high-performance relational database. This allows you to write SQL-based queries to explore operating system data. With osquery, SQL tables represent abstract concepts such as

. running processes
. loaded kernel modules
. open network connections
. browser plugins
. hardware events or file hashes

Relevant Link:

http://osquery.readthedocs.org/en/stable/
http://www.oschina.net/p/osquery
http://www.infoq.com/cn/news/2014/10/osquery-facebook-sql

2. install guide for OS X and Linux

0x1: Ubuntu Trusty 14.04 LTS

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C9D8B80B
sudo add-apt-repository "deb [arch=amd64] https://osquery-packages.s3.amazonaws.com/trusty trusty main"
sudo apt-get update
sudo apt-get install osquery

0x2: CentOS/RHEL 6.6

sudo rpm -ivh https://osquery-packages.s3.amazonaws.com/centos6/noarch/osquery-s3-centos6-repo-1-0.0.noarch.rpm
sudo yum install osquery

0x3: Optional: Kernel driver

osquery does not require a kernel driver currently. There are medium priority plans to extend table data collection into the kernel as well as use kernel frameworks to protect the daemon and log data.

Relevant Link:

http://osquery.readthedocs.org/en/stable/installation/install-linux/

3. Features Overview

. osqueryd
The high-performance and low-footprint distributed host monitoring daemon, osqueryd, allows you to schedule queries to be executed across your entire infrastructure. The daemon takes care of aggregating the query results over time and generates logs which indicate state changes in your infrastructure. You can use this to maintain insight into the security, performance, configuration, and state of your entire infrastructure. osqueryd's logging can integrate into your internal log aggregation pipeline, regardless of your technology stack, via a robust plugin architecture. . osqueryi
The interactive query console, gives you a SQL interface to try out new queries and explore your operating system. With the power of a complete SQL language and dozens of useful tables built-in, osqueryi is an invaluable tool when performing incident response, diagnosing an systems operations problem, troubleshooting a performance issue, etc. . osquery
osquery is cross platform. Even though osquery takes advantage of very low-level operating system APIs, you can build and use osquery on Mac OS X, Ubuntu, Cent OS and other popular enterprise Linux distributions . plugin architecture
To assist with the rollout process, the osquery user guide has detailed documentation on internal deployment. osquery was built so that every environment specific aspect of the toolchain can be hot-swapped at run-time with custom plugins. Use these interfaces to deeply integrate osquery into your infrastructure if one of the several existing plugins don not suit your needs

总体来说,osquery的特点如下

. 是采用了定时采样的方式收集主机上相关信息,适合在大量的分布式集群上部署agent,在一个中心server上部署analysis进行数据集中分析
. osquery使用了用户态的系统API获取系统上相关信息,包括
) running processes(运行中进程)
) loaded kernel modules
) open network connections(网络外连)
) browser plugins
) hardware events or file hashes
. 对于入侵检测有帮助的字段有"running processes"、"open network connections",但是osquery的采样方式觉得它获取的不是实时的准确数据,因为恶意的"running processes"和"open network connections"都有可能是瞬间发生的
. osquery有一个beta版的内核态采样模块,但是处于unstable状态,工作较不稳定,而且工作方式依然是定时采样,而不是实时的hook

Relevant Link:

https://osquery.readthedocs.org/en/stable/introduction/overview/

4. Logging

The osquery daemon uses a default filesystem logging plugin. Like the config, output from the filesystem plugin is written as JSON. Results from the query schedule are written to /var/log/osquery/osqueryd.results.log.
There are two types of logs:

. Status logs (info, warning, error, and fatal)
. Query schedule results logs

osquery的技术思路就是在本地进行定时的采样(周期性地调度本地的默认SQL语句),获取机器信息,将全部事件信息存储在本地,并将log数据进行封装,对外封装了一个SQL Query查询接口,接收来自中心sever的查询请求
osquery的特点就是不需要通过网络从agent收集log,而通过本地存储日志,而中心server下发轻量级的sql获取所需要的信息,从而减小了网络传输的消耗和中心server分析和处理庞大log的消耗

Relevant Link:

https://osquery.readthedocs.org/en/stable/deployment/logging/

5. query example

. List the the users:
SELECT * FROM users; . Check the processes that have a deleted executable:
SELECT * FROM processes WHERE on_disk = ; . Get the process name, port, and PID, which are listening on all interfaces:
SELECT DISTINCT process.name, listening.port, process.pid
FROM processes AS process
JOIN listening_ports AS listening ON process.pid = listening.pid
WHERE listening.address = '0.0.0.0'; . Find every OS X LaunchDaemon that launches an executable and keeps it running:
SELECT name, program || program_arguments AS executable
FROM launchd
WHERE
(run_at_load = 'true' AND keep_alive = 'true')
AND
(program != '' OR program_arguments != ''); . Check for ARP anomalies from the host's perspective:
SELECT address, mac, count(mac) AS mac_count
FROM arp_cache GROUP BY mac
HAVING count(mac) > ; . Alternatively, you could also use a SQL sub-query to accomplish the same result:
SELECT address, mac, mac_count
FROM
(SELECT address, mac, count(mac) AS mac_count FROM arp_cache GROUP BY mac)
WHERE mac_count > ;

Relevant Link:

https://github.com/facebook/osquery

 

Copyright (c) 2015 LittleHann All rights reserved

osquery An Operating System Instrumentation Framewor的更多相关文章

  1. DBCC CHECKDB 遭遇Operating system error 112(failed to retrieve text for this error. Reason: 15105) encountered

    我们一个SQL Server服务器在执行YourSQLDBa的作业YourSQLDba_FullBackups_And_Maintenance时遇到了错误: Exec YourSQLDba.Maint ...

  2. The World's Only Advanced Operating System

    The World's Only Advanced Operating System

  3. Unable to open the physical file xxxx. Operating system error 2

    在新UAT服务器上,需要将tempdb放置在SSD(固态硬盘)上.由于SSD(固态硬盘)特性,所以tempdb的文件只能放置在D盘下面,而不能是D盘下的某一个目录下面. ALTER  DATABASE ...

  4. CREATE FILE encountered operating system error 5(Access is denied.)

    这篇博文主要演示"CREATE FILE encountered operating system error 5(Access is denied.)"错误如出现的原因(当然只是 ...

  5. Linux启动报错missing operating system

    用UltraISO制作了一个Red Hat Enterprise Linux Server release 5.7系统的U盘启动盘,然后在一台PC上安装,由于安装过程中在干别的事情,有些选项没有细看. ...

  6. Learning Roadmap of Robotic Operating System (ROS)

    ROS Wiki: http://wiki.ros.org/ Robots Using ROS Textbooks: A Gentle Introduction to ROS Learning ROS ...

  7. Full exploitation of a cluster hardware configuration requires some enhancements to a single-system operating system.

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION Operating System Desi ...

  8. Multiprocessor Operating System Design Considerations SYMMETRIC MULTIPROCESSORS

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION An SMP operating syst ...

  9. u盘安装CENTOS后,启动missing operating system ,只能用U盘才能启动系统

    好久之前就想把家里闲置的那台老的不能再老的笔记本换成linux的,用来学习 从N久之前用光盘安装的时候发现光驱坏掉了之后就没有再装过,最近又想安装于是就试了U盘安装 U盘安装过程也很简单,只需要制作一 ...

随机推荐

  1. codevs1501 二叉树最大宽度和高度

    难度等级:白银    1501 二叉树最大宽度和高度 题目描述 Description 给出一个二叉树,输出它的最大宽度和高度. 输入描述 Input Description 第一行一个整数n. 下面 ...

  2. oracle: job使用

    oracle的job,实际上就是数据库内置的定时任务,类似代码中的Timer功能.下面是使用过程: 这里我们模拟一个场景:定时调用存储过程P_TEST_JOB 向表TEST_JOB_LOG中插入数据 ...

  3. SELECT (Transact-SQL)

    从数据库中检索行,并允许从 SQL Server 中的一个或多个表中选择一个或多个行或列.  虽然 SELECT 语句的完整语法较复杂,但其主要子句可归纳如下: [ WITH <common_t ...

  4. 理解Java中的弱引用(Weak Reference)

    本篇文章尝试从What.Why.How这三个角度来探索Java中的弱引用,理解Java中弱引用的定义.基本使用场景和使用方法.由于个人水平有限,叙述中难免存在不准确或是不清晰的地方,希望大家可以指出, ...

  5. Google搜索的几个使用技巧——让你的搜索结果更准确

    对于软件开发人员来说,不知道的内容在网上搜索是再正常不过的了.今天同事在组内分享了几个谷歌搜索的使用技巧,在此自己总结一下,希望可以帮到更多人. 在此之前先要唠叨几句,什么时候用百度,什么时候用谷歌? ...

  6. 又发现个.net framework的坑

    请找出这两个方法的区别: http://msdn.microsoft.com/en-us/library/ms584187(v=vs.110).aspx

  7. P值,“差异具有显著性”和“具有显著差异”

      P值是论文中最常用的一个统计学指标,可是其误用.解释错误的现象却很常见.因此,很有必要说明p值的意义.用法及常见错误.   P值指的是比较的两者的差别是由机遇所致的可能性大小.P值越小,越有理由认 ...

  8. android 颜色对照

    <table><tbody> <tr> <td bgcolor="#ffffff" width="30" height ...

  9. div两栏等高布局

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  10. Android M 控件:Snackbar、Toolbar、TabLayout、NavigationView

    Snackbar Snackbar提供了一个介于Toast和AlertDialog之间轻量级控件,它可以很方便的提供消息的提示和动作反馈.Snackbar的使用与Toast的使用基本相同: Snack ...