tripwire¼³Ä¡ ¹× ¿î¿µ°¡À̵å

2001. 11.

ÀåÀ±¼÷, jys@certcc.or.kr

 

1. °³¿ä

°ø°ÝÀÚ°¡ ½Ã½ºÅÛ Ä§ÀÔ¿¡ ¼º°øÇÏ¸é ´ÙÀ½¹ø ħÀÔÀ» ½±°Ô ÇϱâÀ§ÇØ ·çƮŶ(rootkit)À̳ª Æ®·ÎÀÌÀÜ ¸ñ¸¶(trojan horse)ÇÁ·Î±×·¥À» ¼³Ä¡ÇÏ´Â °æ¿ì°¡ ´ëºÎºÐÀÌ´Ù.

·çƮŶ¿¡ Æ÷ÇԵǴ ÇÁ·Î±×·¥À¸·Î´Â ps, ls, netstat, loginµîÀÇ ½Ã½ºÅÛ ÇÁ·Î±×·¥µéÀÌ Àִµ¥, ÀÌ·± ·çƮŶÀº ½Ã½ºÅÛ¿¡ ¿ø·¡ ÀÖ¾ú´ø ÇÁ·Î±×·¥µé°ú ¹Ù²ãÄ¡±âµÇ¼­ °ü¸®ÀÚ°¡ ½Ã½ºÅÛÀ» Á¡°ËÇØµµ ÀÌ»ó¾ø°Ô º¸À̵µ·Ï ÇÏ°í °ø°ÝÀÚÀÇ ÇൿÀ» ¼û±â±âµµ ÇÑ´Ù.

¿¹¸¦ µé¾î ps¸¦ ¹Ù²ãÄ¡±â ÇØ¼­ ½Ã½ºÅÛ °ü¸®ÀÚ°¡ ps¸¦ ½ÇÇà½ÃÄѵµ °ø°ÝÀÚ°¡ ½ÇÇàÇÑ ÇÁ·Î±×·¥Àº º¸ÀÌÁö ¾Ê°Ô ÇÑ´ÙµçÁö, ls¸¦ ¹Ù²ãÄ¡±â ÇØ¼­ ls·Î º¸´õ¶óµµ °ø°ÝÀÚ°¡ ¸¸µç ÆÄÀÏÀº º¸ÀÌÁö ¾Êµµ·Ï ÇÏ´Â °ÍÀÌ´Ù.

¶ÇÇÑ °ø°ÝÀÚ´Â °ø°ÝÀÌ ¼º°øÇÑ ÈÄ ½Ã½ºÅÛÀÇ Ãë¾àÁ¡À» ã¾Æ¼­ ÆÐÄ¡¸¦ ÇØ¼­ ´Ù¸¥ °ø°ÝÀÚ°¡ µé¾î¿À´Â °ÍÀ» ¸·±âµµ ÇÑ´Ù.

ÀÌ·¸°Ô ħÀÔ ´çÇÑ ½Ã½ºÅÛ¿¡¼­ ¾î¶² ÆÄÀÏÀ̳ª µð·ºÅ丮°¡ ¼öÁ¤, º¯Á¶µÇ¾ú´ÂÁö µîÀ» ã´Â °ÍÀÌ ½±Áö¸¸Àº ¾Ê´Ù. Ȥ ÆÄÀÏÀÇ Å©±â³ª ¼öÁ¤µÈ ½Ã°£, »ý¼ºµÈ ½Ã°£ µîÀ» ºñ±³ÇÏ¿© ¾Ë¾Æ³½´Ù°í ÇÒÁö¶óµµ ÆÄÀÏÀÇ Å©±â³ª ½Ã°£Á¤º¸ Á¶Â÷µµ º¯Á¶°¡ °¡´ÉÇϹǷΠÀ̸¦ ¹ÏÀ» ¼ö ¾ø´Ù.

µû¶ó¼­ ¿ø·¡ ÆÄÀÏÀÇ ¹«°á¼ºÀ» üũÇÒ ¼ö ÀÖ´Â ÇÁ·Î±×·¥ÀÌ ÇÊ¿äÇÒ °ÍÀ̰í, À̸¦ È¿À²ÀûÀ¸·Î ÇØÁÖ´Â µµ±¸°¡ ¹Ù·Î tripwireÀÌ´Ù.

tripwire´Â MD5, SHA, CRC-32µîÀÇ ´Ù¾çÇÑ ÇØ½¬ ÇÔ¼ö¸¦ Á¦°øÇϰí, ÆÄÀϵ鿡 ´ëÇÑ µ¥ÀÌÅͺ£À̽º¸¦ ¸¸µé¾î À̸¦ ÅëÇØ ÇØÄ¿µé¿¡ ÀÇÇÑ ÆÄÀϵéÀÇ º¯Á¶¿©ºÎ¸¦ ÆÇº°ÇϹǷΠ°ü¸®ÀÚµéÀÌ À¯¿ëÇÏ°Ô »ç¿ëÇÒ ¼ö ÀÖ´Ù.

tripwire´Â ¸ÕÀú ½Ã½ºÅÛ¿¡ Á¸ÀçÇÏ´Â ÆÄÀÏ¿¡ ´ëÇØ µ¥ÀÌÅÍ º£À̽º¸¦ ¸¸µé¾î ÀúÀåÇÑ ÈÄ »ý¼ºµÈ µ¥ÀÌÅͺ£À̽º¿Í ºñ±³ÇÏ¿© Ãß°¡¡¤»èÁ¦µÇ°Å³ª º¯Á¶µÈ ÆÄÀÏÀÌ ÀÖ´ÂÁö Á¡°ËÇÏ°í °ü¸®ÀÚ¿¡°Ô ·¹Æ÷ÆÃÇØÁÖ´Â ¹«°á¼º °Ë»çµµ±¸ÀÌ´Ù.

Top

2. tripwire ±¸Çϱâ

tripwire´Â 1992³â Purdue UniversityÀÇ Dr. Eugene Spafford¿Í Gene Kim¿¡ ÀÇÇØ °³¹ßµÇ¾ú´Ù. ÃʱâÀÇ tripwire 1.x´Â ¿ÀǼҽºÀ̾úÀ¸³ª 2.x·Î ¿À¸é¼­ tripwire»ç¿¡¼­ »ó¿ëÈ­ÇÏ¿© ¹ßÇ¥Çϰí tripwire 1.3´ëÀÇ ASR(Academic Source Release)¿¡ ´ëÇØ¼­´Â °ø°³·Î ¹èÆ÷Çϰí ÀÖ´Ù.

¶ÇÇÑ tripwire»ç¿¡¼­´Â tripwire ¿ÀǼҽº ÇÁ·ÎÁ§Æ®¸¦ ÃßÁøÇÏ¿© Linux ½Ã½ºÅÛ¿¡¼­´Â Open Source·Î 2.3´ëÀÇ tripwire¸¦ ´Ù¿î¹Þ¾Æ ¼³Ä¡ÇÒ¼ö ÀÖ´Ù. (http://www.tripwire.org) ±×·¯³ª Solaris, Windows NT, HP-UX, IBM AIX ½Ã½ºÅÛ¿¡¼­ 2.x¸¦ ¼³Ä¡ÇÏ·Á¸é »ó¾÷¿ë ¹öÀüÀ» ÀÌ¿ëÇÏ¿©¾ß ÇÑ´Ù. (http://www.tripwire.com)

Linux 7.x ½Ã½ºÅÛÀÇ °æ¿ì ´ëºÎºÐ tripwire°¡ ¼³Ä¡µÇ¾î Àֱ⠶§¹®¿¡ ´Ù¿î¹ÞÁö ¾Ê°í ¼³Ä¡ÇÒ¼ö ÀÖÀ¸¸ç, º»ÀÎÀº ¸®´ª½º Linux7.0 ȯ°æ¿¡¼­ tripwire-2.3 ¹öÀüÀ» ¼³Ä¡ ¹× Å×½ºÆ®ÇÏ¿´´Ù.

¼³Ä¡¿©ºÎ³ª ¼³Ä¡µÈ ¹öÀüÀ» È®ÀÎÇϰíÀÚ ÇÏ´Â °æ¿ì¿¡´Â ´ÙÀ½ ¸í·ÉÀ» ÀÌ¿ëÇÑ´Ù.

rpm -qa | grep tripwire

¸¸¾à ½Ã½ºÅÛ¿¡ ¼³Ä¡µÇ¾î ÀÖÁö ¾Ê´Ù¸é tripwire ÇÁ·Î±×·¥(http://www.tripwire.org)À» ´Ù¿î¹Þ¾Æ ¼³Ä¡ÇÑ´Ù.

Top

3. tripwire ¼³Ä¡

¿©±â¼­´Â rpm·Î Á¦°øµÇ´Â 2.3¹öÀüÀ» Linux 7.0¿¡ ¼³Ä¡ÇÒ°ÍÀÌ´Ù.

tripwire¸¦ rpmÀ¸·Î ¼³Ä¡ÇÒ °æ¿ì ¼³Ä¡°úÁ¤Àº Å©°Ô ´ÙÀ½ÀÇ 4´Ü°è·Î º¼ ¼ö ÀÖ´Ù.

1. tripwire ¼³Á¤ÆÄÀÏ¡¤Á¤Ã¥ÆÄÀÏ »ý¼ºÇϱâ(twinstall.sh)
2. µ¥ÀÌÅͺ£À̽º ÃʱâÈ­ (tripwire --init)
3. ¹«°á¼º °Ë»ç (tripwire --check)
4. µ¥ÀÌÅͺ£À̽º °»½Å(tripwire --update)

ÀÌÁ¦ º»°ÝÀûÀÎ ¼³Ä¡¿¡ ´ëÇØ »ìÆìº¸µµ·Ï ÇÏÀÚ.

¡á tripwire´Ù¿î¹Þ±â

http://www.tripwire.org¿¡¼­ ¿î¿µÇÏ´Â ½Ã½ºÅÛ¿¡ ¸Â´Â tripwire¸¦ rpmÀ¸·Î ´Ù¿î¹Þ´Â´Ù.

¡á ¾ÐÃàÇ®±â

´Ù¿î·Îµå¹ÞÀº ¾ÐÃà ÆÄÀÏÀ» Ǭ´Ù
# tar -xzvf tripwire-2.3-47.i386.tar.gz
¾ÐÃàÀ» Ç®¾î »ý±ä tripwire-2.3-47.i386.rpm ÆÐŰÁö ÆÄÀÏÀ» ¼³Ä¡ÇÑ´Ù.
# rpm -Uvh tripwire-2.3-47.i386.rpm
±âº»ÀûÀ¸·Î tripwire´Â /etc/tripwireµð·ºÅ丮¿¡ ¼³Ä¡µÈ´Ù.
/etc/tripwire µð·ºÅ丮¿¡ »ý¼ºµÇ´Â ÆÄÀÏÀÇ ³»¿ëÀ» º¸¸é ´ÙÀ½°ú °°´Ù.
-rwxr-xr-x 1 root root 603 6¿ù 22 03:02 twcfg.txt ======> ¼³Ä¡¸¦ À§ÇÑ È¯°æ¼³Á¤ÆÄÀÏ
-rwxr-xr-x 1 root root 10100 6¿ù 22 03:02 twinstall.sh ======> ¼³Ä¡½ºÅ©¸³Æ®
-rwxr-xr-x 1 root root 41255 6¿ù 22 03:02 twpol.txt ======> Á¤Ã¥ÆÄÀÏ

Top

¡á tripwire ¼³Á¤ÆÄÀÏ¡¤Á¤Ã¥ÆÄÀÏ »ý¼ºÇϱâ

# ./twinstall.sh
twinstall.sh¸¦ ½ÇÇà½Ã۸é tripwire´Â site keyfile°ú local keyfileÀ» »ý¼ºÇϱâ À§ÇÑ Passphrases¸¦ ÀÔ·ÂÇϵµ·Ï ÇÑ´Ù.
site keyfileÀº Á¤Ã¥ÆÄÀϰú ȯ°æÆÄÀÏÀ» ¼³Á¤Çϴµ¥ »ç¿ëµÇ°í, local keyfileÀº tripwire µ¥ÀÌÅͺ£À̽º¿Í ·¹Æ÷Æ® ÆÄÀÏÀ» ÃʱâÈ­ÇÏ°í º¸È£Çϴµ¥ »ç¿ëµÇ´Â ÀÏÁ¾ÀÇ ¾ÏÈ£ÀÇ ÀÏÁ¾ÀÌ´Ù. (passphrases´Â ÃÖ¼Ò 8ÀÚ ÀÌ»óÀÇ ¹®ÀÚ¿­À̾î¾ß ÇÑ´Ù.)
¼³Á¤ÆÄÀÏ¡¤Á¤Ã¥ÆÄÀÏÀ» »ý¼ºÇÏ´Â °úÁ¤À» »ìÆìº¸¸é ¾Æ·¡¿Í °°´Ù.

1) keyfile passphrase¸¦ »ý¼ºÇϱâ À§ÇØ ¸î °³ÀÇ passphrase¸¦ ¿ä±¸ÇÑ´Ù.

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.)

2) site keyfile passphrase¸¦ ÀÔ·ÂÇÏ¸é ´Ù½Ã Çѹø È®ÀÎÇϰí ۸¦ »ý¼ºÇÑ´Ù.

Enter the site keyfile passphrase:
Verify the site keyfile passphrase:
Generating key (this may take several minutes)...Key generation complete.
(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.)

Top

3) local keyfile passphrase¸¦ ÀÔ·ÂÇÏ¸é ´Ù½Ã Çѹø È®ÀÎÇϰí ۸¦ »ý¼ºÇÑ´Ù.

Enter the local keyfile passphrase:
Verify the local keyfile passphrase:
Generating key (this may take several minutes)...Key generation complete.
----------------------------------------------

4) site passphrase¸¦ ÀÌ¿ëÇÏ¿© configuration fileÀ» ¿Ï¼ºÇÑ´Ù.

Signing configuration file...
Please enter your site passphrase:
Wrote configuration file: /etc/tripwire/tw.cfg
A clear-text version of the Tripwire configuration file
/etc/tripwire/twcfg.txt
has been preserved for your inspection. It is recommended
that you delete this file manually after you have examined it.
----------------------------------------------

5) site passphrase¸¦ ÀÌ¿ëÇÏ¿© policy fileÀ» ¿Ï¼ºÇÑ´Ù.

´ÙÀ½ÀÇ policy fileÀÌ »ý¼ºµÇ¾ú´Ù´Â ¸Þ½ÃÁö¿Í ÇÔ²² ¼³Ä¡°¡ ³¡³ª°Ô µÈ´Ù.
Signing policy file...
Please enter your site passphrase:
Wrote policy file: /etc/tripwire/tw.pol
A clear-text version of the Tripwire policy file
/etc/tripwire/twpol.txt
has been preserved for your inspection. This implements
a minimal policy, intended only to test essential
Tripwire functionality. You should edit the policy file
to describe your system, and then use twadmin to generate
a new signed copy of the Tripwire policy.

Top

¡á µ¥ÀÌÅͺ£À̽º ÃʱâÈ­

´ÙÀ½ÀÇ ¸í·É¾î¸¦ ½ÇÇàÇÏ¿© µ¥ÀÌÅͺ£À̽º¸¦ ÃʱâÈ­ÇÑ´Ù. (/usr/sbin¿¡¼­)

# ./tripwire --init

À̶§ tripwire´Â local passphrase¸¦ ¿ä±¸ÇÑ´Ù.

Please enter your local passphrase:
Parsing policy file: /etc/tripwire/tw.pol

tripwire´Â µ¥ÀÌÅͺ£À̽º¸¦ »ý¼ºÇÏ°í ±× °á°ú¸¦ Ãâ·ÂÇÑ´Ù.

Generating the database...
*** Processing Unix File System ***
Wrote database file: /var/lib/tripwire/cyber118.twd
The database was successfully generated.

¼³Á¤°úÁ¤ÀÌ ³¡³µÀ¸¸é twcfg.txt°ú twpol.txt ÆÄÀÏÀ» »èÁ¦Çϰųª ¾ÈÀüÇÑ Àå¼Ò¿¡ º¸°üÇÏ¿©¾ß ÇÑ´Ù.

Top

¡á ¹«°á¼º °Ë»ç

´ÙÀ½ÀÇ ¸í·ÉÀ¸·Î ½Ã½ºÅÛ¿¡ ÀÖ´Â ÆÄÀϵ鿡 ´ëÇÑ ¹«°á¼ºÀ» °Ë»çÇÒ¼ö ÀÖ´Ù.

# ./tripwire --check
Parsing policy file: /etc/tripwire/tw.pol
*** Processing Unix File System ***
Performing integrity check...
Wrote report file: /var/lib/tripwire/report/cyber118-20010629-005928.twr

¹«°á¼º °Ë»ç°¡ ³¡³ª¸é /var/lib/tripwire/report ¾Æ·¡¿¡ °á°ú ÆÄÀÏÀÌ »ý¼ºµÈ´Ù.

Top

¡á µ¥ÀÌÅͺ£À̽º °»½Å

¹«°á¼º °Ë»ç ÈÄ ¹ß°ßµÇ¾îÁø º¯°æ ÆÄÀÏ Áß Ä§ÀÔ¿¡ ÀÇÇÑ °ÍÀÌ ¾Æ´Ï¶ó Á¤»óÀûÀÎ º¯È­¶ó¸é ±âÁ¸¿¡ ¸¸µé¾îÁ® ÀÖ´ø µ¥ÀÌÅͺ£À̽º¸¦ °»½ÅÇÏ¿©¾ßÇÑ´Ù.

# ./tripwire --update
¶Ç´Â # ./tripwire -m u

tripwire --update modeÀ» ÀÌ¿ëÇÏ¸é µ¥ÀÌÅͺ£À̽ºÀÇ ÀçÃʱâÈ­ ¾øÀ̵µ µ¥ÀÌÅͺ£À̽º¸¦ °»½ÅÇÒ¼ö ÀÖ´Ù.

¡á Á¤Ã¥ÆÄÀÏ °»½Å

Á¤Ã¥ÆÄÀÏÀ» °»½ÅÇÏ´Â ¹æ¹ý¿¡´Â tripwire --update-police°ú twadmin --creat-polfile µÎ°¡Áö°¡ ÀÖ´Ù.

¨ç # ./tripwire --update-police ¶Ç´Â # ./tripwire -m p /etc/tripwire/policy.txt

tripwire --update-police mode´Â ÀÌÀüÀÇ rule°ú ºñ±³ÇÏ¿© »õ·Î¿î rule¿¡ ´ëÇÑ Á¤º¸¸¦ ¾÷µ¥ÀÌÆ®ÇÏ´Â °ÍÀ̹ǷΠµ¥ÀÌÅͺ£À̽º¸¦ ÀçÃʱâÈ­ ÇÏÁö ¾Ê¾Æµµ µÈ´Ù.

¨è # ./twadmin --creat-polfile # ./twadmin --creat-polfile mypol.txt (¿©±â¼­mypol.txt´Â »õ·Î¿î Á¤Ã¥ÆÄÀÏÀÇ À̸§ÀÌ´Ù.)

twadmin --creat-polfile mode´Â »õ·Î¿î Á¤Ã¥ÆÄÀÏÀ» ¸¸µå´Â ¸í·ÉÀ¸·Î À̸¦ À§Çؼ­´Â µ¥ÀÌÅͺ£À̽ºÀÇ ÀçÃʱâÈ­°¡ ÇÊ¿äÇÏ´Ù.

Top

4. Tripwire Configuration File & Policy File Reference

4-1. ȯ°æ¼³Á¤ÆÄÀÏ(Configuration File-twcfg.txt)

ȯ°æ¼³Á¤ÆÄÀÏ(twcfg.txt)Àº tripwireÀ¯Æ¿¸®Æ¼¿Í ¼³Á¤ÆÄÀϵéÀÌ ¾îµð¿¡ ¼³Ä¡µÇ¾î ÀÖ´ÂÁö µî¿¡ ´ëÇÑ Á¤º¸¸¦ ÀúÀåÇϰí Àִµ¥ ³»¿ëÀ» »ìÆìº¸¸é ´ÙÀ½°ú °°´Ù.

ROOT =/usr/sbin
POLFILE =/etc/tripwire/tw.pol
DBFILE =/var/lib/tripwire/$(HOSTNAME).twd
REPORTFILE =/var/lib/tripwire/report/$(HOSTNAME)-$(DATE).twr
SITEKEYFILE =/etc/tripwire/site.key
LOCALKEYFILE =/etc/tripwire/$(HOSTNAME)-local.key
EDITOR =/bin/vi
LATEPROMPTING =false
LOOSEDIRECTORYCHECKING =false
MAILNOVIOLATIONS =true
EMAILREPORTLEVEL =3
REPORTLEVEL =3
MAILMETHOD =SENDMAIL
SYSLOGREPORTING =false
MAILPROGRAM =/usr/sbin/sendmail -oi -t

Top

¾Æ·¡ÀÇ Ç¥´Â ¼³Á¤ÆÄÀÏ º¯¼öµé°ú ±× º¯¼öµéÀÌ ¹«¾ùÀ» ³ªÅ¸³»´ÂÁö µî¿¡ ´ëÇØ ¿ä¾àÇÑ °ÍÀÌ´Ù.

¼³Á¤ÆÄÀÏ º¯¼öµé

¼³¸í

Required

Variables

POLFILE

Á¤Ã¥ÆÄÀÏÀÇ À§Ä¡ ÁöÁ¤ Initial value: /etc/tripwire/tw.pol

DBFILE

µ¥ÀÌÅͺ£À̽º ÆÄÀÏÀÇ À§Ä¡ ÁöÁ¤ Initial value: /etc/tripwire/$(HOSTNAME).twd

REPORTFILE

»ý¼ºµÈ °á°ú ÆÄÀÏÀÇ À§Ä¡ ÁöÁ¤ Initial value: /var/lib/report/$(HOSTNAME)-$(DATE).twr

SITEKEYFILE

»çÀÌÆ®Å° ÆÄÀÏÀÇ À§Ä¡ ÁöÁ¤ Initial value: /etc/tripwire/site.key

LOCALKEYFILE

·ÎÄÃŰ ÆÄÀÏÀÇ À§Ä¡ ÁöÁ¤ Initial value: /etc/tripwire/$(HOSTNAME)-local.key

Optional

Variables

EDITOR

»ç¿ëÇϰíÀÚ ÇÏ´Â ÆíÁý±âÀÇ À§Ä¡ ÁöÁ¤ Initial value: /bin/vi

LATEPROMPTING

tripwire°¡ ÆÐ½º¿öµå ¿ä±¸ÇÏ´Â °ÍÀ» °¡Àå ¸¶Áö¸·¿¡ Çϵµ·Ï ¼³Á¤ Initial value: false

SYSLOGREPORTING

SYSLOGREPORTINGÀÌ true·Î ¼³Á¤µÇ¸é database initializations, integrity checks, database updates, and policy fileµîÀÇ update À» syslog¿¡ ¾Ë¸². Initial value: true.

LOOSEDIRECTORYCHECKING

µð·ºÅ丮 º¯°æ»çÇ×ÀÌ ÀÖ´ÂÁö¸¦ Ãâ·ÂÇØ¾ß ÇÏ´Â °ÍÀ» ³ªÅ¸³¿. ¼³Á¤µÇ¾î ÀÖÁö ¾ÊÀ¸¸é º¯È­µÈ ÆÄÀϻӸ¸ ¾Æ´Ï¶ó ±× ÆÄÀÏÀÌ ÀÖ´Â µð·ºÅ丮µµ °á°ú¿¡ Ãâ·ÂµÇ°í ¼³Á¤µÇ¸é ÆÄÀÏÀÇ º¯È­¸¸À» Ãâ·ÂÇÔ. Initial value: false

REPORTLEVEL

twprint --print-report command·Î report¸¦ Ãâ·ÂÇÒ ¶§ÀÇ ·¹º§·Î¼­ 0-4±îÁöÀÇ ·¹Æ÷Æ®·¹º§ÀÌ ÀÖÀ½. Initial value: 3

Email

Notification

Variables

MAILNOVIOLATIONS

¹«°á¼º °Ë»ç½Ã ¾Æ¹«·± º¯È­°¡ ¾øÀ» ¶§¿¡µµ email notificationÀ» ÇÒÁö¸¦ ³ªÅ¸³¿. Initial value: true

EMAILREPORTLEVEL

email report level·Î 0-4
Initial value: 3

MAILMETHOD

email notificationÀ» À§ÇØ »ç¿ëÇÒ protocol¸í½Ã Initial value: SENDMAIL

MAILPROGRAM

ƯÁ¤ ¸ÞÀÏ ÇÁ·Î±×·¥ÀÇ À§Ä¡ ÁöÁ¤ Initial value: /usr/sbin/sendmail -oi -t

Top

4-2. tripwire Á¤Ã¥ÆÄÀÏ (twpol.txt)

tripwire Á¤Ã¥ÆÄÀÏ(twpol.txt)Àº tripwire°¡ °¨½ÃÇÒ ´ë»ó(ÆÄÀÏ, µð·ºÅ丮)°ú ±× À§Ä¡¸¦ ¸í½ÃÇÑ´Ù.

°ü¸®ÇÏ´Â ½Ã½ºÅÛ¿¡ ¸Â°Ô Á¤Ã¥ÆÄÀÏ(twpol.txt)À» ¼öÁ¤ÇÒ ¼ö Àִµ¥ ÀÌ´Â ºÒÇÊ¿äÇÏ°Ô µé¾îÀÖ´Â ÆÄÀÏÀ» Á¦°ÅÇϰí ÇÊ¿äÇÑ ÆÄÀÏÀº Ãß°¡ÇÔÀ¸·Î½á tripwire¿¡¼­ ¾µ¸ð ¾ø´Â °á°ú¹°ÀÌ ³ª¿À´Â °æ¿ì¸¦ »ó´çÈ÷ ÁÙÀϼö ÀÖµµ·Ï ÇÑ´Ù.

¶ÇÇÑ configuration script¸¦ ½ÇÇà½ÃŲ ÈÄ¿¡ Á¤Ã¥ÆÄÀÏÀ» ¼öÁ¤ÇÏ¸é µ¥ÀÌÅͺ£À̽ºÆÄÀÏÀ» ÃʱâÈ­Çϱâ Àü¿¡ configuration fileÀ» Àç½ÇÇàÇØ¾ßÇÏ´Â ¹ø°Å·Î¿òÀÌ ÀÖÀ¸¹Ç·Î tripwire¸¦ ¼³Ä¡Çϱâ Àü¿¡ ½Ã½ºÅÛ¿¡ ¸Â°Ô ¼³Á¤ÇÏ´Â °ÍÀÌ ÁÁ´Ù.

¨ç policy fileÀÇ ±¸¼º¿ä¼Ò

policy fileÀÇ ±âº»ÀûÀÎ ±¸¼º¿ä¼Ò´Â ´ÙÀ½°ú °°´Ù.

policy file component

meaning

Rules

policy fileÀÇ ±âº»±¸¼º¿ä¼Ò·Î
¹«°á¼º °Ë»ç½Ã ½Ã½ºÅÛÀÇ object¿¡ ´ëÇØ monitorÇÒ properity¸¦ ¸í½ÃÇØÁִ°Í

Stop points

¹«°á¼º °Ë»ç½Ã ½ºÄµÇÏÁö ¾ÊÀ» ½Ã½ºÅÛÀÇ object ¸í½Ã

Attributs

À̸ÞÀÏÀ» º¸³»°Å³ª recursionÀ» Á¶Á¤ÇÏ´Â ruleÀ» ¼öÁ¤ÇÏ´Â ºÎºÐ

Directive

ÇϳªÀÇ policyÆÄÀÏÀ» ³×Æ®¿÷ ¼­¹ö¿¡¼­ »ç¿ëÇÒ ¶§.

Variable

°ü¸®ÀÚ°¡ Æí¸®ÇÏ°Ô Á¤º¸¸¦ ¹Ù²Ùµµ·Ï ¼³Á¤

Top

1) rules

rulesÀÇ ±âº»Çü½ÄÀº ´ÙÀ½°ú °°´Ù.

object name -> property mask;
object name Àº ½ºÄµÇÒ µð·ºÅ丮³ª ÆÄÀÏÀÇ °æ·ÎÀ̰í
property mask´Â ½ÇÇà ȤÀº ½ÇÇàÇÏÁö ¾ÊÀ» object property¿¡ ´ëÇØ ¼³Á¤ÇØÁÖ´Â ºÎºÐÀÌ´Ù.
(¿©±â¼­ ->´Â object name °ú property mask¸¦ ±¸º°ÇØÁÖ´Â ±âÈ£À̰í ;Àº ruleÀÇ ³¡À» ³ªÅ¸³½´Ù.)
¿¹1) ¿¹¸¦ µé¾î /etc µð·ºÅ丮 ÀüºÎ¿¡ ´ëÇØ¼­ +pinug¶ó´Â property mask·Î ½ºÄµÇÏ·Á¸é ´ÙÀ½°ú °°ÀÌ ±â¼úÇØÁØ´Ù.
/etc -> +pinug;
¡Ø¿©±â¼­ +pinug ¶ó´Â property mask´Â °ü¸®ÀÚ°¡ Á¤ÀÇÇѰÍÀ¸·Î ÀÌ·¸°Ô °ü¸®ÀÚ°¡ Á¤ÀÇÇØ¼­ »ç¿ëÇÒ¼öµµ ÀÖ°í ÀÌ¹Ì Á¤ÇØÁ® ÀÖ´Â viriableÀ» ÀÌ¿ëÇÒ¼öµµ ÀÖ´Ù.
ÀÌ¹Ì Á¤ÇØÁ® ÀÖ´Â viriable¿¡ ´ëÇØ¼­´Â 5) viriable¸¦ Âü°íÇ϶ó.
¿¹2) /etc µð·ºÅ丮¿¡ ´ëÇØ¼­´Â °ü¸®ÀÚ°¡ Á¤ÀÇÇÑ mask1À¸·Î ½ºÄµÇϰí /etc/passwd ÆÄÀÏ¿¡ ´ëÇØ¼­¸¸ mask2¸¦ ½á¼­ ½ºÄµÇϵµ·Ï ¼³Á¤ÇÒ ¶§
/etc -> $(mask1) ;
/etc/passwd -> $(mask2) ;
property mask¿¡ ´ëÇÑ Ç¥´Â ¾Æ·¡¿Í °°´Ù.

Top

Property

Meaning

-

Ignore the following properties

+

Record and check the following properties

p

File permissions

i

Inode number

n

Number of links (i.e., inode reference count)

u

User id of owner

g

Group id of owner

t

File type

s

File size

d

Device number of the disk on which the inode associated with the file is stored

r

Device number of the device to which the inode points.
Valid only for device objects.

b

Number of blocks allocated

m

Modification timestamp

c

Inode creation/modification timestamp

l

Indicates that the file is expected to grow.
If the file is smaller than the last recorded size, it is a violation of this property.
This can be useful for log files.

a

Access timestamp
The +a property is incompatible with the hash properties(+CMSH).
To calculate the hash, the file must be opened and read,
which changes the access timestamp.
Specifying any of +CMSH will always cause a violation of the +a property.

C

CRC-32, POSIX 1003.2 compliant 32-bit Cyclic Redundancy Check.
Choose this hash for relatively high performance but relatively low security.

M

MD5, the RSA Data Security, Inc.® Message Digest Algorithm.
Choose this hash for high security.

S

SHA, part of the SHS/SHA algorithm.
Choose this hash for high security.

H

HAVAL, a strong 128-bit signature algorithm.
Choose this hash for high security.

Top

2) Stop Points

Stop Points´Â ¹«°á¼º °Ë»ç¸¦ ÇÏ´Â µ¿¾È ½ºÄµÇÏÁö ¾ÊÀ» object¿¡ ´ëÇØ ¼³Á¤ÇÏ´Â ºÎºÐÀÌ´Ù.
±âº»Çü½ÄÀº ´ÙÀ½°ú °°´Ù.

! object name;

¿¹) /etc/rc.d¿Í /etc/muttab¿¡ ´ëÇØ¼­´Â ½ºÄµÇÏÁö ¾Ê°í ³ª¸ÓÁö /etcÀÇ ¸ðµç ºÎºÐ¿¡ ´ëÇØ¼­´Â ½ºÄµÇÒ ¶§
/etc ->$(Readonly) -ar;
!/etc/rc.d;
!/etc/mnttab;

Top

3) Rule Attributes

Rule Attributes´Â Á¤Ã¥ÆÄÀÏ Àüü·Î ¹«°á¼º °Ë»ç¸¦ ÇÏÁö ¾Ê°í ¸î °³ÀÇ rule name ¿¡ ´ëÇØ¼­¸¸ Á¡°ËÀ» ÇÑ´ÙµçÁö policy file¿¡ º¯È­°¡ ÀÖ´Â ºÎºÐ¿¡ ´ëÇØ °ü¸®ÀÚ°¡ À̸ÞÀÏ·Î ¹ÞÀ» ¼ö ÀÖµµ·Ï ¼³Á¤ÇÏ´Â µîÀÇ ¼³Á¤À» ÇÏ´Â ºÎºÐÀÌ´Ù.

¿¹1) /usr/lib rule¿¡ º¯È­°¡ ÀÖÀ»¶§ email report¸¦ xxx@xxx.com¿¡°Ô º¸³»·ÁÇÒ¶§
/usr/lib -> $(ReadOnly) ( emailto = xxx@xxx.com ) ;

¿¹2) “"rcfiles" ¶ó´Â rule¿¡ ´ëÇØ¼­¸¸ ¹«°á¼º °Ë»ç¸¦ ÇϰíÀÚ ÇÒ¶§
tripwire --check --rule-name “"rcfiles"

Rule AttributesÀÇ ³»¿ëÀº ¾Æ·¡¿Í °°´Ù.

Attribute

Description

rulename

Associates a name with a rule.
The default value is the last element of the object name to which the rule applies.

emailto

Specifies email address(es) to which notification of any violations is sent.
The default value is none.

severity

Associates a numeric severity level with a rule.
The default value is 0. The valid range is from 0 to 1000000.

recurse

Controls recursive scanning of directories.
True (-1), false (0), and numerical values > 0 are valid.
The default value is true.

4) Directives

ÇϳªÀÇ policyÆÄÀÏÀ» °¡Áö°í ¿©·¯´ëÀÇ ½Ã½ºÅÛ¿¡ °øÀ¯ÇÏ¿© »ç¿ëÇϰíÀÚ ÇÒ ¶§ ¼³Á¤ÇØÁÖ´Â ºÎºÐÀÌ´Ù.

Top

5) Variables

policy file¿¡¼­´Â µÎ°¡ÁöÀÇ variableÀ» »ç¿ëÇÒ¼ö Àִµ¥ Global variablesÀº policy file Àüü¿¡ ´ëÇØ¼­ »ç¿ëÇÒ ¼ö ÀÖ°í local variablesÀº Á¤ÇØÁø section¿¡¼­¸¸ »ç¿ë °¡´ÉÇÏ´Ù.

±âº» Çü½ÄÀº ´ÙÀ½°ú °°´Ù.

variable = value;

¿¹1) # Define the variable
mask1 = +pinugC-a ;
# and now use it.
/home/projectA -> $(mask1) ;
/home/projectB -> $(mask1)+MSH-db ;

¹Ì¸® Á¤ÇسõÀº Variables¿¡ °üÇÑ Ç¥´Â ¾Æ·¡¿Í °°´Ù.

Variable

Definition

ReadOnly

This variable is good for files that are widely available but are intended to be read-only.
Expands to: +pinugsmtdbCM-raclSH

Dynamic

This variable is good for monitoring user directories and files that tend to change frequently.
Expands to: +pinugtd-rsacmblCMSH

Growing

This variable is useful for files that can grow, but not shrink, such as log files:
Expands to: +pinugtdl-rsacmbCMSH

IgnoreAll

This variable tracks a file’s presence or absence, but doesn't check any other properties.
Expands to: -pinusgamctdrblCMSH

IgnoreNone*

This variable turns on all properties and provides a convenient starting point for defining your own property masks.
Expands to: +pinusgamctdrbCMSH-l

Device

This variable is useful for devices or other files that Tripwire software should not attempt to open.
Expands to : +pugsdr-intlbamcCMSH

Top

5. tripwire command

¨ç tripwire test mode

tripwireÀÇ email notification systemÀÇ ÀÛµ¿À» üũÇϱâ À§ÇØ test mode·Î ´ÙÀ½ÀÇ ¸í·É¾î¸¦ ¾µ ¼ö ÀÖ´Ù.

# tripwire --test --email jys@certcc.or.kr

Sending a test message to: jys@certcc.or.kr

email notificationÀÌ ¿Ã¹Ù¸£°Ô ÀÛµ¿ÇÑ´Ù¸é ¾Æ·¡ÀÇ ¸Þ½ÃÁö¸¦ ¹ÞÀ» °ÍÀÌ´Ù.

Subject: Test email message from Tripwire
Date: Fri 29 Jun 2001 09:06:58 +0900
From: "Tripwire(R) 2.3.0.47" <tripwire@localhost.localdomain>
To: jys@cert.certcc.or.kr

If you receive this message, email notification from tripwire is working correctly.

Top

¨è crontabÀ» ÀÌ¿ëÇÑ ÁÖ±âÀûÀÎ ÀÚµ¿Á¡°Ë ¹× e-mailÀ» ÅëÇØ ·¹Æ÷Æ® ¹Þ¾Æº¸±â

ÆÄÀÏ ½Ã½ºÅÛ¿¡ ÁÖ±âÀûÀÎ Á¡°ËÀÌ ¾øÀ¸¸é tripwire´Â ¼Ò¿ëÀÌ ¾ø´Ù. ±×·¯¹Ç·Î ¸ÅÀÏ ¹ã tripwire·Î Á¡°ËÇϰí À̸¦ e-mail·Î ¹Þ¾Æº¼¼ö ÀÖµµ·Ï ¼³Á¤ÇÑ´Ù¸é º¸´Ù Æí¸®ÇÏ°Ô tripwire¸¦ »ç¿ëÇÒ¼ö ÀÖ´Ù.

1) tripwire ·¹Æ÷Æ®¸¦ ¸¸µé±â À§ÇÏ¿© shell script¸¦ ¸¸µç´Ù.

/usr/local/bin¹Ø¿¡ "runtripwire.sh" ¶ó´Â ÆÄÀÏ¿¡ ¾Æ·¡ÀÇ ³»¿ëÀ» Æ÷ÇÔÇÏ´Â ÆÄÀÏÀ» ¸¸µç´Ù.
[root@cyber118 bin]# vi runtripwire.sh
#!/bin/sh
/usr/sbin/tripwire -m c | mail -s "tripwire report from linux-1" jys@certcc.or.kr

2) crontab¿¡ Ãß°¡Çϱâ

crontab -e ¸í·ÉÀ» ½á¼­ ¸ÅÀÏ ¹ã 1:01¿¡ À§ÀÇ script¸¦ ½ÇÇàÇϵµ·Ï ¼³Á¤ÇÑ´Ù.
1 1 * * * /usr/local/bin/runtripwire.sh
ÀÌ¿Í °°ÀÌ ¼³Á¤ÇßÀ¸¸é ¸ÅÀÏ ¹ã tripwire¿Í ½ÇÇàµÇ¾î e-mail·Î °á°ú ·¹Æ÷Æ®¸¦ ¹ÞÀ» ¼ö ÀÖ´Ù.

¾Æ·¡´Â ½ÇÁ¦·Î Á¡°Ë°á°ú¸¦ ¸ÞÀÏ·Î ¹ÞÀº È­¸éÀÌ´Ù.

¾Æ·¡ÀÇ °á°ú¸ÞÀÏ¿¡¼­ º¸¸é ls, netstat, psµîÀÌ º¯Á¶µÇ¾úÀ½À» È®ÀÎÇÒ¼ö ÀÖ´Ù.

Top

¨é twprint

tripwire µ¥ÀÌÅͺ£À̽º ÆÄÀϵé°ú ¹ÙÀ̳ʸ®µéÀº encodeµÇ°í signµÇ¹Ç·Î twprint ¸í·É¾î¸¦ »ç¿ëÇÔÀ¸·Î½á database¿Í report fileÀ» text Çü½ÄÀ¸·Î º¼¼ö ÀÖ´Ù.

¿¹1) µ¥ÀÌÅͺ£À̽º ÆÄÀÏÀ» ÅØ½ºÆ®ÆÄÀÏ·Î ÇÁ¸°Æ®ÇÒ ¶§
#twprint --print-dbfile > db.txt

¿¹2) report °á°ú ÆÄÀÏÀ» ÅØ½ºÆ®ÆÄÀÏ·Î ÇÁ¸°Æ®ÇÒ ¶§
#twprint -m r --twrfile cyber118-20010703-035644.twr

(¿©±â¼­ cyber118Àº machine nameÀ̰í 20010703-035644Àº ¹«°á¼º°Ë»ç¸¦ ÇÑ ³¯Â¥¿Í ½Ã°£)

¡á tripwire¼³Ä¡¸¦ ¸¶Ä¡¸ç

tripwire´Â »ý¼ºµÈ µ¥ÀÌÅͺ£À̽º¿Í ºñ±³ÇÏ¿©¼­ ÆÄÀÏ¿¡ º¯È­°¡ ÀÖ´ÂÁö Á¡°ËÇÑ´Ù.

±×·¯¹Ç·Î ÀÌ¹Ì ÇØÅ·À» ´çÇÑ ÈÄ ·çƮŶÀ̳ª ¹éµµ¾î µîÀÌ ¼³Ä¡µÇ¾î ÀÖ´Â »óÅ¿¡¼­ tripwire°¡ ¼³Ä¡µÈ´Ù¸é tripwire´Â ¹«¿ëÁö¹°ÀÌ´Ù. ¶ÇÇÑ µ¥ÀÌÅͺ£À̽º¸¦ º¯°æÇÒ¼ö Àִ ħÀÔÀÚ´Â ¹«°á¼º °Ë»çµµ±¸¸¦ ÆÄ±«ÇÒ¼ö ÀÖÀ¸¹Ç·Î, ¹«°á¼º °Ë»ç¸¦ À§ÇØ »ç¿ëµÇ´Â µ¥ÀÌÅͺ£À̽º´Â ½ÂÀεÇÁö ¾Ê´Â º¯°æÀ¸·ÎºÎÅÍ º¸È£µÇ¾î¾ß ÇÒ °ÍÀÌ´Ù.

Top

Âü°íÀÚ·á

¡¤ http://www.linuxsecurity.com/feature_stories/feature_story-81.html
¡¤ http://sourceforge.net/project/showfiles.php?group_id=3130tripwire-2.3.0-docs-pdf.tar.gz
¡¤ ¸®´ª½º º¸¾ÈÀÇ ¸ðµç °Í (ÀÎÆ÷ ºÏ)
¡¤ Security PLUS for UNIX (Æ÷Ç×°ø´ë À¯´Ð½º º¸¾È ¿¬±¸È¸ Àú, ¿µÁøÃâÆÇ»ç)

Top