当前位置: 首页 > 图文教程 > 网络安全 > 安全基础 > Linux 9系统下构建小型入侵检测系统

安全基础
入侵常用TCP端口作用及其操作建议之二十九
玩转XP系统中的一些另类卸载
移动硬盘常见问题的解决(1)
移动硬盘常见问题的解决(2)
使用RSS能做的十六件事
Win XP系统19例常见问题(1)
Win XP系统19例常见问题(2)
Win XP系统19例常见问题(3)
Win XP系统19例常见问题(4)
企业安全管理从IP地址开始
计算机取证常识
深入剖析EFS
WinXP另类垃圾的清理(1)
WinXP另类垃圾的清理(2)
WinXP另类垃圾的清理(3)
WinXP另类垃圾的清理(4)
给Windows XP标题栏瘦瘦身
体验Windows XP的网络视频会议(1)
体验Windows XP的网络视频会议(2)
交换网络中的嗅探和ARP欺骗

安全基础 中的 Linux 9系统下构建小型入侵检测系统


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-28   浏览: 120 ::
收藏到网摘: n/a

 

  一、系统平台

  Redhat9.0发行版, 安装gcc 及相关库文件,建议不要安装Apache,PHP,MySQL,我们将用源码编译安装。基于安全方面的考虑,可以设置一下iptables只允许SSH和WWW访问。

  二、软件

  MySQL4.0.12 http://mysql.secsup.org

  Snort2.0.0 http://www.snort.org

  Apache2.0.45 http://www.apache.org

  PHP4.3.1 http://www.php.net

  ADODBv3.30 http://phplens.com

  Acid0.9.6b23 http://acidlab.sourceforge.net

  Zlib1.1.4 http://flow.dl.sourceforge.net

  JPGraph1.11 http://jpgraph.techuk.com

  LibPcap0.7.2 http://www.tcpdump.org

  建议到这个站点下载http://ftp.cdut.edu.cn/pub/linux/NEW/

  也可以到http://www.rpmfind.com下载相关的xx.src.rpm编译安装。如若安装了rpm包,可以强行将其反安装rpm -e -nodeps xx.xx

  三、安装(建议将所有的包文件考到同一目录)

  1.安装zlib1.1.4

  tar -xzvf zlib-xx.tar.gz

  cd zlib-xx

  /configure;make test

  make install

  cd ..

  2.安装LibPcap0.7.2

  tar -xzvf libpcap.tar.gz

  cd libpcap-xx

  /configure

  make

  make install

  cd ..

  3.安装MySQL4.0.12

  3.1创建mysql组和mysql用户

  groupadd mysql

  useradd -g mysql mysql

  修改/root下的.bash_profile的这一行:

  PATH=?$PATH:?$HOME/bin 为

  PATH=?$PATH:?$HOME/bin:/usr/local/mysql/bin

  3.2安装mysql

  tar -xzvf mysql-xx.tar.gz

  cd mysql-xx

  /configure --prefix=/usr/local/mysql

  make

  make install

  cd scripts

  /mysql_install_db

  chown -R root /usr/local/mysql

  chown -R mysql /usr/local/mysql/var

  chgrp -R mysql /usr/local/mysql

  cd ./support-files/my-medium.cnf /etc/my.cnf

  向/etc/ld.so.conf中加入两行:/usr/local/mysql/lib/mysql

  /usr/local/lib

  载入库,执行

  ldconfig -v

  3.3测试mysql是否工作:

  cd /usr/local/mysql/bin/

  /mysqld_safe --user=mysql&

  #ps -ef |grep mysql

  看mysql_safe是否工作

  3.4设置mysql为自启动:

  将mysql安装目录下的support-files目录中的

  mysql.server文件拷到/etc/init.d目录

  cp mysql.server /etc/init.d/mysql

  chmod 755 /etc/init.d/mysql

  创建硬链接:

  cd /etc/rc3.d(文本方式启动)

  ln -s /etc/init.d/mysql S85mysql

  ln -s /etc/init.d/mysql K85mysql

  cd /etc/rc5.d (图形方式启动)

  ln -s /etc/init.d/mysql S85mysql

  ln -s /etc/init.d/mysql K85mysql

  4.安装Apache2.0.45和PHP4.3.1

  tar -zxvf httpd-2.0.xx.tar.gz

  cd httpd_2.xx.xx

  /configure --prefix=/www --enable-so

  注:apache根目录为 /www

  make

  make install

  cd ..

  tar -zxvf php-4.3.x.tar.gz

  cd php-4.3.x

  /configure --prefix=/www/php --with-apxs2=/www/bin/apxs --with-config- filepath=/www/php --enable-sockets --with-mysql=/usr/local/mysql --with-zlibdir=/

  usr/local --with- gd

  注意:这些为一行,中间不要有回车。

  cp php.ini-dist /www/php/php.ini

  编辑httpd.conf(/www/conf):

  加入两行

  LoadModule php4_module modules/libphp4.so

  AddType application/x-httpd-php .php

  httpd.conf中相关内容如下:

  #

  # LoadModule foo_module modules/mod_foo.so

  LoadModule php4_module modules/libphp4.so

  # AddType allows you to tweak mime.types without actually editing it, or ?$

  # make certain files to be certain types.

  #

  AddType application/x-tar .tgz

  AddType image/x- icon .ico

  AddType application/x-httpd-php .php

  设置Apache为自启动:

  cp /www/bin/apachectl /etc/init.d/httpd

  cd /etc/rc3.d

  ln -s /etc/init.d/httpd S85httpd

  ln -s /etc/init.d/httpd K85httpd

  cd /etc/rc5.d

  ln -s /etc/init.d/httpd S85httpd

  ln -s /etc/init.d/httpd K85httpd

  测