[보안] 파일 무결성 검사 ( Tripwire 설치 사용법 )

### 파일의 무결성 검사 도구 TRIPWIRE 사용법  ###

———————————————————————

작성자 : 서진우 (alang at

sysmng.com)

———————————————————————

tripwire 은 원래 리눅스가 아닌 유닉스 플랫폼에서 설계되어 왔으나 현재

리눅스 유닉스 폼에서 파일 무결성 검사도구로 사용중이당..

트립와이어는 시스템 파일등의 변조및 추가등을 검사합으로써..해킹의도를

파악할수 있는 보안 도구 입니다.

설치전 몇가지 알아 두어야 할점이 있당..

검사도구는 시스템 설치후에 바로 설치해야 의미가 있다..이미 해킹당한

상태에서 설치 해 보아야 검사도구엔 발견 되지 않는다…초기에 아주 깨

끗한 상태에서 시스템 파일 정보들을 DB file 로 만들어 놓고 앞으로 변

화되는 상황을 지켜 보아야 한다.

그리고 시스템 정보가 저장될 DB file 이 다른 사람에게 접근을 허용하면

안된다… 이두가지만 철저하게 지키면 아주 유용한 보안 도구로 사용이

가능하다…이제 설치에 들어가 보도록 하자..

1. 트립와이어 설치

먼저 일정한 디렉토리에 임시 디렉토리를 만든다..

[root@zzang911 src]# mkdir tripw

소스 파일을 안에다 넣어 두고 압축을 푼다.

[root@zzang911 tripw]# tar xzvf Tripwire_221_for_Linux_x86.tar

—————————————————————-

License.txt

README

Release_Notes

install.cfg

install.sh

pkg/

pkg/bin.pkg

pkg/man.pkg

pkg/policy.pkg

여기서 install.sh 는 설치 스크립트고 install.cfg 는 설정 파일이당.

설치전에 설치하고자 하는 디렉토리를 이파일에서 지정할수 있다..

그럼…install.cfg 파일을 잠시 살펴 보도록 하자..

[root@zzang911 tripw]# vi install.cfg

———————————————-

# If CLOBBER is false, existing files are not overwritten.

CLOBBER=false

이미 설치된 트립와이어 디렉토리가 존재할경우 CLOBBER 이 true 면

덮어 쓰는 거고 false 면 덮어 쓰지 않는거당..

# The root of the TSS directory tree.

TWROOT=”/usr/local/TSS”

이는 기본 설치 디렉토리를 지정하는 곳이다.

대충 이정도로….

이제 설치 스크립트를 실행 시켜 보자..

[root@zzang911 tripw]# ./install.sh

—————————————–

Installer program for:

Tripwire(R) 2.2.1 for Unix

Copyright (C) 1998-2000 Tripwire (R) Security Systems, Inc.  Tripwire (R)

is a registered trademark of the Purdue Research Foundation and is

licensed exclusively to Tripwire (R) Security Systems, Inc.

.

.

12. MISCELLANEOUS.

If any provision of this Agreement is held by a court of competent

jurisdiction to be unenforceable for any reason, the remaining

provisions hereof shall be unaffected and remain in full force and

effect. This Agreement is the final, complete and exclusive agreement

between the parties relating to the scope of license rights, warranties,

liability limitations, choice of law, and the other issues addressed

herein, and supersedes all prior and contemporaneous understandings and

agreements relating to such subject matter, whether oral or written.

Should you have any questions concerning this Agreement, or if you

desire to contact Tripwire Security Systems, Inc. for any reason, please

contact us at: Tripwire Security Systems, Inc., 1631 NW Thurman St.,

Portland, OR 97209-2518, USA, http://www.tripwiresecurity.com/.

Please type “accept” to indicate your acceptance of this

license agreement. [do not accept]

라이센스에 동의 할거냐는 질문이다..여기서 “accept” 라고 치고 enter.

Checking for programs specified in install configuration file….

/usr/lib/sendmail exists.  Continuing installation.

/bin/vi exists.  Continuing installation.

This program will copy Tripwire files to the following directories:

       TWROOT: /usr/local/TSS

        TWBIN: /usr/local/TSS/bin

        TWMAN: /usr/local/TSS/man

     TWPOLICY: /usr/local/TSS/policy

     TWREPORT: /usr/local/TSS/report

         TWDB: /usr/local/TSS/db

TWSITEKEYDIR: /usr/local/TSS/key

TWLOCALKEYDIR: /usr/local/TSS/key

CLOBBER is false.

Continue with installation? [y/n]

그럼…메일러 위치와 설치 디렉토리 위치등을 다시 확인 한다. y 를 치고 enter.

그러면 파일등이 copy 가 된다. 그런뒤 패스프레이즈를 생성한다.

Creating key files…

(When selecting a passphrase, keep in mind that good passphrases typically

have upper and lower case letters, digits and punctuation marks, and are

at least 8 characters in length.)

Enter the site keyfile passphrase:

Verify the site keyfile passphrase:

패스프래이즈를 입력한다. 보안도구 실행권한을 인증하는 패스워드라고 생각하면 된다.

다시 local key passphrase 와 site key passphrase 를 물어 본다.

(When selecting a passphrase, keep in mind that good passphrases typically

have upper and lower case letters, digits and punctuation marks, and are

at least 8 characters in length.)

Enter the local keyfile passphrase:

Verify the local keyfile passphrase:

.

.

Creating signed configuration file…

Please enter your site passphrase:

Wrote configuration file: /usr/local/TSS/bin/tw.cfg

———————————————-

The installation succeeded.

Please refer to /usr/local/TSS/Release_Notes

for release information and to the printed user documentation

for further instructions on using Tripwire 2.2.1 for Unix.

이로써 설치가 완료 된다.

이제 트립와이어가 설치된 곳으로 가시 실행준비를 해보도록 하자..

[root@zzang911 tripw]# cd /usr/local/TSS/bin

다음과 같은 명령을 실행 시키도록 하자.

[root@zzang911 bin]# ./twadmin –create-cfgfile –site-keyfile ../key/site.key twcfg.txt

Please enter your site passphrase: 설치시 입력한 site passphrase 를 입력한다.

Wrote configuration file: /usr/local/TSS/bin/tw.cfg

정책 파일을 갱신 하도록 하자.

[root@zzang911 bin]# ./twadmin –create-polfile ../policy/twpol.txt

——————————————————————–

lease enter your site passphrase:

Wrote policy file: /usr/local/TSS/policy/tw.pol

트립와이어에 데이터베이스를 만들 모든 준비가 완료 되었다.

다음 명령을 실행하자.

[root@zzang911 bin]# ./tripwire –init

————————————————————–

Please enter your local passphrase:

Generating the database…

*** Processing Unix File System ***

### Warning: File system error.

### Filename: /proc/rtc

### 그런 파일이나 디렉토리가 없음

### Continuing…

### Warning: File system error.

### Filename: /proc/mdstat

### 그런 파일이나 디렉토리가 없음

### Continuing…

### Warning: File system error.

### Filename: /usr/local/bin/ssh1

### 그런 파일이나 디렉토리가 없음

### Continuing…

### Warning: File system error.

### Filename: /usr/local/bin/ssh-signer2

### 그런 파일이나 디렉토리가 없음

### Continuing…

위와 같이 데이터베이스를 생성하면 not found file 와 같은 에러가 난다.

이는 정책파일안에 규칙이 현 시스템과 맞지 않아서 이다. 트립와이어는

앞에서 말했듯이 유닉스 플랙폼 기반으로 만들어져 있다. 그래서 체크해야할

설정 파일의 위치가 유닉스 기반으로 되어져 있다. 이는 정책파일을 수정함

으로써 해결이 된다. 우선 이런 에러가 나면 에러 부분을 잘 체크 해 두었다가

/usr/local/TSS/policy/twpol.txt 파일에 들어가서 시스템에서 사용하는 파일

중 경로가 틀린 부분은 수정해주고 유닉스 기반의 경로 파일 같은 경우는

삭제 하도록 하면 된다. 그런뒤 다시 정책파일등을 갱신 하면 에러를 없앨수

있다…이런 에러를 수정하지 않으면 트립와이어를 실행할때 마다 나타나므로

초기에 수정하는것이 관리상 편리하다.

실행이 완료되면 다시 정책파일등을 갱신한다.

[root@zzang911 bin]# ./twadmin –create-cfgfile –site-keyfile ../key/site.key twcfg.txt

[root@zzang911 bin]# ./twadmin –create-polfile ../policy/twpol.txt

[root@zzang911 bin]# ./tripwire –init

——————————————————-

Please enter your local passphrase:

Parsing policy file: /usr/local/TSS/policy/tw.pol

Generating the database…

*** Processing Unix File System ***

Wrote database file: /usr/local/TSS/db/zzang911.net.twd

The database was successfully generated.

이로써 데이터파일의 생성이 완료 되었습니다. 이제 기본적으로 파일을 하나 변경

하고 난뒤 파일의 무결성을 검사 해 보도록 하자.

[root@zzang911 bin]# ./tripwire –check

검사 리포트를 한번 살펴 보자.

———————————————————

Wrote report file: /usr/local/TSS/report/zzang911.net-20001118-122106.twr

Tripwire(R) 2.2.1 Integrity Check Report

Report generated by:          root

Report created on:            2000년 11월 18일 토요일 오후 12시 21분 06초

Database last updated on:     Never

Report created on:            2000년 11월 18일 토요일 오후 12시 21분 06초

Database last updated on:     Never

===============================================================================

Report Summary:

===============================================================================

Host name:                    zzang911.net

Host IP address:              210.220.69.135

Host ID:                      dcd28745

Policy file used:             /usr/local/TSS/policy/tw.pol

Configuration file used:      /usr/local/TSS/bin/tw.cfg

Database file used:           /usr/local/TSS/db/zzang911.net.twd

Command line used:            ./tripwire –check

===============================================================================

Rule Summary:

===============================================================================

——————————————————————————-

  Section: Unix File System

——————————————————————————-

  Rule Name                       Severity Level    Added    Removed  Modified

  ———                       ————–    —–    ——-  ——–

  Invariant Directories           66                0        0        0

* Tripwire Data Files             100               1        0        0

  Temporary directories           33                0        0        0

  Critical devices                100               0        0        0

  Tripwire Binaries               100               0        0        0

  User binaries                   66                0        0        0

  Libraries                       66                0        0        0

  Configuration Files             0                 0        0        0

  setuid/setgid                   100               0        0        0

  OS executables and libraries    100               0        0        0

  Shell Binaries                  0                 0        0        0

  Critical configuration files    100               0        0        0

  Security Control                0                 0        0        0

  Login Scripts                   0                 0        0        0

  System boot changes             100               0        0        0

  Critical system boot files      100               0        0        0

  (/boot)

* Root config files               100               0        0        2

Total objects scanned:  25123

Total violations found:  3

===============================================================================

Object Summary:

===============================================================================

——————————————————————————-

# Section: Unix File System

——————————————————————————-

——————————————————————————-

Rule Name: Tripwire Data Files (/usr/local/TSS/db)

Severity Level: 100

——————————————————————————-

Added:

“/usr/local/TSS/db/zzang911.net.twd.bak”

——————————————————————————-

Rule Name: Root config files (/root)

Severity Level: 100

——————————————————————————-

Modified:

“/root”

“/root/suid”

===============================================================================

Error Report:

===============================================================================

——————————————————————————-

  Section: Unix File System

——————————————————————————-

1.   File system error.

     Filename: /usr/local/lib/smb.conf

     그런 파일이나 디렉토리가 없음

2.   File system error.

     Filename: /var/lock/subsys/portmap

     그런 파일이나 디렉토리가 없음

3.   File system error.

     Filename: /.automount

     그런 파일이나 디렉토리가 없음

——————————————————————————-

*** End of report ***

여기서 변경된 파일 하나를 찾을 수 있다.

Modified:

“/root”

“/root/suid”

참고:

리눅스에서 프로그램은 주로 RPM 방식으로 설치된다. RPM 방식으로 설치된 파일의

무결성을 검사하기 위한 간단한 방법으론 -v 옵션을 사용하면 된다.

악의적으로 파일을 심어 놓는 것은 분명 보안상의 위험요소이다. TRIPWIRE 는 이런

공격의 대비책으로 유용하다. 앞에 언급했듯이 이미 악으적인 코드가 심겨진 상태

에서 트립와이어를 설치하는것은 아무런 의미가 없다. 리눅스를 설치한 직후에 바로

설치하는것이 가장 좋은 대비책이다.

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

1 Response

  1. Hacklink 말해보세요:

    Everything is very open and very clear explanation of issues. was truly information.

페이스북/트위트/구글 계정으로 댓글 가능합니다.