Skip to content

조회 수 20818 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

1. APM

1.1 apache

homepage : http://www.apache.org

 

# wget  http://www.apache.org/dist/httpd/httpd-2.2.4.tar.gz

# tar xvzf httpd-2.2.4.tar.gz

# cd httpd-2.2.4

# ./configure  --prefix=/usr/local/apache  --with-charset=euc_kr \

> --enable-module=so  --with-included-apr

# make

# make install

 

# vi /usr/local/apache/conf/httpd.conf

아래 내용을 변경

? ServerRoot “/usr/local/apache”
apache의
기본 디렉토리 내용 확인

? DocumentRoot “/usr/local/apache/htdocs”
html 파일이
저장될 디렉토리

? DirectoryIndex index.html
인텍스
파일의 이름 지정, index.htm index.php 등을

? #ServerName www.example.com:80
앞의 주석 ‘#’ 제거하고 서버에서 사용할 도메인네임을 적는다. 아무 도메인네임을 기입해도 무관하다.

 

1.2 mysql

homepage : http://www.mysql.com

 

# wget http://mysql.byungsoo.net/Downloads/MySQL-5.0/mysql-5.0.37.tar.gz

# tar xvzf mysql-5.0.37.tar.gz

# cd mysql-5.0.37

# ./configure  --prefix=/usr/local/mysql  --with-charset=euckr

# make

# make install

 

# useradd  mysql  ?s  /sbin/nologin

# chown  ?R  mysql.mysql  /usr/local/mysql

# cd /usr/local/mysql/bin

# mysql_install_db

# mysqld_safe &

 

1.3 PHP

PHP를 설치 하기 위해 다음의 프로그램을 설치

 

1.3.1 libxml

libxml homepage : http://www.xmlsoft.org/

# wget  ftp://xmlsoft.org/libxml2/libxml2-2.6.27.tar.gz

# tar  xvzf  libxml2-2.6.27.tar.gz

# cd  libxml2-2.6.27

# ./configure  --prefix=/usr/local/libxml2

# make

# make  install

 

1.3.2 gd

gd 홈 페이지 : http://www.boutell.com/gd/

 

# wget  http://www.libgd.org/releases/gd-2.0.34.tar.gz

# tar  xvzf  gd-2.0.34.tar.gz

# mv  gd-2.0.34  /usr/local/gd

# cd  /usr/local/gd

# make

# make  install

 

1.3.3 zlib

zlib homepage : http://www.zlib.net/

 

# wget  http://www.zlib.net/zlib-1.2.3.tar.gz

# tar  xvzf  zlib-1.2.3.tar.gz

# mv  zlib-1.2.3  /usr/local/zlib

# cd  /usr/local/zlib

# ./configure

# make

# make  test

# make  install

 

1.3.4 libpng

libpng homepage : http://www.libpng.org/pub/png/libpng.html

 

# wget  ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.16.tar.gz

# tar  xvzf  libpng-1.2.16.tar.gz

# mv  libpng-1.2.16  /usr/local/libpng

# cd  /usr/local/libpng

# cp  scripts/makefile.linux  ./makefile

# make  test

# make  install

 

1.3.5 그래픽 프로그램 모듈화

# vi  /etc/ld.so.conf

/usr/local/gd/lib

/usr/local/zlib/lib

/usr/local/libpng/lib

/usr/local/jpeg/lib

# ldconfig

 

 

1.3.6 PHP

homepage : http://www.php.net/

 

# wget http://kr.php.net/distributions/php-5.2.1.tar.gz

# tar xvzf php-5.2.1.tar.gz

# cd php-5.2.1

# ./configure  --with-charset=euc_kr  --enable-so  \

> --with-apxs2=/usr/local/apache/bin/apxs  --with-mysql=/usr/local/mysql  \

> --enable-track-vars  --with-libxml-dir=/usr/local/libxml2  \

> --with-gd  --with-zlib  --with-png  --with-jpeg

# make

# make install

 

1.3.7 pear 설치

pear homepage : http://pear.veggerby.dk/

 

# lynx  -source  http://go-pear.org/  |  php

엔터 3번치고 Y를 한번 누르면 설치가 된다...(자세한건 직접~~ 설치 경로를 묻는 내용이다)

 

# pear  list  <- pear 설치 목록 출력

# pear  upgrade  <- pear 업그레이드 검사

 

 

1.3.8 기타 설정

# vi /usr/local/apache/conf/httpd.conf

- DirectoryIndex index.html

 index.php 파일을 초기 파일로 추가를 하려면 다음과 같이 변경하면 된다.

 DirectoryIndex index.html index.php

 

- LoadModule php5_module modules/libphp5.so

 위의 내용이 들어가 있어야 php 동작이 된다.

 

# cp  php.ini-dist  /usr/local/lib/php.ini

# cat  >  /usr/local/apache/htdocs/test.php

<?

Phpinfo();

?>

Crtl+D

 

웹브라우저에서 내용 확인

http://IP 주소/test.php

 

 

2. SNORT 설치

homepage : http://www.snort.org

 

# wget  http://www.snort.org/dl/current/snort-2.6.1.3.tar.gz

 tar  xvzf  snort-2.6.1.3.tar.gz

# cd snort-2.6.1.3

# ./configure  --with-mysql=/usr/local/mysql \

> --enable-dynamicplugin

# make

# make install

 

# useradd  snort  ?s  /sbin/nologin

# mkdir  -p  /etc/snort/rules

# mkdir  /var/log/snort

# cp  etc/*  /etc/snort

# vi  /etc/snort/snort.conf 

 

? var HOME_NET 222.102.15.0/24

자신의 네트워크 주소 입력

 

? var RULE_PATH /usr/local/snort/etc/rules  

snort 파 일이 있는 경로 입력

 

? output database : log, mysql, user=”snort” password=”snort123” dbname=”snort” host=”localhost”

snort에 서 탐지한 데이터가 저장될 정보 입 력(mysql에 저장 하기 위한 방법)

 

 

2.1 snortrules 설치

# cd  /etc/snort

# tar  xvzf  snortrules-snapshot-2.4.tar.gz

 

2.1.1 mysql 설정

# mysql -u root -p비밀번호

> create database snort;

> grant select, insert, update, delete, create on snort.* to snort@localhost;

> set password for snort@localhost=password('snort123’);

> quit

 

2.2 mysql에 snort에서 사용할 table 생성

./mysql -u snort ?psnort123 < /usr/local/snort/schemas/create_mysql  snort

 

 

3. ADODB 설치

adodb homepage : http://sourceforge.net/projects/adodb/

 

# wget  http://easynews.dl.sourceforge.net/sourceforge/adodb/adodb494.tgz

# tar  xvzf  adodb494.tgz

# mv  adodb  /usr/local/apache/

 

 

4. BASE 설치

BASE homepage : http://sourceforge.net/projects/secureideas

 

# wget  http://surfnet.dl.sourceforge.net/sourceforge/secureideas/base-1.3.5.tar.gz

# tar  xvzf base-1.3.5.tar.gz

# mv  base-1.3.5  /usr/local/apache/base

 

# cd  /usr/local/apache/htdocs/base

# cp  base_conf.php.dist  base_conf.php

# vi  base_conf.php

 

$BASE_urlpath = ‘/base’

$DBtype = ‘mysql’;

$alert_dbname   = ‘snort’;

$alert_host     = ‘localhost’;

$alert_user     = ‘snort’;

$alert_password = ‘snort123’;

 

* 1.3.5버전의 BASE를 사용할 경우

# vi  base_qry_common.php

위 파일의 빈줄을 모두 삭제하라... 어디인지는 모르지만... 널문자가 들어가서 에러가 발생한다...

그렇지 않으면 이미지가 하나도 않나온다...

 

 

5. oinkmaster 설치

oinkmaster homepage : http://oinkmaster.sourceforge.net/

 

# wget http://nchc.dl.sourceforge.net/sourceforge/oinkmaster/oinkmaster-2.0.tar.gz

# tar  xvzf  oinkmaster-2.0.tar.gz

 

# cd  oinkmaster-2.0

# cp  oinkmaster.pl  /usr/local/sbin

# cp  oinkmaster.conf  /etc/snort

# cd  contrib

# makesindex.pl  /etc/snort/rules/  >  autodisables.conf

# cp  autodisables.conf  /etc/snort

# cd  /etc/snort

# vi  oinkmaster.conf

# chown  -R  snort.snort  /etc/snort/

 

# oinkmaster.pl -o /etc/snort/rules/  -C /etc/snort/oinkmaster.conf  \

>  -C /etc/snort/autodisables.conf

 

 

6. SNORT 실행

# snort  -c  /etc/snort/snort.conf  -D  -N 

 

 

** 규칙 생성

1.트래픽 모니터링
구글에서 검색할 경우
/search?complete=1&hl=ko&q=snort&lr=
/search?complete=1&hl=ko&newwindow=1&q=snort&btnG=%EA%B2%80%EC%83%89&lr=&oq=f
/search?q=snort&btnG=%EA%B2%80%EC%83%89&complete=1&hl=ko&newwindow=1

2.규칙 생성
alert tcp $HOME_NET any -> any 80 (msg:"Google Search"; content:"";)

(msg:"Google Search"; content:"/search?";) (세모)
(msg:"Google Search"; content:"GET /search?";) (o)
(msg:"Google Search"; uricontent:"/search?";) (o)
(msg:"Google Search"; uricontent:"GET /search?";) (x)

3.규칙 파일 작성
# vi /usr/local/snort/etc/ruels/google.rules
alert tcp $HOME_NET any -> any 80 (msg:"Google Search[content]"; content:"GET /search?"; flow:from_client;)

alert tcp $HOME_NET any -> any 80 (msg:"Google Search[uricontent]"; uricontent:"/search?"; flow:from_client;)

4.snort.conf 파일에 새로 작성 규칙을 포함
include $RULE_PATH/google.rules

5.snort 재시작
# /etc/rc.d/init.d/snortd restart
Starting snort: [FAILED]
# tail /var/log/messages
FATAL ERROR: /usr/local/snort/etc/rules/google.rules(1) => Each rule must contain a Rule-sid --> 각 규칙마다 sid가 필요하다.
# vi google.rules
alert tcp $HOME_NET any -> any 80 (msg:"Google Search[content]"; content:"GET /search?"; flow:from_client; sid:1100000;)
alert tcp $HOME_NET any -> any 80 (msg:"Google Search[uricontent]"; uricontent:"/search?"; flow:from_client; sid:1110000;)

6.구글 검색 후에 /usr/local/snort/var/log/alert 파일 확인

 

### BASE 웹 인터페이스에서 그래프 사용

# vi ~/.bash_profile
PATH에서 /usr/local/php/bin 추가
# . ~/.bash_profile
# pear install Image_Canvas-alpha
# pear install Numbers_Roman
# pear install Numbers_Words-beta
# pear install Image_Graph-alpha

 

### BASE에서 portscan에 관련된 내용만 따로 볼 수 있도록 하는 설정

# vi /usr/local/snort/etc/snort/snort.conf
641라인부터 sfportscan 전처리기에 관련된 옵션에 다음 옵션을 추가

logfile { portscan.log }

# /etc/rc.d/init.d/snortd restart
snort를 재시작하면 /usr/local/snort/var/log/portscan.log라는 파일이 생성

# cd /usr/local/httpd/htdocs/base
# vi base_conf.php
240라인에 portscan 파일에 대한 경로 지정
$portscan_file = '/usr/local/snort/var/log/portscan.log';


### nmap을 이용한 스캐닝 실습

# wget http://download.insecure.org/nmap/dist/nmap-4.20.tar.bz2
# tar jxf nmap-4.20.tar.bz2
# cd nmap-4.20
# ./configure --prefix=/usr/local/nmap --without-nmapfe && make && make install

# nmap 짝궁IP
# nmap -sS -O -P0 짝궁IP
# nmap -sF 짝궁IP
# nmap -e eth0 -P0 -S 9.9.9.9 짝궁IP  이더넷 아이피 스푸핑 변조

Who's l2zeo

profile

I see no changes, wake up in the morning and I ask myself

Is life worth living should I blast myself

Things would never be the same.


List of Articles
번호 제목 글쓴이 날짜 조회 수
88 64bit 시스템에 ssl 설치 후 실행 시 X509_free 오류 ADMINPLAY 2008.10.07 15509
87 서비스 동시접속 인원알기 ADMINPLAY 2008.10.07 16894
86 사이트가 느려지는 현상 점검 ADMINPLAY 2008.10.08 15935
85 apache 2.0.x , 2.2.x 버전대 max client 값 수정시 ADMINPLAY 2008.10.08 14801
84 아파치 특정폴더에 암호걸기 ADMINPLAY 2008.10.08 16034
83 httpd.conf 파일에 대한 설명 / 번역 ADMINPLAY 2008.10.08 14198
82 Apache 최적화 ADMINPLAY 2008.11.11 15771
81 아파치 모듈 내용 ADMINPLAY 2008.12.10 15908
80 apache log 정리 ADMINPLAY 2008.12.14 13530
79 CGI 오류: Premature end of script headers (Internal Se... 1 ADMINPLAY 2008.12.14 14129
78 Apache 버전확인 ADMINPLAY 2008.12.23 15430
77 AWSTATS 설치 ADMINPLAY 2008.12.25 23862
76 AWSTATS 국가별 사용자 분석 ADMINPLAY 2008.12.25 14465
75 웹페이지에서 한글이 깨지는 현상 막기 ADMINPLAY 2009.01.03 16530
74 Apache 웹페이지 한글깨짐, AddDefaultsCharset 설정 file ADMINPLAY 2009.01.03 30522
73 Address already in use: make_sock:could not bind to ad... ADMINPLAY 2009.01.10 23800
72 CGI 퍼미션 으로 웹페이지 열리지 않음 ADMINPLAY 2009.01.12 14676
71 아파치 2.X 버전에서 mod_cband를 이용한 트래픽관리 file ADMINPLAY 2009.01.17 19036
70 RedirectMatch (도메인포워딩) ADMINPLAY 2009.01.23 15437
69 리눅스 APM 소스설치시 에러에 대한 대처 1 ADMINPLAY 2009.01.30 15134
Board Pagination Prev 1 2 3 4 5 Next
/ 5

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234