您如何跟踪服务器上的授权和未经授权的活动?
OSSEC 是一种可以安装在服务器上以跟踪其活动的工具。
OSSEC 是一种开源、基于主机的入侵检测系统 (HIDS),它执行日志分析、完整性检查、Windows 注册表监控、rootkit 检测、基于时间的警报和主动响应。它可以用于以服务器/代理模式监控一台服务器或数千台服务器。
如果配置正确,OSSEC 可以让您实时查看服务器上发生的情况。
本教程将向您展示如何安装和配置 OSSEC 来监控一台运行 Ubuntu 14.04 LTS 的 DigitalOcean 服务器。我们将配置 OSSEC,以便如果文件被修改、删除或添加到服务器,OSSEC 将通过电子邮件实时通知您。这是 OSSEC 提供的其他完整性检查功能的补充。
OSSEC 可以做的不仅仅是通知您文件修改,但是一篇文章不足以向您展示如何利用其所有功能。
**OSSEC 有哪些好处?
在开始安装和配置部分之前,我们先来看看使用 OSSEC 带来的一些具体好处。
Below is an example of an email notification from OSSEC, showing that the file /var/ossec/etc/ossec.conf was modified.
OSSEC HIDS Notification.
2014 Nov 29 09:45:15
Received From: kuruji->syscheck
Rule: 552 fired (level 7) -> "Integrity checksum changed again (3rd time)."
Portion of the log(s):
Integrity checksum changed for: '/var/ossec/etc/ossec.conf'
Size changed from '7521' to '7752'
如果您收到这样的警报,并且您没有预料到该文件会发生更改,那么您就知道您的服务器上发生了未经授权的事情。
Here’s another example email alert from OSSEC, showing that the file /etc/ossec/testossec.txt was deleted.
OSSEC HIDS Notification.
2014 Nov 29 10:56:14
Received From: kuruji->syscheck
Rule: 553 fired (level 7) -> "File deleted. Unable to retrieve checksum."
Portion of the log(s):
File /etc/ossec/testossec.txt was deleted. Unable to retrieve checksum.
同样,如果您没有删除有问题的文件,您应该弄清楚您的服务器上发生了什么。
现在,如果上述内容已经足够让您想要安装 OSSEC,那么您需要首先执行以下操作。
当然,您需要有一个要监视的服务器。本教程假设您已经拥有一个并且已经设置好可以使用。它可以是您今天刚刚设置的服务器,也可以是您已经使用了几个月的服务器。最重要的是您可以访问它并且可以通过 SSH 登录。当您仍然不知道如何 ssh 进入服务器时,您不想进行设置 OSSEC。
- Ubuntu 14.04 服务器
- 你应该创建一个sudo服务器上的用户。在此示例中,用户名为sammy。但是,本教程将更容易完成,因为root user:
sudo su
- 可选:如果您想从本地 SMTP 服务器发送邮件,您应该安装Postfix用于简单的电子邮件发送
- OSSEC的安装涉及到一些编译,所以你需要
gcc
and make
安装。您可以通过安装一个名为build-essential
- 您还需要安装一个名为
inotify-tools
,这是实时警报工作所必需的
要安装所有必需的软件包,请首先更新服务器:
apt-get update
安装软件包:
apt-get install build-essential inotify-tools
现在我们已经解决了初步问题,让我们开始有趣的部分。
在此步骤中,您将下载 OSSEC tarball 和包含其加密校验和的文件。
由于这是一篇安全文章,我们将做一些额外的工作来验证我们是否正在安装有效的软件。这个想法是,您生成下载的 OSSEC tarball 的 MD5 和 SHA1 校验和,并将它们与校验和文件中的校验和进行比较。如果它们匹配,那么您可以假设 tarball 没有被篡改。
在撰写本文时,OSSEC 的最新服务器版本是版本 2.8.1。要下载它,请输入:
wget -U ossec http://www.ossec.net/files/ossec-hids-2.8.1.tar.gz
要下载校验和文件,请键入:
wget -U ossec http://www.ossec.net/files/ossec-hids-2.8.1-checksum.txt
要验证这两个文件是否已就位,请键入:
ls -l ossec*
您应该看到这些文件:
ossec-hids-2.8.1-checksum.txt
ossec-hids-2.8.1.tar.gz
Now, let’s examine the checksum file with the cat command, like so:
cat ossec-hids-2.8.1-checksum.txt
预期输出:
MD5(ossec-hids-2.8.1.tar.gz)= c2ffd25180f760e366ab16eeb82ae382
SHA1(ossec-hids-2.8.1.tar.gz)= 0ecf1df09558dc8bb4b6f65e1fb2ca7a7df9817c
在上面的输出中,重要的部分是右侧的部分=符号。这些是 tarball 的 MD5 和 SHA1 校验和。
现在我们将确保为 tarball 生成的校验和与我们下载的校验和匹配。
要生成 tarball 的 MD5sum,请输入:
md5sum ossec-hids-2.8.1.tar.gz
预期输出:
c2ffd25180f760e366ab16eeb82ae382 ossec-hids-2.8.1.tar.gz
将生成的 MD5 校验和与校验和文件中的校验和进行比较。他们应该匹配。
通过键入以下内容对 SHA1 校验和执行相同操作:
sha1sum ossec-hids-2.8.1.tar.gz
预期输出:
0ecf1df09558dc8bb4b6f65e1fb2ca7a7df9817c ossec-hids-2.8.1.tar.gz
如果两者都匹配,那么就可以开始了。第二步召唤。
在此步骤中,您将安装 OSSEC。
OSSEC 可以安装在server, agent, local or hybrid模式。此安装用于监控安装了 OSSEC 的服务器。这意味着一个local安装。
在开始安装之前,您必须扩展该文件。您可以通过输入以下内容来做到这一点:
tar -zxf ossec-hids-2.8.1.tar.gz
After that, you should have a directory named ossec-hids-2.8.1. To start installation, you have to change (cd) into that directory, which you do by typing:
cd ossec-hids-2.8.1
To see the contents of the directory that you’re now in, use the ls command by typing:
ls -lgG
您应该看到这些文件和目录:
total 100
drwxrwxr-x 4 4096 Sep 8 21:03 active-response
-rw-rw-r-- 1 542 Sep 8 21:03 BUGS
-rw-rw-r-- 1 289 Sep 8 21:03 CONFIG
drwxrwxr-x 6 4096 Sep 8 21:03 contrib
-rw-rw-r-- 1 3196 Sep 8 21:03 CONTRIBUTORS
drwxrwxr-x 4 4096 Sep 8 21:03 doc
drwxrwxr-x 4 4096 Sep 8 21:03 etc
-rw-rw-r-- 1 1848 Sep 8 21:03 INSTALL
-rwxrwxr-x 1 32019 Sep 8 21:03 install.sh
-rw-rw-r-- 1 24710 Sep 8 21:03 LICENSE
-rw-rw-r-- 1 1664 Sep 8 21:03 README.md
drwxrwxr-x 30 4096 Sep 8 21:03 src
The only file of interest to us in that listing is install.sh. That’s the OSSEC installation script. To initiate installation, type:
./install.sh
系统将提示您回答一些安装问题。
您需要执行的第一个任务是选择语言。如下输出所示,默认为英语。在整个安装过程中,如果需要进行选择,方括号中的任何条目都是默认值。如果您想要默认值,请按 ENTER 键接受默认值。除了必须输入您的电子邮件地址之外,我们建议您接受所有默认设置 - 除非您知道自己在做什么。
Entries are shown in red.
因此,如果您的语言是英语,请按ENTER
。否则,请键入您的语言的两个字母,然后按 ENTER。
(en/br/cn/de/el/es/fr/hu/it/jp/nl/pl/ru/sr/tr) [en]:
选择语言后,您应该看到:
OSSEC HIDS v2.8 Installation Script - http://www.ossec.net
You are about to start the installation process of the OSSEC HIDS.
You must have a C compiler pre-installed in your system.
If you have any questions or comments, please send an e-mail
to dcid@ossec.net (or daniel.cid@gmail.com).
- System: Linux kuruji 3.13.0-36-generic
- User: root
- Host: kuruji
-- Press ENTER to continue or Ctrl-C to abort. --
按 ENTER 后,您应该得到:
1- What kind of installation do you want (server, agent, local, hybrid or help)? local
Type local
and press ENTER. You should get:
- Local installation chosen.
2- Setting up the installation environment.
- Choose where to install the OSSEC HIDS [/var/ossec]:
接受默认值并按 ENTER 键。之后,您将得到:
- Installation will be made at /var/ossec .
3- Configuring the OSSEC HIDS.
3.1- Do you want e-mail notification? (y/n) [y]:
按 ENTER 键。
- What's your e-mail address? sammy@example.com
输入您想要接收 OSSEC 通知的电子邮件地址。
- We found your SMTP server as: mail.example.com.
- Do you want to use it? (y/n) [y]:
--- Using SMTP server: mail.example.com.
除非您有要使用的特定 SMTP 服务器设置,否则请按 ENTER 键。
现在是时候让 OSSEC 知道它应该运行哪些检查了。为了响应脚本中的任何提示,请按接受默认值ENTER
.
ENTER 表示完整性检查守护进程。
3.2- Do you want to run the integrity check daemon? (y/n) [y]:
- Running syscheck (integrity check daemon).
ENTER 进行 Rootkit 检测。
3.3- Do you want to run the rootkit detection engine? (y/n) [y]:
- Running rootcheck (rootkit detection).
ENTER 表示主动响应。
3.4- Active response allows you to execute a specific command based on the events received.
Do you want to enable active response? (y/n) [y]:
Active response enabled.
接受防火墙丢弃响应的默认值。您的输出可能会显示一些 IPv6 选项 – 这很好。
Do you want to enable the firewall-drop response? (y/n) [y]:
- firewall-drop enabled (local) for levels >= 6
- Default white list for the active response:
- 8.8.8.8
- 8.8.4.4
- Do you want to add more IPs to the white list? (y/n)? [n]:
您可以在此处添加您的 IP 地址,但这不是必需的。
OSSEC 现在将显示它将监视的文件的默认列表。安装后可以添加其他文件,因此请按 ENTER。
3.6- Setting the configuration to analyze the following logs:
-- /var/log/auth.log
-- /var/log/syslog
-- /var/log/dpkg.log
- If you want to monitor any other file, just change
the ossec.conf and add a new localfile entry.
Any questions about the configuration can be answered
by visiting us online at http://www.ossec.net .
--- Press ENTER to continue ---
此时,安装程序已拥有安装 OSSEC 所需的所有信息。放松一下,让安装程序完成它的工作。安装大约需要 5 分钟。如果安装成功,您现在就可以启动和配置 OSSEC。
Note:安装可能失败的原因之一是未安装编译器。在这种情况下,您会收到如下错误:
5- Installing the system
- Running the Makefile
./install.sh: 85: ./install.sh: make: not found
Error 0x5.
Building error. Unable to finish the installation.
如果出现该错误,则需要安装build-essential
,如本教程的先决条件部分中所述。
如果安装成功,您应该看到此类输出:
- System is Debian (Ubuntu or derivative).
- Init script modified to start OSSEC HIDS during boot.
- Configuration finished properly.
- To start OSSEC HIDS:
/var/ossec/bin/ossec-control start
- To stop OSSEC HIDS:
/var/ossec/bin/ossec-control stop
- The configuration can be viewed or modified at /var/ossec/etc/ossec.conf
--- Press ENTER to finish (maybe more information below). ---
OSSEC 现已安装。下一步是启动它。
默认情况下,OSSEC 配置为在启动时启动,但第一次,您必须手动启动它。
如果您想检查其当前状态,请键入:
/var/ossec/bin/ossec-control status
预期输出:
ossec-monitord not running...
ossec-logcollector not running...
ossec-syscheckd not running...
ossec-analysisd not running...
ossec-maild not running...
ossec-execd not running...
这告诉您 OSSEC 的进程都没有运行。
要启动 OSSEC,请输入:
/var/ossec/bin/ossec-control start
您应该看到它启动:
Starting OSSEC HIDS v2.8 (by Trend Micro Inc.)...
Started ossec-maild...
Started ossec-execd...
Started ossec-analysisd...
Started ossec-logcollector...
Started ossec-syscheckd...
Started ossec-monitord...
Completed.
如果您再次检查状态,您应该会得到 OSSEC 正在运行的确认。
/var/ossec/bin/ossec-control status
此输出显示 OSSEC 正在运行:
ossec-monitord is running...
ossec-logcollector is running...
ossec-syscheckd is running...
ossec-analysisd is running...
ossec-maild is running...
ossec-execd is running...
启动 OSSEC 后,您应该会收到一封电子邮件,内容如下:
OSSEC HIDS Notification.
2014 Nov 30 11:15:38
Received From: ossec2->ossec-monitord
Rule: 502 fired (level 3) -> "Ossec server started."
Portion of the log(s):
ossec: Ossec started.
这是 OSSEC 正在运行的另一项确认,只要它配置为监控的事情发生,就会向您发送电子邮件警报。即使重新启动,OSSEC 也会向您发送一封电子邮件。
如果您没有立即收到这封电子邮件,请不要担心。您可能仍然需要调整您的电子邮件设置(我们将在本教程后面介绍),以确保您的 OSSEC 服务器的电子邮件可以到达您的邮件提供商。对于 Google 和 Fastmail 等一些第三方电子邮件服务提供商来说尤其如此。
接下来,我们来了解一下OSSEC的文件和目录,并了解如何更改OSSEC的监控和警报设置。
在本教程中,我们将修改 OSSEC,以便在文件被修改、删除或添加到您指定的目录时通知您。
OSSEC的默认目录是chroot-ed(沙箱)环境,只有具有root(管理员)权限的用户才能访问。标准用户不能cd
into /var/ossec
甚至列出其中的文件。但是,作为根(或管理员)用户,您可以。
So, cd
进入安装目录,输入:
cd /var/ossec
要列出新工作目录中的文件,请键入:
ls -lgG
您应该看到这些文件和目录:
total 40
dr-xr-x--- 3 4096 Nov 26 14:56 active-response
dr-xr-x--- 2 4096 Nov 20 20:56 agentless
dr-xr-x--- 2 4096 Nov 20 20:56 bin
dr-xr-x--- 3 4096 Nov 29 00:49 etc
drwxr-x--- 5 4096 Nov 20 20:56 logs
dr-xr-x--- 11 4096 Nov 20 20:56 queue
dr-xr-x--- 4 4096 Nov 20 20:56 rules
drwxr-x--- 5 4096 Nov 20 21:00 stats
dr-xr-x--- 2 4096 Nov 20 20:56 tmp
dr-xr-x--- 3 4096 Nov 29 18:34 var
- OSSEC的主要配置文件位于
/var/ossec/etc
目录。
- 预定义规则位于
/var/ossec/rules
目录
- 用于管理 OSSEC 的命令位于
/var/ossec/bin
- 请注意
/var/ossec/logs
目录。如果 OSSEC 抛出错误,/var/ossec/logs/ossec.log
该目录中的文件是第一个要查找的地方
要访问主配置文件,您必须更改为/var/ossec/etc
。为此,请输入:
cd /var/ossec/etc
如果你做一个ls
在该目录中,您将看到以下文件和目录:
ls -lgG
Results:
total 120
-r--r----- 1 97786 Sep 8 22:03 decoder.xml
-r--r----- 1 2842 Sep 8 22:03 internal_options.conf
-r--r----- 1 3519 Oct 30 13:46 localtime
-r--r----- 1 7752 Nov 29 09:45 ossec.conf
-rw-r----- 1 87 Nov 20 20:56 ossec-init.conf
drwxrwx--- 2 4096 Nov 20 21:00 shared
主要配置文件是/var/ossec/etc/ossec.conf
.
在修改文件之前,请先进行备份,以防万一。要制作该副本,请使用cp
像这样命令:
cp /var/ossec/etc/ossec.conf /var/ossec/etc/ossec.conf.00
这个想法是,如果您的更改不起作用或弄乱系统,您可以恢复到副本并恢复正常。这是您应该始终利用的最简单的灾难恢复实践。
现在,打开ossec.conf
通过使用nano
editor.
nano /var/ossec/etc/ossec.conf
配置文件是一个非常长的 XML 文件,包含多个部分。
Note:一般来说,电子邮件是很挑剔的,尤其是当您发送到更严格的邮件提供商(例如发送到 Gmail 地址)时。检查您的垃圾邮件,并根据需要调整您的设置。
您将看到的第一个配置选项是您在安装过程中指定的电子邮件凭据。如果您需要指定不同的电子邮件地址和/或 SMTP 服务器,可以在此处执行此操作。
<global>
<email_notification>yes</email_notification>
<email_to>sammy@example.com</email_to>
<smtp_server>mail.example.com.</smtp_server>
<email_from>ossecm@ossec_server</email_from>
</global>
By default, OSSEC sends 12 emails per hour, so you’ll not be flooded with email alerts. You can increase or decrease that value by adding the <email_maxperhour>N</email_maxperhour>
setting to that section so that it reads:
<global>
<email_notification>yes</email_notification>
<email_to>sammy@example.com</email_to>
<smtp_server>mail.example.com.</smtp_server>
<email_from>ossecm@ossec_server</email_from>
<email_maxperhour>N</email_maxperhour>
</global>
Please replace N
with the number of emails you want to receive per hour, between 1 and 9999.
某些第三方电子邮件服务提供商(例如 Google 和 Fastmail)将默默地丢弃 OSSEC 发送的警报,如果<email_from>
地址不包含有效的域部分,如上面代码块中的部分。为避免这种情况,请确保该电子邮件地址包含有效的域部分。例如:
<global>
<email_notification>yes</email_notification>
<email_to>sammy@example.com</email_to>
<smtp_server>mail.example.com.</smtp_server>
<email_from>sammy@ossec_server.com</email_from>
</global>
The <email_to>
and <email_from>
地址可以相同。例如:
<global>
<email_notification>yes</email_notification>
<email_to>sammy@example.com</email_to>
<smtp_server>mail.example.com.</smtp_server>
<email_from>sammy@example.com</email_from>
</global>
If you don’t want to use an external email provider’s SMTP server, you can specify your own SMTP server, if you have one configured. (This is not covered in this tutorial, but you can install Postfix following these instructions.) If your SMTP server is running on the same Droplet as OSSEC, change the <smtp_server>
setting to localhost
. For example:
<global>
<email_notification>yes</email_notification>
<email_to>sammy@example.com</email_to>
<smtp_server>localhost</smtp_server>
<email_from>sammy@example.com</email_from>
</global>
OSSEC 默认情况下不发送实时警报,但本教程要求实时通知,因此这是您要修改的一方面。
如果您仍然没有收到来自 OSSEC 的预期电子邮件,请检查日志:/var/ossec/logs/ossec.log
对于邮件错误。
邮件错误示例:
2014/12/18 17:48:35 os_sendmail(1767): WARN: End of DATA not accepted by server
2014/12/18 17:48:35 ossec-maild(1223): ERROR: Error Sending email to 74.125.131.26 (smtp server)
您可以使用这些错误消息来帮助您调试接收电子邮件通知的任何问题。
In the <syscheck>
的部分ossec.conf
,它是这样开始的:
<syscheck>
<!-- Frequency that syscheck is executed - default to every 22 hours -->
<frequency>79200</frequency>
我们将打开新文件创建警报。添加行<alert_new_files>yes</alert_new_files>
所以它读起来像这样:
<syscheck>
<!-- Frequency that syscheck is executed - default to every 22 hours -->
<frequency>79200</frequency>
<alert_new_files>yes</alert_new_files>
出于测试目的,您可能还希望将系统检查的频率设置得低得多。默认情况下,系统检查每 22 小时运行一次。出于测试目的,您可能希望将其设置为每分钟一次,即60
秒。完成测试后,将其恢复为正常值。
<syscheck>
<!-- Frequency that syscheck is executed - default to every 22 hours -->
<frequency>60</frequency>
<alert_new_files>yes</alert_new_files>
之后,您应该会看到 OSSEC 监视的系统目录列表。它读起来像:
<!-- Directories to check (perform all possible verifications) -->
<directories check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
<directories check_all="yes">/bin,/sbin</directories>
让我们通过添加设置来启用实时监控report_changes="yes" realtime="yes"
到每一行。修改这些行,使其显示为:
<!-- Directories to check (perform all possible verifications) -->
<directories report_changes="yes" realtime="yes" check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
<directories report_changes="yes" realtime="yes" check_all="yes">/bin,/sbin</directories>
report_changes="yes"
完全按照所说的去做。同上realtime="yes"
.
除了 OSSEC 配置为监视的默认目录列表之外,您还可以添加要监视的新目录。在下一节中,我将告诉 OSSEC 进行监控/home/sammy
and /var/www
。为此,我将在现有行的正下方添加一个新行,以便该部分现在显示为:
<!-- Directories to check (perform all possible verifications) -->
<directories report_changes="yes" realtime="yes" check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
<directories report_changes="yes" realtime="yes" check_all="yes">/bin,/sbin</directories>
<directories report_changes="yes" realtime="yes" restrict=".php|.js|.py|.sh|.html" check_all="yes">/home/sammy,/var/www</directories>
您应该修改目录以匹配您所需的设置。如果您的用户未命名sammy,您将需要更改主目录的路径。
对于要监视的新目录,我们添加了restrict
选项,它告诉 OSSEC 仅监视指定的文件格式。您不必使用该选项,但当您有其他文件(例如图像文件)且您不希望 OSSEC 发出警报时,它会派上用场。
这就是所有的改变ossec.conf
。您可以保存并关闭该文件。
下一个要修改的文件位于/var/ossec/rules
目录,所以cd
输入:
cd /var/ossec/rules
如果你做一个ls
在该目录中,您将看到一堆如下所示的 XML 文件:
ls -lgG
缩写输出:
total 376
-r-xr-x--- 1 5882 Sep 8 22:03 apache_rules.xml
-r-xr-x--- 1 2567 Sep 8 22:03 arpwatch_rules.xml
-r-xr-x--- 1 3726 Sep 8 22:03 asterisk_rules.xml
-r-xr-x--- 1 4315 Sep 8 22:03 attack_rules.xml
...
-r-xr-x--- 1 1772 Nov 30 17:33 local_rules.xml
...
-r-xr-x--- 1 10359 Sep 8 22:03 ossec_rules.xml
...
现在我们只对其中两个文件感兴趣 -local_rules.xml
and ossec_rules.xml
。后者包含 OSSEC 的默认规则定义,而前者是您添加自定义规则的位置。换句话说,除了local_rules.xml
,您不要修改该目录中的任何文件。
默认规则定义在ossec_rules.xml
查看很有用,因此我们可以修改它们并将其复制到我们的本地规则中。在ossec_rules.xml
,当文件被打开时触发的规则added到受监控的目录是规则554。默认情况下,当该规则被触发时,OSSEC 不会发出警报,因此这里的任务是更改该行为。默认版本中的规则 554 如下所示:
<rule id="554" level="0">
<category>ossec</category>
<decoded_as>syscheck_new_entry</decoded_as>
<description>File added to the system.</description>
<group>syscheck,</group>
</rule>
如果规则有以下情况,OSSEC 不会发出警报level
set to 0。我们想修改此规则以提高警报级别。我们不会在默认文件中更改它,而是将规则复制到local_rules.xml
并修改它以便它可以触发警报。
为此,请制作一个备份副本/var/ossec/rules/local_rules.xml
file:
cp /var/ossec/rules/local_rules.xml /var/ossec/rules/local_rules.xml.00
编辑文件nano:
nano /var/ossec/rules/local_rules.xml
在文件末尾添加新规则。确保它在范围内<group> ... </group>
tag.
<rule id="554" level="7" overwrite="yes">
<category>ossec</category>
<decoded_as>syscheck_new_entry</decoded_as>
<description>File added to the system.</description>
<group>syscheck,</group>
</rule>
保存并关闭文件。
这些都是必要的改变。
现在剩下的就是重新启动 OSSEC,这是每次修改 OSSEC 文件时都必须执行的操作。要重新启动 OSSEC,请输入:
/var/ossec/bin/ossec-control restart
如果一切正常,您应该会收到一封来自 OSSEC 的电子邮件,通知您它已(重新)启动。
根据 OSSEC 配置为监控的目录中发生的情况,您应该会收到类似以下内容的电子邮件:
现在尝试在中创建示例文件/home/sammy
touch /home/sammy/index.html
等一下。添加一些内容:
nano /home/sammy/index.html
等一下。删除文件:
rm /home/sammy/index.html
您应该开始接收如下通知:
OSSEC HIDS Notification.
2014 Nov 30 18:03:51
Received From: ossec2->syscheck
Rule: 550 fired (level 7) -> "Integrity checksum changed."
Portion of the log(s):
Integrity checksum changed for: '/home/sammy/index.html'
Size changed from '21' to '46'
What changed:
1c1,4
< This is an html file
---
<!doctype html> <p>This is an html file</p>
Old md5sum was: '4473d6ada73de51b5b36748627fa119b'
New md5sum is : 'ef36c42cd7014de95680d656dec62de9'
Old sha1sum was: '96bd9d685a7d23b20abd7d8231bb215521bcdb6c'
New sha1sum is : '5ab0f31c32077a23c71c18018a374375edcd0b90'
Or this:
OSSEC HIDS Notification.
2014 Dec 01 10:13:31
Received From: ossec2->syscheck
Rule: 554 fired (level 7) -> "File added to the system."
Portion of the log(s):
New file '/var/www/header.html' added to the file system.
Note:OSSEC 不会针对文件添加发出实时警报,仅针对文件修改和删除发出实时警报。文件添加警报在完整的系统检查后发出,这由频率检查时间控制ossec.conf
.
nano /var/ossec/etc/ossec.conf
设置为frequency
:
<syscheck>
<!-- Frequency that syscheck is executed - default to every 22 hours -->
<frequency>79200</frequency>
再次强调,如果您没有收到电子邮件,请检查您的垃圾邮件,检查您的/var/ossec/logs/ossec.log
,检查您的邮件日志等。
我希望这能让您体验到 OSSEC 所提供的功能。可以进行更高级的设置和配置,因此请继续关注未来有关如何部署 OSSEC 来监控和保护服务器的文章。
有关 OSSEC 的更多信息,请访问该项目的网站:http://www.ossec.net/.