'루트킷'에 해당되는 글 1건

  1. 2008.07.06 linux - AIDE ( 호스트 기반의 침입탐지 시스템)
2008. 7. 6. 19:04

linux - AIDE ( 호스트 기반의 침입탐지 시스템)

linux - AIDE ( 호스트 기반의 침입탐지 시스템)

시스템에 설치된 파일 및 디렉토리의 무결성을 검사하는 프로그램으로 변견된 사항을 추적 할 수 있으며 파일, 디렉토리의 크기와 날짜, inode, 해시코드 등의 정보를 기록하고 해킹이나 시스템의 이상징후가 있을 경우 서버를 검색하여 이전의 검색과 비교대조를 한후 변경 내용을 출력해 준다.


[fedora]에서 아래 처럼 다운로드

[root@fedora tmp]# wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.tar.bz2
[root@fedora tmp]# wget http://downloads.sourceforge.net/aide/aide-0.13.1.tar.gz
[root@fedora tmp]# mkdir /root/hids
[root@fedora tmp]# mv aide-0.13.1.tar.gz mhash-0.9.9.tar.bz2 /root/hids/
[root@fedora tmp]# cd /root/hids

압축 해제
[root@fedora hids]# tar xvzf aide-0.13.1.tar.gz
[root@fedora hids]# tar xvjf mhash-0.9.9.tar.bz2
[root@fedora aide-0.13.1]# cd ..
[root@fedora hids]# cd mhash-0.9.9
[root@fedora mhash-0.9.9]# ./configure && make && make install     // 컴파일 동시에 설치까지
[root@fedora mhash-0.9.9]# echo $?     // 잘 실행 되었는지 보자 0  이 나오면 정상실행되었다.
0


마찬 가지로 aide도 설치 하자

[root@fedora hids]# cd aide-0.13.1
[root@fedora aide-0.13.1]# ls
AUTHORS               Makefile.in      aclocal.m4    depcomp        src
COPYING               NEWS             aide.spec.in  doc            version.m4
ChangeLog             README           config.h.in   include        ylwrap
INSTALL               README-snprintf  configure     install-sh
LICENSE-snprintf.txt  Todo             configure.in  missing
Makefile.am           acinclude.m4     contrib       mkinstalldirs
[root@fedora aide-0.13.1]# ./configure && make && make install            // configure -> make -> make install 동시에


[root@fedora mhash-0.9.9]# which aide
/usr/local/bin/aide
[root@fedora mhash-0.9.9]# ls /root/hids/aide-0.13.1/doc    // aide.conf 파일이 있는지 확인
Makefile     Makefile.in  aide.1.in  aide.conf.5     aide.conf.in
Makefile.am  aide.1       aide.conf  aide.conf.5.in  manual.html

[root@fedora mhash-0.9.9]# cp /root/hids/aide-0.13.1/doc/aide.conf /root/hids
[root@fedora mhash-0.9.9]# cp /root/hids/aide-0.13.1/doc/aide.conf /root/hids
[root@fedora mhash-0.9.9]# cd ..

[root@fedora hids]# vi aide.conf
     22 @@define TOPDIR ..     ->      22 @@define TOPDIR /root/hids        // 디렉토리 지정
 46 database=file:@@{TOPDIR}/doc/aide.db      ->       database=fiel:/root/hids/aide.db    // 디비파일 정의
51 database_out=file:aide.db.new     -> database_out=file:aide.db      // 출력 파일 정의
137 /etc R    //추가,  DB화 시킬 디렉토리 설정 /etc


[root@fedora hids]# aide -c aide.conf -i
118:Error in expression:selinux
   // 에러가 날 수 있다. aide.conf 의 118번재 라인의 해당 에러 구문을 삭제후 재실행
Configuration error
[root@fedora hids]# aide -c aide.conf -i
118:Error in expression:xattrs
Configuration error
[root@fedora hids]# vi aide.conf
[root@fedora hids]# aide -c aide.conf -i
118:Error in expression:xattrs
Configuration error
[root@fedora hids]# vi aide.conf
[root@fedora hids]# aide -c aide.conf -i
// -i    데이터 베이스 생성
// -C  aide를 사용하여 백업된 database와 비교
// -c  설정 파일

AIDE, version 0.13.1

### AIDE database at aide.db initialized.                            // 완료 되었다.

test하기

   
[root@fedora hids]# seq 10 > /etc/.virus
                                                    // 자 이러면 /etc/ 밑에 새로운 파일이 생성되어 내용이 바뀌었을 것이다.
                                                    // aide를 이용해 검증 시켜 보자
[root@fedora hids]# aide -c /root/hids/aide.conf -C
AIDE found differences between database and filesystem!!
Start timestamp: 2008-07-05 21:47:53

Summary:
  Total number of files:        2043
  Added files:                  1
  Removed files:                0
  Changed files:                1


---------------------------------------------------
Added files:
---------------------------------------------------

added: /etc/.virus

---------------------------------------------------
Changed files:
---------------------------------------------------

changed: /etc

--------------------------------------------------
Detailed information about changes:
---------------------------------------------------


Directory: /etc
  Mtime    : 2008-07-05 21:08:21              , 2008-07-05 21:47:22
  Ctime    : 2008-07-05 21:08:21              , 2008-07-05 21:47:22
[root@fedora hids]# vi aide.conf                 // 중요하다고 생각되는 디렉토리 추가 시켜 보자


루트킷