Falcon的介绍:http://www.secrule.com/falcon/index.html
这里只记录一下安装过程。
1.检查inotify
uname -r #检查输出Linux系统内核是否达到了2.6.13以上 ls /proc/sys/fs/inotify #检查是否有max_queued_events、max_user_instances、max_user_watches三个文件
2.编译安装inotify-tools
wget http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz tar xzvf inotify-tools-3.14.tar.gz cd inotify-tools-3.14 ./configure --prefix=/usr make && make install
3.下载falcon
wget http://github.com/secrule/falcon/archive/master.zip unzip master.zip #如果提示没有unzip请自行安装 yum -y install unzip 或者 apt-get install unzip ,或者直接git clone cd falcon-master/Release
4.修改安装前缀
因为wiki里面写的inotfy-tools的安装位置是/usr,而check.sh里写的是/usr/local,需要修改check.sh第15行修改成:
if [ -d /usr/include/inotifytools ] 原文是 if [ -d /usr/local/include/inotifytools ]
5.安装环境检查
chmod a+x check.sh ./check.sh
输出需要是:
Found inotify success! Found inotifytools success! Found mysql-dev environment success!
才可继续安装。如果第一行、第二行没有出现请检查上面的步骤是否安装成功,如果第三行没有出现,请安装mysql-dev
yum install mysql yum install mysql-devel
6.安装falcon控制中心
这个是网页端,PHP写的,安装之前保证自己有Web环境,lnmp/lamp等均可。
cd ../ #请确定你切换到了falcon-master目录 cp -r falconconsole/ /home/wwwroot/falcon/ #路径请自己修改 vim /home/wwwroot/falcon/public/config.inc.php #路径同上
这里写上数据库信息,有中文注释,如果PUTTY不是utf-8编码的话记得修改,或者用ftp编辑好再上传
7.配置falcon主程序
vim src/conf/global.conf #请确定你现在处于falcon-master目录
这里设置和上面一样的MySQL地址和数据库,然后请修改需要监控的web目录,注意要以/结尾
8.编译falcon
cd Release #请确定你切换到了falcon-master/Relase目录 make
9.安装falcon数据库和控制台
访问http://<你的域名>/falcon/install.php,导入数据库并设置管理员
10.运行falcon
ls -al #检查是否有falcon文件 chmod a+x falcon #保证执行权限 nohup ./falcon start >falcon.log 2>&1 & #在后台无间断运行falcon ls -al #检查是否生成了falcon.log日志信息
11.登录falcon
访问http://<你的域名>/falcon/,登录
12.测试falcon
touch /home/wwwroot/test.php #创建一个测试php文件 rm /home/wwwroot/test.php #把测试的php文件删除 wget https://gist.github.com/oott123/6173352/raw/2011.php -O /home/wwwroot/test.php #下载一个PHP木马 cat /home/wwwroot/test.php #观察木马是否被自动删除 ls -al /home/virus/ #观察隔离区
然后访问falcon前台观察是否有相应日志
13.设置自动启动
wget https://gist.github.com/oott123/6173433/raw/startfalcon.sh pwd #查看当前目录 vim startfalcon.sh #编辑其中的/root/falcon/falcon-master/Release/为你的falcon目录 chmod a+x startfalcon.sh vim /etc/rc.d/rc.local
在rc.local中加入以下
/root/falcon/falcon-master/Release/startfalcon.sh &
重启测试
使用测评:
在测试了寥寥几个文件之后,falcon多次崩溃(Segmentation fault),稳定性存疑。不过思路是好的,也许可以用一用~
附图一张