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. android中常用的读取文件的用法如下

    1. 从resource的raw中读取文件数据: String res = ""; try{ //得到资源中的Raw数据流 InputStream in = getResource ...

  2. 数据库 SQL语法二

    聚合函数 -SUM([DISTINCT] FIELDNAME) 求指定列之和,[DISTINCT]选项表示剔除重复记录 例如:SELECT SUM(age) FROM TABLE1; SELECT S ...

  3. JSP中的Servlet及Filter

    asp.net中,如果开发人员想自己处理http请求响应,可以利用HttpHandler来满足这一要求:类似的,如果要拦截所有http请求,可以使用HttpMoudle.java的web开发中,也有类 ...

  4. MvvmLight ToolKit .Net4.5版本 CanExecute不能刷新界面bug

    一 问题重现    1.在使用最新版本v5.1的MvvmLight中(其实这个问题很早就有了),发现CanExecute不能很好地工作了.一个简单的工程,只有MainWindow和MainWindow ...

  5. Webwork 学习之路【04】Configuration 详解

    Webwork做为经典的Web MVC 框架,个人觉得源码中配置文件这部分代码的实现十分考究. 支持自定义自己的配置文件.自定义配置文件读取类.自定义国际化支持. 可以作为参考,单独引入到其他项目中, ...

  6. 又发现一个msdn的坑

    一个类型里面有两个属性仅仅是大小写区别,可是IIS不区分大小写,问:如何才能查看两个属性里面的文档那? http://msdn.microsoft.com/en-us/library/microsof ...

  7. [CF#286 Div2 D]Mr. Kitayuta's Technology(结论题)

    题目:http://codeforces.com/contest/505/problem/D 题目大意:就是给你一个n个点的图,然后你要在图中加入尽量少的有向边,满足所有要求(x,y),即从x可以走到 ...

  8. C语言之Sleep函数

    Sleep函数: 功 能: 执行挂起一段时间 用 法: unsigned sleep(unsigned seconds); 注意: 在VC中使用带上头文件#include <windows.h& ...

  9. 关于Hellas和Greece

    一直以来我就好奇,为什么希腊的中文名字“希腊”和英文名字”Greece”听起来都不像(就像“德国”不像“Germany”一样),而且,为什么在很多体育比赛中看到希腊运动员的衣服上都是“Hellas”, ...

  10. optiontransferselect例子

    Struts2 OptionTransferSelect标签 动态赋值: 1.html片面: <td class="td2"> <s:optiontransfer ...