Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > ASP.NET > Win2K下Snort+MySQL+Apache+Acid安装参考[原创]
【标  题】:Win2K下Snort+MySQL+Apache+Acid安装参考[原创]
【关键字】:c,SQL,in,安装,Win,Apache,id,My,MySQL,2K,Acid,or,Snort,Win2K,Wi,Win2K,Snort,MySQL,Apache,Acid
【来  源】:BLOG.CSDN.NET

Win2K下Snort+MySQL+Apache+Acid安装参考[原创]

Your Ad Here

snort 是一个强大的轻量级的网络入侵检测系统。它具有实时数据流量分析和日志IP 网络数据包的能力,能够进行协议分析,对内容进行搜索/匹配。它能够检测各种不同的攻击方式,对攻击进行实时报警。Snort 可以运行在*nix/Win32 平台上。

本文将主要介绍Win2000 Snort 的安装与配置,关于Snort 的体系结构和规则,可以参考其他相关资。

安装与配置

首先下载以下软件包:
acid-0.9.6b23.tar.gz
http://www.cert.org/kb/acid
基于php 的入侵检测数据库分析控制台
adodb453.zip
http://php.weblogs.com/adodb
ADOdb
Active Data Objects Data Base)库for PHP
apache_2.0.54-win32-x86-no_ssl.msi
http://www.apache.org
Windows
版本的Apache Web 服务器
jpgraph-2.0beta
http://www.aditus.nu/jpgraph
OO
图形库for PHP
mysql-4.1.14-win32.zip
http://www.mysql.com
Windows
版本的Mysql 数据库服务器
php-5.0.5-Win32.zip
(强烈建议用。Zip文件,不要用installer文件)
http://www.php.net
Windows
版本的php 脚本环境支持
snort-2_3_0.exe
http://www.snort.org
Windows
版本的Snort 安装包
3.0-WinPcap.exe
http://winpcap.polito.it/
网络数据包截取驱动程序
phpMyAdmin-3.6.2-pl1.zip
http://www.phpmyadmin.net
基于php Mysql 数据库管理程序
(需要国外代理访问)

 

首先安装apache_2.0.54-win32-x86-no_ssl.msi

安装的时候注意,如果你已经安装了IIS 并且启动了Web Server,因为IIS WebServer 默认在TCP 80 端口监听,所以会和Apache WebServer 冲突,我们可以修改Apache WebServer为其他端口。选择定制安装,安装路径修改为c:\ 安装程序会自动建立c:\apache2 目录,继续以完成安装。(因为我没有装IIS,所以我选择了80端口)

如果安装了IIS,则需要安装完成后首先修改c:\apache2\conf\httpd.conf apache web server 默认在8080 端口监听,我们修改为其他不常用的高端端口:修改Listen 8080 Listen 50080

如果是olderapache版本,可能需要:安装apache 为服务方式运行 c:\apache2\bin\apache –k install。我在安装的这个版本的时候没有用到这一步。

 

测试apache

如果没有装IIS,在浏览器地址栏里键入:http://127.0.0.1/

如果装了IIS,在浏览器地址栏里键入:http://127.0.0.150080/

Anpache安装成功在页面顶部中会出现:If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page.

 

添加Apache PHP 的支持:

解压缩php-5.0.5-Win32.zip c:\php

安装后打开从c:\php\install.txt。里边说明了如何安装php,我把在win2K手工安装支持apache2.0.xphp5的部分翻译成中文,供大家参考

【翻译文】手动安装步骤:

【翻译文】安装手册将帮助你在微软的web服务器上手动安装并配置PHP,在开始安装前你要从http://www.php.net/downloads.php.上下载zip文件。

【翻译文】虽然那里(http://www.php.net/downloads.php)又很多安装工具包,不过我们还是发布了微软操作系统的PHP intaller版本,我们建议你花一些时间自己去安装PHP(就是不要用install安装),这样你会对整个系统有一个很好的了解,也会让你在需要安装PHP extensions(可能是指扩充安装PHP,就是定义和配置PHP的一些其他服务)更简单。

【翻译文】在PHP的以前版本中,在案装是手册建议你把各种.iniDLL文件装在SYSTEM(如 C:\WINDOWS)文件夹下,这样只是安装过程变得简单,但是是升级PHP很复杂。因此,在安装新版本PHP是我们建议你把老版本的iniDLLSYSTEM文件夹中删除(删除前请做好备份,原因,大家都明百白:))。安装PHP一种较好的方式就是把所有的文件都放在一个文件夹下(installer安装就不会把所有的文件都加在一个文件夹中),而且这个文件夹路径要加在系统的PATH变量中。

【翻译文】MDAC requirements:如果你的系统是Microsoft Windows 98/NT4 ,请从下载http://msdn.microsoft.com/data/.最新版本的MDACMicrosoft Data Access Components

【翻译文】下边的步骤要在所有版本的PHP安装过程中都需要执行:

 【翻译文】 (1)解压缩,一般情况放在c:\php目录下,注意:不要放在. C:\Program

   Files\PHP ,如果这样作有些web服务器会崩溃(不知道为什么,也没试过)

PHP4 PHP5的文件结构如下图所示:

略,(请参考c:\php\install.txt

   Example 2-1. PHP 4 package structure

 【翻译文】 你可以看一下PHP4PHP5目录结够的不同,这些不同是安装PHP4PHP5也会又很大诧异。其中比较明显的是PHP4包中有很多modulessapi文件夹中,而PHP5没有这样的文件夹,它直接把这些modules放在PHP跟目录中。支持PHP文扩展的DLL三也不是都在一个单独的目录中。

【翻译文】注意:在案装PHP4的时候,你要把sapi中的所有文件和其它文件中的dll文件都移到php的根目录下。如(c\php

   下边是PHP 4 and PHP 5dll文件的对比。:

 

     * sapi/php4activescript.dll (php5activescript.dll) - ActiveScript

       engine, allowing you to embed PHP in your Windows applications.

     * sapi/php4apache.dll (php5apache.dll) - Apache 1.3.x module.

     * sapi/php4apache2.dll (php5apache2.dll) - Apache 2.0.x module.

     * sapi/php4isapi.dll (php5isapi.dll) - ISAPI Module for ISAPI

       compliant web servers like IIS 4.0/PWS 4.0 or newer.

     * sapi/php4nsapi.dll (php5nsapi.dll) - Sun/iPlanet/Netscape server

       module.

     * sapi/php4pi3web.dll (no equivalent in PHP 5) - Pi3Web server

       module.

 

   一段讨论CGI librariesCLI的文字略……

   一段说明php4ts.dll (php5ts.dll)  安装重要性的文字略……

 

  【翻译文】 有两种方式可以使你的 php4ts.dll / php5ts.dll文件可用(你至少使用一种,而且一种就够了):

(1)       拷贝这个文件到你的系统目录下(如:c:\WINNT\system32

(2)       把你的PHP 目录 C:\php加到环境变量PATH. 为了更好的可维护性我们建议你采取这种方法,你可以到PHP FAQ中参考把PHP目录加到PATH变量中的方法(我得电脑,鼠标右键,高级,环境变量,找到PATH变量就可修改,如果没有PATH变量需要添加)

【翻译文】下一步是安装PHP配置文件php.ini.建议用php.ini-recommended,将此文件改名为php.ini就可。为了找到php.ini ,操作系统会以以下顺序寻找。

(1)       PHPIniDir指令(apache2 module only

(2)       HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath

(3)       Directory of PHP (for CLI), or the web server's directory (for SAPI modules)

(4)       Windows directory (C:\windows or C:\winnt)

【翻译文】  如果你用apache2,用PHPIniDir指令是最简单的方法(以后会提到如何用)

  下边是可选选项,没有使用,也不作翻译

  The following steps are optional:

     * Edit your new php.ini file. If you plan to use OmniHTTPd, do not

       follow the next step. Set the doc_root to point to your web

       servers document_root. For example:

doc_root = c:\inetpub\wwwroot // for IIS/PWS

doc_root = c:\apache\htdocs // for Apache

     * Choose the extensions you would like to load when PHP starts. See

       the section about Windows extensions, about how to set up one, and

       what is already built in. Note that on a new installation it is

       advisable to first get PHP working and tested without any

       extensions before enabling them in php.ini.

     * On PWS and IIS, you can set the browscap configuration setting to

       point to: c:\windows\system\inetsrv\browscap.ini on Windows 9x/Me,

       c:\winnt\system32\inetsrv\browscap.ini on NT/2000, and

       c:\windows\system32\inetsrv\browscap.ini on XP. For an up-to-date

       browscap.ini, read the following FAQ.

   PHP is now setup on your system. The next step is to choose a web

   server, and enable it to run PHP. Choose a webserver from the table of

   contents.

     _________________________________________________________________

下边翻译片断为 Apache 2.0.x on Microsoft Windows(只翻译跟安装相关的部分内容,详细内容参考c:\php\install.txt

这个片断的内容只适合在apache2.0.x上安装PHP

关于版本匹配问题,引用原文。本文中安装的apache2PHP兼容,建议以此搭配安装。

     PHP and Apache 2.0.x compatibility notes: The following versions of

     PHP are known to work with the most recent version of Apache 2.0.x:

 

     * PHP 4.3.0 or later available at http://www.php.net/downloads.php.

     * the latest stable development version. Get the source code

       http://snaps.php.net/php4-latest.tar.gz or download binaries for

       Windows http://snaps.php.net/win32/php4-win32-latest.zip.

     * a prerelease version downloadable from http://qa.php.net/.

     * you have always the option to obtain PHP through anonymous CVS.

 

     These versions of PHP are compatible to Apache 2.0.40 and later.

 

     Apache 2.0 SAPI-support started with PHP 4.2.0. PHP 4.2.3 works

     with Apache 2.0.39, don't use any other version of Apache with PHP

     4.2.3. However, the recommended setup is to use PHP 4.3.0 or later

     with the most recent version of Apache2.

 

     All mentioned versions of PHP will work still with Apache 1.3.x.

 

【翻译文】有两种方式安装PHP,在此只用了Installing as an Apache module 方式

【翻译文】首先需要在 Apache httpd.conf 配置文件中加入如下两句话:

【翻译文】# 如果是PHP4,类似如下:

LoadModule php4_module "c:/php/php4apache2.dll"

AddType application/x-httpd-php .php

 

【翻译文】# 如果是PHP5,类似于如下:

LoadModule php5_module "c:/php/php5apache2.dll"

AddType application/x-httpd-php .php

 

# configure the path to php.ini PHPIniDir指令设置php.in路径

PHPIniDir "C:/php"    

 

 

启动Apache 服务

net start apache2

c:\apache2\htdocs 目录下新建test.php

test.php 文件内容:

<?phpinfo();?>

使用http://192.168.0.15:50080/test.php
测试php 是否安装成功

 

安装Mysql
默认安装Mysql c:\mysql,安装的时候,我是一路next,其中有一步,是让输入root帐号的密码,这个密码很重要,不然你的MYSQL可能就用不了。

注意:要把my.ini 拷贝到c:\winnt\目录下

 

启动mysql 服务:net start mysql

MySQL Command Line Client打开mysql

 

下如果出现不能启动mysql,新建my.ini

内容为:

[mysqld]
basedir= C:\Program Files\MySQL\MySQL Server 4.1
bind-address=127.0.0.1
datadir= C:\Program Files\MySQL\MySQL Server 4.1 \data
注意其中的basedir datadir 目录是否指向了正确的目录.
my.ini 拷贝至%systemroot%目录下就可以了

配置mysql

建立snort 运行必须的snort

mysql>create database snort;

使用c:\snort\contrib 目录下的create_mysql 脚本建立Snort 运行必须的数据表
C:\Program Files\MySQL\MySQL Server 4.1\data\mysql -D snort -u root -p < C:\Snort\schemas\mysql_create  (
注意后边千万不能加”;”,另外snort版本不同mysql_create所在的路径也会有差别,请依你的路径为准)

建立snort 用户
mysql> grant usage on *.* to "snort"@localhost"
snort 用户分配相关权限
mysql> grant INSERT,SELECT on root.* to snort@localhost;

>Query OK, 0 rows affected (0.02 sec)

mysql> SET PASSWORD FOR snort@localhost=PASSWORD('yourpassword');

>Query OK, 0 rows affected (0.25 sec)

mysql> grant CREATE, INSERT, SELECT, DELETE, UPDATE on snort.* to snort@localhost;

>Query OK, 0 rows affected (0.02 sec)

mysql> exit

>Bye


安装adodb:
解压缩adodb453.zip c:\apache2\htdocs\adodb 目录下(安装目录不要变,不然会有异常产生现象)
安装acid
解压缩acid-0.9.6b23.tar.gzc:\apache2\htdocs\acid 目录下(安装目录不要变,不然会有异常产生现象)

修改acid_conf.php 文件

$DBlib_path = c:\apache2\htdocs\adodb;
/* The type of underlying alert database

*

* MySQL : "mysql"

* PostgresSQL : "postgres"

* MS SQL Server : "mssql"

*/

$DBtype = "mysql";

/* Alert DB connection parameters

* - $alert_dbname : MySQL database name of Snort alert DB

* - $alert_host : host on which the DB is stored

* - $alert_port : port on which to access the DB

* - $alert_user : login to the database with this user

* - $alert_password : password of the DB user

*

* This information can be gleaned from the Snort database

* output plugin configuration.

*/

$alert_dbname = "snort";

$alert_host = "localhost";

$alert_port = "";

$alert_user = "snort";

$alert_password = "'yourpassword'";

/* Archive DB connection parameters */

$archive_dbname = "snort";

$archive_host = "localhost";

$archive_port = "";

$archive_user = "snort";

$archive_password = "yourpassword";

And a little further down

$ChartLib_path = " C:\apache2 \htdocs\jpgraph-2.0beta\src";

/* File format of charts ('png', 'jpeg', 'gif') */

 

建立acid 运行必须的数据库:
用浏览器输入:http://127.0.0.1/acid/acid_main.php
如果此时出现如下错误:PHP ERROR: PHP build incomplete: the prerequisite MySQL support required to read the alert database was not built into PHP. Please recompile PHP with the necessary library (--with-mysql)

不要急,解决方法如下(原因是你的PHP没有提供mysql的支持)。

打开php.ini文件(注意如果存在多个php.Ini文件.必须是系统第一个找到的那个,系统寻找php.ini文件顺序在前文已讲)

Ctrl+F.输入extension=php_mysql.dll。然后会定位到“;extension=php_mysql.dll”这时候你把前边的“;”清除就可。

重启apache,如果说找不到libmysql.dll.则把C:\Program Files\MySQL\MySQL Server 4.1\bin中的libmysql.dll拷贝到c\winnt\system32.或者可以把C:\Program Files\MySQL\MySQL Server 4.1\bin加到PATH环境变量中。

这样处理后应该可以启动apache服务器,如果有问题可以“菜单/程序/Apache HTTP Server 2.0.54/Configure Apache Server/Test Configuration”看一下返回什么错误,然后再到网上搜索一下就可以解决

解决后到http://127.0.01/acid/acid_db_setup.php按照系统提示建立acid数据库。如果无法建立,可用如下方法:

acid目录下的create_acid_tbls_mysql.txt的内容拷到create_mysql中,使得在建立snort表时也建立了acid的表。这样建立的数据库表总共有20个,包括acid的四个表:acid_ag acid_ag_alert acid_event acid_ip_cache等。另外也可以参照,C:\Program Files\MySQL\MySQL Server 4.1\data\mysql -D snort -u root -p < C:\Snort\schemas\mysql_create

改为C:\Program Files\MySQL\MySQL Server 4.1\data\mysql -D snort -u root -p < C:\apache2 \htdocs\acid\create_acid_tbls_mysql(首先要把create_acid_tbls_mysql.txt改名为create_acid_tbls_mysql)

 

成功后可用如下方法查看

菜单/程序/mysql/create_acid_tbls_mysql/MySQL Command Line Client”启动mysql

Enter password: ********

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4 to server version: 4.1.14-nt

 

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 

mysql> show databases;

+----------+

| Database |

+----------+

| mysql    |

| snort    |

| test     |

+----------+

3 rows in set (0.00 sec)

 

mysql> use snort;

Database changed

mysql> show tables;

+------------------+

| Tables_in_snort  |

+------------------+

| acid_ag          |

| acid_ag_alert    |

| acid_event       |

| acid_ip_cache    |

| data             |

| detail           |

| encoding         |

| event            |

| icmphdr          |

| iphdr            |

| opt              |

| reference        |

| reference_system |

| schema           |

| sensor           |

| sig_class        |

| sig_reference    |

| signature        |

| tcphdr           |

| udphdr           |

+------------------+

20 rows in set (0.00 sec)

 

mysql>

如此说明安装成功。

重启apache服务器,输入http://127.0.0.1/acid/acid_main.php。会看到一些表格一样的东西,说明apachemysqlphp成功。

安装jpgrapg

解压缩http://www.aditus.nu/jpgraph C:\apache2\ htdocs
修改jpgraph.php
DEFINE("CACHE_DIR","/tmp/jpgraph_cache/");

 

下边安装snort

【相关评论】
没有相关评论
【发表评论】
姓名:
邮件:
随机码*
评论*
      
|  首 页  |  版权声明  |  联系我们   |  网站地图  |
CopyRight © 2004-2007 软讯网络 All Rigths Reserved.