设为首页 加入收藏

TOP

针对Linux 文件完整性监控的实现(三)
2019-09-02 23:05:36 】 浏览:133
Tags:针对 Linux 文件 完整性 监控 实现
ery. conf

  "schedule": {

    "crontab": {

      "query": "SELECT * FROM crontab;",

      "interval": 300

    },

    "system_profile": {

      "query": "SELECT * FROM osquery_schedule;"

    },

    "system_info": {

      "query": "SELECT hostname, cpu_brand, physical_memory FROM system_info;",

      "interval": 3600

    }

  },

 

图2-10 任意数量查询

4. 查询之后,可以添加称为装饰器如图decorators的特殊查询,这些查询是将数据添加到其他计划查询的查询。此处显示的装饰器查询将将运行osquery的主机的UUID和用户的用户名添加到每个计划的查询中。

将这些行附加到文件:如图2-11所示。

/etc/osquery/osquery. conf

  "decorators": {

    "load": [

      "SELECT uuid AS host_uuid FROM system_info;",

      "SELECT user AS username FROM logged_in_users ORDER BY time DESC LIMIT 1;"

    ]

  },

 

图2-11 添加查询计划

5. osquery指向包含更多特定查询的包列表。每次安装osquery都会在/usr/share/osquery/packs中的提供一组默认包。其中一个包用于macOS,其余用于Linux系统。虽然可以使用默认位置的包,但也可以将它复制到/etc/osquery目录中。

将这些行添加到文件中以完成该文件。如图2-12所示。

/etc/osquery/osquery. conf

  "packs": {

     "osquery-monitoring": "/usr/share/osquery/packs/osquery-monitoring. conf",

     "incident-response": "/usr/share/osquery/packs/incident-response. conf",

     "it-compliance": "/usr/share/osquery/packs/it-compliance. conf",

     "vuln-management": "/usr/share/osquery/packs/vuln-management. conf"

  }

}

 

图2-12 特定查询

保存并关闭该文件,然后使用以下命令对其进行验证:sudo osqueryctl config-check

2.2.2  osquery文件完整性监

       密切关注服务器上文件的完整性是监控其系统安全性的关键方面。为此,osquery提供了一个现成的解决方案。将向列表中添加一个包,其中包含将用于文件完整性监视的查询和指令,将调用该文件fim. conf。

创建此文件并在编辑器中打开它:sudo vim /usr/share/osquery/packs/fim. conf

1. 创建一个软件包,每隔300秒监视/home,/etc以及/tmp目录中的文件事件。软件包文件的完整设置显示在以下文件列表中。将其复制到文件中。如图2-13所示。

/usr/share/osquery/packs/fim. conf

{

  "queries": {

    "file_events": {

      "query": "select * from file_events;",

      "removed": false,

      "interval": 300

    }

  },

  "file_paths": {

    "homes": [

      "/root/. ssh/%%",

      "/home/%/. ssh/%%"

    ],

      "etc": [

      "/etc/%%"

    ],

      "home": [

      "/home/%%"

    ],

      "tmp": [

   &nbs

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 3/8/8
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇linux添加软件的service start/st.. 下一篇Kali无法使用Chrome原因及解决方法

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目