Skip to content

조회 수 20946 추천 수 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
번호 제목 글쓴이 날짜 조회 수
68 Apache 2.2.17 (mod_url 하고 mod_rewrite 충돌) file ADMINPLAY 2011.08.18 20546
67 트래픽분석툴(mod_throttle) 설치 및 설정 - apache1.3.x ... file ADMINPLAY 2010.05.03 20178
66 KeepAlive 설정 및 정의 ADMINPLAY 2012.01.16 20038
65 Apache 2.2.21 패치 (mod_proxy_ajp 패치와 apache killer... ADMINPLAY 2012.01.16 19807
64 [Apache] MPM(Prefork VS Worker) ADMINPLAY 2012.01.16 19784
63 아파치 컴파일 에러(apr-util) configure: error: cannet ... ADMINPLAY 2009.08.08 19738
62 apache + oracle (오라클 DB 한글깨짐) ADMINPLAY 2010.02.24 19733
61 apache server 2.2, Tomcat5.5 로드밸런싱 및 클러스터 ADMINPLAY 2009.12.10 19291
60 mod_gzip, mod_deflate ADMINPLAY 2010.07.29 19254
59 아파치 2.X 버전에서 mod_cband를 이용한 트래픽관리 file ADMINPLAY 2009.01.17 19201
58 아파치(apache) 무단 링크 방지 ADMINPLAY 2011.06.18 19133
57 웹방화벽 ModSecurity 룰적용 순서 file l2zeo 2010.05.29 19058
56 아파치 GeoIP를 이용한 국가별 제한 ADMINPLAY 2010.01.30 18965
55 Apache - 도메인 포워딩 ADMINPLAY 2010.08.26 18958
54 xcache 설치 (xcache-1.2.2.tar.gz) file ADMINPLAY 2009.03.17 18482
53 squid 로 웹서버 가속하기..---== 강추 ==--- ADMINPLAY 2009.11.26 18364
52 Apache Make시 /usr/lib/libexpat.so: could not read sym... ADMINPLAY 2009.08.07 18075
51 (간단한 팁) 우분투에 Apache2 설치하기 ( apt-get ) 로키 2012.04.01 17778
50 apache가 worker 모드인지 prefork 모드로 동작하는지 확인 1 file l2zeo 2013.01.21 17700
49 아파치에서 한글 파일 읽기 [mod_url 설치] file ADMINPLAY 2009.03.17 17443
Board Pagination Prev 1 2 3 4 5 Next
/ 5

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234