CentOS 7 Tripwireインストール

TripwireをYumでインストール

TripwireをYumでインストールする場合、EPELリポジトリを追加しておく。
古いTripwireが残ってる場合はアンインストールしておく

[root@server1 ~]# yum remove tripwire
下記コマンドで検索して出てきたものは全て削除しておく(ディレクトリー「rm -rf」、ファイル「rm -f」)
[root@server1 ~]# find /* | grep tripwire

■Tripwireのインストール

[root@server1 ~]# yum install tripwire
読み込んだプラグイン:fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
 * base: mirror.vodien.com
 * centosplus: mirror.vodien.com
 * epel: mirrors.vinahost.vn
 * extras: mirror.vodien.com
 * rpmforge: ftp.neowiz.com
 * updates: mirror.vodien.com
77 packages excluded due to repository priority protections
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ tripwire.x86_64 0:2.4.2.2-6.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

====================================================================================================
 Package                アーキテクチャー     バージョン                    リポジトリー        容量
====================================================================================================
インストール中:
 tripwire               x86_64               2.4.2.2-6.el7                 epel               1.0 M

トランザクションの要約
====================================================================================================
インストール  1 パッケージ

総ダウンロード容量: 1.0 M
インストール容量: 4.1 M
Is this ok [y/d/N]: y
Downloading packages:
tripwire-2.4.2.2-6.el7.x86_64.rpm                                            | 1.0 MB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : tripwire-2.4.2.2-6.el7.x86_64                                       1/1
  検証中                  : tripwire-2.4.2.2-6.el7.x86_64                                       1/1

インストール:
  tripwire.x86_64 0:2.4.2.2-6.el7

完了しました!

■tripwireの初期設定

[root@server1 ~]# tripwire-setup-keyfiles

----------------------------------------------
The Tripwire site and local passphrases are used to sign a  variety  of
files, such as the configuration, policy, and database files.

Passphrases should be at least 8 characters in length and contain  both
letters and numbers.

See the Tripwire manual for more information.

----------------------------------------------
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: ← サイトパスフレーズを再度入力
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.)

Enter the local keyfile passphrase: ← ローカルパスフレーズを設定
Verify the local keyfile passphrase: ← ローカルパスフレーズを再度入力
Generating key (this may take several minutes)...Key generation complete.

----------------------------------------------
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
move this file to a secure location and/or encrypt it in place (using a
tool such as GPG, for example) after you have examined it.


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

Once you have a satisfactory Tripwire policy file, you should move  the
clear-text version to a secure location  and/or  encrypt  it  in  place
(using a tool such as GPG, for example).

Now run "tripwire --init" to enter Database Initialization  Mode.  This
reads the policy file, generates a database based on its contents,  and
then cryptographically signs the resulting  database.  Options  can  be
entered on the command line to specify which policy, configuration, and
key files are used  to  create  the  database.  The  filename  for  the
database can be specified as well. If no  options  are  specified,  the
default values from the current configuration file are used.

■Tripwireの設定

[root@server1 ~]# vi /etc/tripwire/twcfg.txt
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
↓
LOOSEDIRECTORYCHECKING =true
MAILNOVIOLATIONS       =true
EMAILREPORTLEVEL       =3
REPORTLEVEL            =3
↓
REPORTLEVEL            =4
MAILMETHOD             =SENDMAIL
SYSLOGREPORTING        =false
MAILPROGRAM            =/usr/sbin/sendmail -oi -t

設定ファイル(テキスト版⇒暗号署名版)を作成
[root@server1 ~]# twadmin -m F -c /etc/tripwire/tw.cfg -S /etc/tripwire/site.key /etc/tripwire/twcfg.txt
Please enter your site passphrase:
Wrote configuration file: /etc/tripwire/tw.cfg

セキュリティ確保のため設定ファイル(テキスト版)を削除
[root@server1 ~]# rm -f /etc/tripwire/twcfg.txt

設定ファイル(テキスト版)を復活させる場合は以下のコマンドで復活できる
[root@server1 ~]# twadmin --print-cfgfile > /etc/tripwire/twcfg.txt

■ポリシーファイルの設定

ポリシーファイルの最適化スクリプトを作成

[root@server1 ~]# vi /etc/tripwire/twpolmake.pl
#!/usr/bin/perl
# Tripwire Policy File customize tool
# ----------------------------------------------------------------------
# Copyright (C) 2003 Hiroaki Izumi
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# ----------------------------------------------------------------------
# Usage:
#    perl twpolmake.pl {Pol file}
# ----------------------------------------------------------------------
#
$POLFILE=$ARGV[0];
open(POL,"$POLFILE") or die "open error: $POLFILE" ;
my($myhost,$thost) ;
my($sharp,$tpath,$cond) ;
my($INRULE) = 0 ;
while (<POL>) {
chomp;
if (($thost) = /^HOSTNAME\s*=\s*(.*)\s*;/) {
$myhost = `hostname` ; chomp($myhost) ;
if ($thost ne $myhost) {
$_="HOSTNAME=\"$myhost\";" ;
}
}
elsif ( /^{/ ) {
$INRULE=1 ;
}
elsif ( /^}/ ) {
$INRULE=0 ;
}
elsif ($INRULE == 1 and ($sharp,$tpath,$cond) = /^(\s*\#?\s*)(\/\S+)\b(\s+->\s+.+)$/) {
$ret = ($sharp =~ s/\#//g) ;
if ($tpath eq '/sbin/e2fsadm' ) {
$cond =~ s/;\s+(tune2fs.*)$/; \#$1/ ;
}
if (! -s $tpath) {
$_ = "$sharp#$tpath$cond" if ($ret == 0) ;
}
else {
$_ = "$sharp$tpath$cond" ;
}
}
print "$_\n" ;
}
close(POL) ;

ポリシーファイルの最適化

[root@server1 ~]# perl /etc/tripwire/twpolmake.pl /etc/tripwire/twpol.txt > /etc/tripwire/twpol.txt.new

ポリシーファイル(暗号署名版)を作成

[root@server1 ~]# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt.new
Please enter your site passphrase: ← サイトパスフレーズを入力
Wrote policy file: /etc/tripwire/tw.pol

ポリシーファイル(テキスト版)を削除
[root@server1 ~]# rm -f /etc/tripwire/twpol.txt*

ポリシーファイル(テキスト版)を復活させる場合は以下のコマンドで復活できる
[root@server1 ~]# twadmin -m p -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key > /etc/tripwire/twpol.txt

■Tripwireのデータベース作成
ポリシーファイルよりデータベースを作成

[root@server1 ~]# tripwire -m i -s -c /etc/tripwire/tw.cfg
Please enter your local passphrase: ← ローカルパスフレーズを入力

下は/root/backup.tar.bz2のファイルサイズが2Gを超えてしまったため、tripwireがエラーを出してデータベース作成が失敗した時のもの。このような時は、/root/backup.tar.bz2をチェック対象外にすることでエラー回避出来る。
### Error: File seek failed.
### Filename: /root/backup.tar.bz2
### \xe3\x81\x9d\xe3\x81\xae\xe3\x82\x88\xe3\x81\x86\xe3\x81\xaa\xe3\x83\x95\xe3\x82\xa1\xe3\x82\xa4\xe3\x83\xab\xe3\x82\x84\xe3\x83\x87\xe3\x82\xa3\xe3\x83\xac\xe3\x82\xaf\xe3\x83\x88\xe3\x83\xaa\xe3\x81\xaf\xe3\x81\x82\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93
### Exiting...

ポリシーファイル(テキスト版)を復活
[root@server1 ~]# twadmin -m p -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key > /etc/tripwire/twpol.txt

ポリシーファイル(テキスト版)の編集
[root@server1 ~]# vi /etc/tripwire/twpol.txt
  rulename = "Invariant Directories",
  severity = $(SIG_MED)
)
{
  /                                    -> $(SEC_INVARIANT) (recurse = 0) ;
  /home                                -> $(SEC_INVARIANT) (recurse = 0) ;
  /etc                                 -> $(SEC_INVARIANT) (recurse = 0) ;
!/root/backup.tar.bz2; ← 対象外ファイルを追加
}

ポリシーファイル(暗号署名版)を作成
[root@server1 ~]# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt
Please enter your site passphrase: ← サイトパスフレーズを入力
Wrote policy file: /etc/tripwire/tw.pol

ポリシーファイル(テキスト版)を削除
[root@server1 ~]# rm -f /etc/tripwire/twpol.txt

ポリシーファイルよりデータベースを作成

[root@server1 ~]# tripwire -m i -s -c /etc/tripwire/tw.cfg
Please enter your local passphrase: ← ローカルパスフレーズを入力
※データベースを作成するには結構時間がかかる

■Tripwireの確認

[root@server1 ~]# tripwire -m c -s -c /etc/tripwire/tw.cfg
Open Source Tripwire(R) 2.4.2.2 Integrity Check Report

Report generated by:          root
Report created on:            2014年12月06日 23時08分26秒
Database last updated on:     Never

===============================================================================
Report Summary:
===============================================================================

Host name:                    server1.yokensaka.com
Host IP address:              114.186.88.44
Host ID:                      None
Policy file used:             /etc/tripwire/tw.pol
Configuration file used:      /etc/tripwire/tw.cfg
Database file used:           /var/lib/tripwire/server1.yokensaka.com.twd
Command line used:            tripwire -m c -s -c /etc/tripwire/tw.cfg

===============================================================================
Rule Summary:
===============================================================================

-------------------------------------------------------------------------------
  Section: Unix File System
-------------------------------------------------------------------------------

  Rule Name                       Severity Level    Added    Removed  Modified
  ---------                       --------------    -----    -------  --------
  User binaries                   66                0        0        0
  Tripwire Binaries               100               0        0        0
  Libraries                       66                0        0        0
  Operating System Utilities      100               0        0        0
  File System and Disk Administraton Programs
                                  100               0        0        0
  Kernel Administration Programs  100               0        0        0
  Networking Programs             100               0        0        0
  System Administration Programs  100               0        0        0
  Hardware and Device Control Programs
                                  100               0        0        0
  System Information Programs     100               0        0        0
  Application Information Programs
                                  100               0        0        0
  (/sbin/rtmon)
  Critical Utility Sym-Links      100               0        0        0
  Shell Binaries                  100               0        0        0
  Critical system boot files      100               0        0        0
* Tripwire Data Files             100               1        0        0
  System boot changes             100               0        0        0
  OS executables and libraries    100               0        0        0
  Critical configuration files    100               0        0        0
  Security Control                100               0        0        0
  Login Scripts                   100               0        0        0
  Root config files               100               0        0        0
  Invariant Directories           66                0        0        0
  Temporary directories           33                0        0        0
  Critical devices                100               0        0        0
  (/proc/kcore)

Total objects scanned:  52987
Total violations found:  1

===============================================================================
Object Summary:
===============================================================================

-------------------------------------------------------------------------------
# Section: Unix File System
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
Rule Name: Tripwire Data Files (/var/lib/tripwire)
Severity Level: 100
-------------------------------------------------------------------------------

Added:
"/var/lib/tripwire/server1.yokensaka.com.twd" ← 今回追加されたTripwireのデータベースなので問題無し

===============================================================================
Error Report:
===============================================================================

No Errors

-------------------------------------------------------------------------------
*** End of report ***

Open Source Tripwire 2.4 Portions copyright 2000 Tripwire, Inc. Tripwire is a registered
trademark of Tripwire, Inc. This software comes with ABSOLUTELY NO WARRANTY;
for details use --version. This is free software which may be redistributed
or modified only under certain conditions; see COPYING for details.
All rights reserved.

■Tripwireの定期自動実行設定

インストール時に作成されてたTripwireの定期実行ファイルを編集

[root@server1 ~]# vi /etc/cron.daily/tripwire-check
#!/bin/sh
# デフォルトの部分をコメントアウト
#HOST_NAME=`uname -n`
#if [ ! -e /var/lib/tripwire/${HOST_NAME}.twd ] ; then
#        echo "****    Error: Tripwire database for ${HOST_NAME} not found.    ****"
#        echo "**** Run "/etc/tripwire/twinstall.sh" and/or "tripwire --init". ****"
#else
#        test -f /etc/tripwire/tw.cfg &&  /usr/sbin/tripwire --check
#fi
# パスフレーズ設定
LOCALPASS=xxxxxxxx # ローカルパスフレーズ
SITEPASS=xxxxxxxx # サイトパスフレーズ
cd /etc/tripwire
# Tripwireチェック実行
tripwire -m c -s -c tw.cfg|mail -s "Tripwire(R) Integrity Check Report in `hostname`" root
# ポリシーファイル最新化
twadmin -m p -c tw.cfg -p tw.pol -S site.key > twpol.txt
perl twpolmake.pl twpol.txt > twpol.txt.new
twadmin -m P -c tw.cfg -p tw.pol -S site.key -Q $SITEPASS twpol.txt.new > /dev/null
rm -f twpol.txt* *.bak
# データベース更新
rm -f /usr/local/tripwire/lib/tripwire/*.twd*
tripwire -m i -s -c tw.cfg -P $LOCALPASS

パーミッション変更
[root@server1 ~]# chmod 700 /etc/cron.daily/tripwire-check

TripwireをYumでインストール

TripwireをYumでインストールする場合、EPELリポジトリを追加しておく。
古いTripwireが残ってる場合はアンインストールしておく

[root@server1 ~]# yum remove tripwire
下記コマンドで検索して出てきたものは全て削除しておく(ディレクトリー「rm -rf」、ファイル「rm -f」)
[root@server1 ~]# find /* | grep tripwire

■Tripwireのインストール

[root@server ~]# yum install tripwire
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
epel/metalink                                                                | 2.9 kB     00:00
* base: www.ftp.ne.jp
* centosplus: www.ftp.ne.jp
* epel: ftp.riken.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
base                                                                         | 3.7 kB     00:00
centosplus                                                                   | 3.5 kB     00:00
epel                                                                         | 4.3 kB     00:00
epel/primary_db                                                              | 4.2 MB     00:03
extras                                                                       | 3.5 kB     00:00
updates                                                                      | 3.5 kB     00:00
updates/primary_db                                                           | 4.3 MB     00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tripwire.i686 0:2.4.1.2-11.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================
Package                Arch               Version                         Repository          Size
====================================================================================================
Installing:
tripwire               i686               2.4.1.2-11.el6                  epel               1.2 M
Transaction Summary
====================================================================================================
Install       1 Package(s)
Total download size: 1.2 M
Installed size: 3.7 M
Is this ok [y/N]: y
Downloading Packages:
tripwire-2.4.1.2-11.el6.i686.rpm                                             | 1.2 MB     00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : tripwire-2.4.1.2-11.el6.i686                                                     1/1
Verifying  : tripwire-2.4.1.2-11.el6.i686                                                     1/1
Installed:
tripwire.i686 0:2.4.1.2-11.el6
Complete!

■tripwireの初期設定

[root@server ~]# tripwire-setup-keyfiles
----------------------------------------------
The Tripwire site and local passphrases are used to sign a  variety  of
files, such as the configuration, policy, and database files.
Passphrases should be at least 8 characters in length and contain  both
letters and numbers.
See the Tripwire manual for more information.
----------------------------------------------
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: ← サイトパスフレーズを再度入力
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.)
Enter the local keyfile passphrase: ← ローカルパスフレーズを設定
Verify the local keyfile passphrase: ← ローカルパスフレーズを再度入力
Generating key (this may take several minutes)...Key generation complete.
----------------------------------------------
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
move this file to a secure location and/or encrypt it in place (using a
tool such as GPG, for example) after you have examined it.
----------------------------------------------
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.
Once you have a satisfactory Tripwire policy file, you should move  the
clear-text version to a secure location  and/or  encrypt  it  in  place
(using a tool such as GPG, for example).
Now run "tripwire --init" to enter Database Initialization  Mode.  This
reads the policy file, generates a database based on its contents,  and
then cryptographically signs the resulting  database.  Options  can  be
entered on the command line to specify which policy, configuration, and
key files are used  to  create  the  database.  The  filename  for  the
database can be specified as well. If no  options  are  specified,  the
default values from the current configuration file are used.

■Tripwireの設定

[root@server ~]# vi /etc/tripwire/twcfg.txt
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
↓
LOOSEDIRECTORYCHECKING =true
MAILNOVIOLATIONS       =true
EMAILREPORTLEVEL       =3
REPORTLEVEL            =3
↓
REPORTLEVEL            =4
MAILMETHOD             =SENDMAIL
SYSLOGREPORTING        =false
MAILPROGRAM            =/usr/sbin/sendmail -oi -t
設定ファイル(テキスト版⇒暗号署名版)を作成
[root@server ~]# twadmin -m F -c /etc/tripwire/tw.cfg -S /etc/tripwire/site.key /etc/tripwire/twcfg.txt
Please enter your site passphrase: ← サイトパスフレーズを入力
Wrote configuration file: /etc/tripwire/tw.cfg
セキュリティ確保のため設定ファイル(テキスト版)を削除
[root@server ~]# rm -f /etc/tripwire/twcfg.txt
設定ファイル(テキスト版)を復活させる場合は以下のコマンドで復活できる
[root@server~]# twadmin --print-cfgfile > /etc/tripwire/twcfg.txt

■ポリシーファイルの設定

ポリシーファイルの最適化スクリプトを作成
[root@server ~]# vi /etc/tripwire/twpolmake.pl
#!/usr/bin/perl
# Tripwire Policy File customize tool
# ----------------------------------------------------------------------
# Copyright (C) 2003 Hiroaki Izumi
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# ----------------------------------------------------------------------
# Usage:
#    perl twpolmake.pl {Pol file}
# ----------------------------------------------------------------------
#
$POLFILE=$ARGV[0];
open(POL,"$POLFILE") or die "open error: $POLFILE" ;
my($myhost,$thost) ;
my($sharp,$tpath,$cond) ;
my($INRULE) = 0 ;
while (<POL>) {
chomp;
if (($thost) = /^HOSTNAME\s*=\s*(.*)\s*;/) {
$myhost = `hostname` ; chomp($myhost) ;
if ($thost ne $myhost) {
$_="HOSTNAME=\"$myhost\";" ;
}
}
elsif ( /^{/ ) {
$INRULE=1 ;
}
elsif ( /^}/ ) {
$INRULE=0 ;
}
elsif ($INRULE == 1 and ($sharp,$tpath,$cond) = /^(\s*\#?\s*)(\/\S+)\b(\s+->\s+.+)$/) {
$ret = ($sharp =~ s/\#//g) ;
if ($tpath eq '/sbin/e2fsadm' ) {
$cond =~ s/;\s+(tune2fs.*)$/; \#$1/ ;
}
if (! -s $tpath) {
$_ = "$sharp#$tpath$cond" if ($ret == 0) ;
}
else {
$_ = "$sharp$tpath$cond" ;
}
}
print "$_\n" ;
}
close(POL) ;
ポリシーファイルの最適化
[root@server ~]# perl /etc/tripwire/twpolmake.pl /etc/tripwire/twpol.txt > /etc/tripwire/twpol.txt.new
ポリシーファイル(暗号署名版)を作成
[root@server ~]# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt.new
Please enter your site passphrase: ← サイトパスフレーズを入力
Wrote policy file: /etc/tripwire/tw.pol
ポリシーファイル(テキスト版)を削除
[root@server ~]# rm -f /etc/tripwire/twpol.txt*
ポリシーファイル(テキスト版)を復活させる場合は以下のコマンドで復活できる
[root@server ~]# twadmin -m p -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key > /etc/tripwire/twpol.txt

■Tripwireのデータベース作成

ポリシーファイルよりデータベースを作成
[root@server ~]# tripwire -m i -s -c /etc/tripwire/tw.cfg
Please enter your local passphrase: ← ローカルパスフレーズを入力

■Tripwireの確認

ファイル変更をチェック
[root@server ~]# tripwire -m c -s -c /etc/tripwire/tw.cfg
Open Source Tripwire(R) 2.4.1 Integrity Check Report
Report generated by:          root
Report created on:            2013年01月17日 17時11分21秒
Database last updated on:     Never
===============================================================================
Report Summary:
===============================================================================
Host name:                    server.pine-f.co.jp
Host IP address:              127.0.0.1
Host ID:                      None
Policy file used:             /etc/tripwire/tw.pol
Configuration file used:      /etc/tripwire/tw.cfg
Database file used:           /var/lib/tripwire/server.pine-f.co.jp.twd
Command line used:            tripwire -m c -s -c /etc/tripwire/tw.cfg
===============================================================================
Rule Summary:
===============================================================================
-------------------------------------------------------------------------------
Section: Unix File System
-------------------------------------------------------------------------------
Rule Name                       Severity Level    Added    Removed  Modified
---------                       --------------    -----    -------  --------
Invariant Directories           66                0        0        0
Temporary directories           33                0        0        0
* Tripwire Data Files             100               1        0        0
Critical devices                100               0        0        0
(/proc/kcore)
User binaries                   66                0        0        0
Tripwire Binaries               100               0        0        0
Libraries                       66                0        0        0
Operating System Utilities      100               0        0        0
Critical system boot files      100               0        0        0
File System and Disk Administraton Programs
100               0        0        0
Kernel Administration Programs  100               0        0        0
Networking Programs             100               0        0        0
System Administration Programs  100               0        0        0
Hardware and Device Control Programs
100               0        0        0
System Information Programs     100               0        0        0
Application Information Programs
100               0        0        0
(/sbin/rtmon)
Shell Related Programs          100               0        0        0
(/sbin/getkey)
Critical Utility Sym-Links      100               0        0        0
Shell Binaries                  100               0        0        0
System boot changes             100               0        0        0
OS executables and libraries    100               0        0        0
Critical configuration files    100               0        0        0
Security Control                100               0        0        0
Login Scripts                   100               0        0        0
Root config files               100               0        0        0
Total objects scanned:  27453
Total violations found:  1
===============================================================================
Object Summary:
===============================================================================
-------------------------------------------------------------------------------
# Section: Unix File System
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Rule Name: Tripwire Data Files (/var/lib/tripwire)
Severity Level: 100
-------------------------------------------------------------------------------
Added:
"/var/lib/tripwire/server.pine-f.co.jp.twd" ← 今回追加されたTripwireのデータベースなので問題無し
===============================================================================
Error Report:
===============================================================================
No Errors
-------------------------------------------------------------------------------
*** End of report ***
Open Source Tripwire 2.4 Portions copyright 2000 Tripwire, Inc. Tripwire is a registered
trademark of Tripwire, Inc. This software comes with ABSOLUTELY NO WARRANTY;
for details use --version. This is free software which may be redistributed
or modified only under certain conditions; see COPYING for details.
All rights reserved.

■Tripwireの定期自動実行設定

インストール時に作成されてたTripwireの定期実行ファイルを編集
[root@server1 ~]# vi /etc/cron.daily/tripwire-check
#!/bin/sh
# デフォルトの部分をコメントアウト
#HOST_NAME=`uname -n`
#if [ ! -e /var/lib/tripwire/${HOST_NAME}.twd ] ; then
#        echo "****    Error: Tripwire database for ${HOST_NAME} not found.    ****"
#        echo "**** Run "/etc/tripwire/twinstall.sh" and/or "tripwire --init". ****"
#else
#        test -f /etc/tripwire/tw.cfg &&  /usr/sbin/tripwire --check
#fi
# パスフレーズ設定
LOCALPASS=xxxxxxxx # ローカルパスフレーズ
SITEPASS=xxxxxxxx # サイトパスフレーズ
cd /etc/tripwire
# Tripwireチェック実行
tripwire -m c -s -c tw.cfg|mail -s "Tripwire(R) Integrity Check Report in `hostname`" root
# ポリシーファイル最新化
twadmin -m p -c tw.cfg -p tw.pol -S site.key > twpol.txt
perl twpolmake.pl twpol.txt > twpol.txt.new
twadmin -m P -c tw.cfg -p tw.pol -S site.key -Q $SITEPASS twpol.txt.new > /dev/null
rm -f twpol.txt* *.bak
# データベース更新
rm -f /usr/local/tripwire/lib/tripwire/*.twd*
tripwire -m i -s -c tw.cfg -P $LOCALPASS
パーミッション変更
[root@server1 ~]# chmod 700 /etc/cron.daily/tripwire-check

これで、/etc/cron.daily/tripwire-check が一日一回実行され、メールが届くようになる。

ファイル改竄検知システム(Tripwire)

Tripwireはサーバーのファイルの改竄を検知するシステム。 Tripwireを使用すると、重要なシステムファイルとディレクトリに対する変更をすべて検出することで、それらの保全性を確保することができる。セキュリティを万全にするために、ファイルが改竄される前に、Tripwireをインストールして基準データベースを作成しておく。基準データベースが作成されると、Tripwireは現在のファイルをこれと比較し、変更、追加、削除のいずれかがあれば報告するようにする。
■Tripwireのインストール
Tripwireをダウンロード(最新版 をダウンロード

[root@server1 ~]# wget http://downloads.sourceforge.net/tripwire/tripwire-2.4.2.2-src.tar.bz2
ダウンロードしたtripwireを展開
[root@server1 ~]# tar jxvf tripwire-2.4.2.2-src.tar.bz2
Tripwireの展開先ディレクトリへ移動
[root@server1 ~]# cd tripwire-2.4.2.2-src
tripwireのインストール
[root@server1 tripwire-2.4.2.2-src]# ./configure --prefix=/usr/local/tripwire sysconfdir=/etc/tripwire && make && make install
Press ENTER to view the License Agreement. ← 空ENTER
SPACEキー押下でライセンス表示を流す
Please type "accept" to indicate your acceptance of this
license agreement. [do not accept] accept ← acceptを入力
Continue with installation? [y/n] y ← y
Enter the site keyfile passphrase: ← サイトパスフレーズを設定
Verify the site keyfile passphrase: ← サイトパスフレーズを再度入力
Enter the local keyfile passphrase: ← ローカルパスフレーズを設定
Verify the local keyfile passphrase: ← ローカルパスフレーズを再度入力
Creating signed configuration file...
Please enter your site passphrase: ← サイトパスフレーズを入力
Creating signed policy file...
Please enter your site passphrase: ← サイトパスフレーズを入力
The installation succeeded.
tripwire展開先ディレクトリを抜ける
[root@server1 tripwire-2.4.2.-2src1]# cd 
tripwire展開先ディレクトリを削除
[root@server1 ~]# rm -rf tripwire-2.4.2.2-src 
tripwireを削除
[root@server1 ~]# rm -f tripwire-2.4.2.2-src.tar.bz2
tripwire実行ファイル格納ディレクトリへパスを通す
[root@server1 ~]# echo PATH=$PATH:/usr/local/tripwire/sbin >> .bashrc ; source .bashrc

■Tripwireの設定

設定ファイル(テキスト版)を編集
[root@server1 ~]# vi /etc/tripwire/twcfg.txt
ROOT                   =/usr/local/tripwire/sbin
POLFILE                =/etc/tripwire/tw.pol
DBFILE                 =/usr/local/tripwire/lib/tripwire/$(HOSTNAME).twd
REPORTFILE             =/usr/local/tripwire/lib/tripwire/report/$(HOSTNAME)-$(DATE).twr
SITEKEYFILE            =/etc/tripwire/site.key
LOCALKEYFILE           =/etc/tripwire/server1.yokensaka.com-local.key
EDITOR                 =/bin/vi
LATEPROMPTING          =false
LOOSEDIRECTORYCHECKING =false
↓
LOOSEDIRECTORYCHECKING =true
MAILNOVIOLATIONS       =true
EMAILREPORTLEVEL       =3
REPORTLEVEL            =3
↓
REPORTLEVEL            =4
MAILMETHOD             =SENDMAIL
SYSLOGREPORTING        =false
MAILPROGRAM            =/usr/sbin/sendmail -oi -t
設定ファイル(テキスト版⇒暗号署名版)を作成
[root@server1 ~]# twadmin -m F -c /etc/tripwire/tw.cfg -S /etc/tripwire/site.key /etc/tripwire/twcfg.txt
Please enter your site passphrase: ← サイトパスフレーズを入力
Wrote configuration file: /etc/tripwire/tw.cfg
セキュリティ確保のため設定ファイル(テキスト版)を削除
[root@server1 ~]# rm -f /etc/tripwire/twcfg.txt
設定ファイル(テキスト版)を復活させる場合は以下のコマンドで復活できる
[root@server1~]# twadmin --print-cfgfile > /etc/tripwire/twcfg.txt

■ポリシーファイルの設定

ポリシーファイルの最適化スクリプトを作成
[root@server1 ~]# vi /etc/tripwire/twpolmake.pl
#!/usr/bin/perl
# Tripwire Policy File customize tool
# ----------------------------------------------------------------------
# Copyright (C) 2003 Hiroaki Izumi
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# ----------------------------------------------------------------------
# Usage:
#    perl twpolmake.pl {Pol file}
# ----------------------------------------------------------------------
#
$POLFILE=$ARGV[0];
open(POL,"$POLFILE") or die "open error: $POLFILE" ;
my($myhost,$thost) ;
my($sharp,$tpath,$cond) ;
my($INRULE) = 0 ;
while (<POL>) {
chomp;
if (($thost) = /^HOSTNAME\s*=\s*(.*)\s*;/) {
$myhost = `hostname` ; chomp($myhost) ;
if ($thost ne $myhost) {
$_="HOSTNAME=\"$myhost\";" ;
}
}
elsif ( /^{/ ) {
$INRULE=1 ;
}
elsif ( /^}/ ) {
$INRULE=0 ;
}
elsif ($INRULE == 1 and ($sharp,$tpath,$cond) = /^(\s*\#?\s*)(\/\S+)\b(\s+->\s+.+)$/) {
$ret = ($sharp =~ s/\#//g) ;
if ($tpath eq '/sbin/e2fsadm' ) {
$cond =~ s/;\s+(tune2fs.*)$/; \#$1/ ;
}
if (! -s $tpath) {
$_ = "$sharp#$tpath$cond" if ($ret == 0) ;
}
else {
$_ = "$sharp$tpath$cond" ;
}
}
print "$_\n" ;
}
close(POL) ;
ポリシーファイルの最適化
[root@server1 ~]# perl /etc/tripwire/twpolmake.pl /etc/tripwire/twpol.txt > /etc/tripwire/twpol.txt.new
ポリシーファイル(暗号署名版)を作成
[root@server1 ~]# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt.new
Please enter your site passphrase: ← サイトパスフレーズを入力
Wrote policy file: /etc/tripwire/tw.pol
ポリシーファイル(テキスト版)を削除
[root@server1 ~]# rm -f /etc/tripwire/twpol.txt*
ポリシーファイル(テキスト版)を復活させる場合は以下のコマンドで復活できる
[root@server1 ~]# twadmin -m p -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key > /etc/tripwire/twpol.txt

■Tripwireのデータベース作成

ポリシーファイルよりデータベースを作成
[root@server1 ~]# tripwire -m i -s -c /etc/tripwire/tw.cfg
Please enter your local passphrase: ← ローカルパスフレーズを入力
※データベースを作成するには結構時間かかる

■Tripwireの確認

ファイル変更をチェック ※結構時間かかる
[root@server1 ~]# tripwire -m c -s -c /etc/tripwire/tw.cfg
Open Source Tripwire(R) 2.4.2.2 Integrity Check Report
Report generated by:          root
Report created on:            2013年01月15日 02時44分53秒
Database last updated on:     Never
===============================================================================
Report Summary:
===============================================================================
Host name:                    server1.yokensaka.com
Host IP address:              60.34.241.151
Host ID:                      None
Policy file used:             /etc/tripwire/tw.pol
Configuration file used:      /etc/tripwire/tw.cfg
Database file used:           /usr/local/tripwire/lib/tripwire/server1.yokensaka.com.twd
Command line used:            tripwire -m c -s -c /etc/tripwire/tw.cfg
===============================================================================
Rule Summary:
===============================================================================
-------------------------------------------------------------------------------
Section: Unix File System
-------------------------------------------------------------------------------
Rule Name                       Severity Level    Added    Removed  Modified
---------                       --------------    -----    -------  --------
* Tripwire Data Files             0                 1        0        0
* Monitor Filesystems             0                 0        0        5
User Binaries and Libraries     0                 0        0        0
Tripwire Binaries               0                 0        0        0
OS Binaries and Libraries       0                 0        0        0
Temporary Directories           0                 0        0        0
Global Configuration Files      0                 0        0        0
System Boot Changes             0                 0        0        0
RPM Checksum Files              0                 0        0        0
* OS Boot Files and Mount Points  0                 0        0        1
* OS Devices and Misc Directories 0                 0        24       1
Root Directory and Files        0                 0        0        0
Total objects scanned:  186790
Total violations found:  32
===============================================================================
Object Summary:
===============================================================================
-------------------------------------------------------------------------------
# Section: Unix File System
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Rule Name: Tripwire Data Files (/usr/local/tripwire/lib/tripwire)
Severity Level: 0
-------------------------------------------------------------------------------
Added:
"/usr/local/tripwire/lib/tripwire/server1.yokensaka.com.twd"
-------------------------------------------------------------------------------
Rule Name: Monitor Filesystems (/var)
Severity Level: 0
-------------------------------------------------------------------------------
Modified:
"/var/lib/NetworkManager/timestamps"
"/var/lib/samba/browse.dat"
"/var/lib/samba/unexpected.tdb"
"/var/spool/postfix/public/pickup"
"/var/spool/postfix/public/qmgr"
-------------------------------------------------------------------------------
Rule Name: OS Boot Files and Mount Points (/boot)
Severity Level: 0
-------------------------------------------------------------------------------
Modified:
"/boot/grub/stage2"
-------------------------------------------------------------------------------
Rule Name: OS Devices and Misc Directories (/dev)
Severity Level: 0
-------------------------------------------------------------------------------
Removed:
"/dev/char/13:33"
"/dev/char/13:67"
"/dev/char/189:503"
"/dev/char/250:0"
"/dev/input/by-id/usb-Logitech_USB_Optical_Mouse-event-mouse"
"/dev/input/by-id/usb-Logitech_USB_Optical_Mouse-mouse"
"/dev/input/by-path/pci-0000:00:12.0-usb-0:2:1.0-event-mouse"
"/dev/input/by-path/pci-0000:00:12.0-usb-0:2:1.0-mouse"
"/dev/input/event3"
"/dev/input/mouse1"
"/dev/.udev/db/hidraw:hidraw0"
"/dev/.udev/db/input:event3"
"/dev/.udev/db/input:mouse1"
"/dev/.udev/db/usb:4-2"
"/dev/.udev/links/input\\x2fby-id\\x2fusb-Logitech_USB_Optical_Mouse-event-mouse"
"/dev/.udev/links/input\\x2fby-id\\x2fusb-Logitech_USB_Optical_Mouse-event-mouse/c13:67"
"/dev/.udev/links/input\\x2fby-id\\x2fusb-Logitech_USB_Optical_Mouse-mouse"
"/dev/.udev/links/input\\x2fby-id\\x2fusb-Logitech_USB_Optical_Mouse-mouse/c13:33"
"/dev/.udev/links/input\\x2fby-path\\x2fpci-0000:00:12.0-usb-0:2:1.0-event-mouse"
"/dev/.udev/links/input\\x2fby-path\\x2fpci-0000:00:12.0-usb-0:2:1.0-event-mouse/c13:67"
"/dev/.udev/links/input\\x2fby-path\\x2fpci-0000:00:12.0-usb-0:2:1.0-mouse"
"/dev/.udev/links/input\\x2fby-path\\x2fpci-0000:00:12.0-usb-0:2:1.0-mouse/c13:33"
"/dev/bus/usb/004/120"
"/dev/hidraw0"
Modified:
"/dev/.udev/queue.bin"
===============================================================================
Error Report:
===============================================================================
No Errors
-------------------------------------------------------------------------------
*** End of report ***
Open Source Tripwire 2.4 Portions copyright 2000 Tripwire, Inc. Tripwire is a registered
trademark of Tripwire, Inc. This software comes with ABSOLUTELY NO WARRANTY;
for details use --version. This is free software which may be redistributed
or modified only under certain conditions; see COPYING for details.
All rights reserved.

■Tripwireの定期自動実行設定

Tripwireの定期実行スクリプトを作成
[root@server1 ~]# vi tripwire.sh
#!/bin/bash
PATH=/usr/sbin:/usr/bin:/bin:/usr/local/tripwire/sbin
# パスフレーズ設定
LOCALPASS=xxxxxxxx # ローカルパスフレーズ
SITEPASS=xxxxxxxx  # サイトパスフレーズ
cd /etc/tripwire
# Tripwireチェック実行
tripwire -m c -s -c tw.cfg|mail -s "Tripwire(R) Integrity Check Report in `hostname`" root
# ポリシーファイル最新化
twadmin -m p -c tw.cfg -p tw.pol -S site.key > twpol.txt
perl twpolmake.pl twpol.txt > twpol.txt.new
twadmin -m P -c tw.cfg -p tw.pol -S site.key -Q $SITEPASS twpol.txt.new > /dev/null
rm -f twpol.txt* *.bak
# データベース最新化
rm -f /usr/local/tripwire/lib/tripwire/*.twd*
tripwire -m i -s -c tw.cfg -P $LOCALPASS
実行スクリプトに実行権を与える
[root@server1 ~]# chmod 700 tripwire.sh
cronを編集
[root@server1 ~]# crontab -e
00 01 * * * /root/tripwire.sh
毎日1:00にTripwireの定期実行スクリプトを実行

Tripwireのアンインストール方法

[root@server1 ~]# rm -rf /usr/local/tripwire/
[root@server1 ~]# rm -rf /etc/tripwire/

Tripwire、/backupディレクトリーのチェック対象外設定

下記のようなTripwireのエラーメールが届いた。

### Warning: File system error.
### Filename: /backup/backup.tar.bz2
### Value too large for defined data type
### Continuing...

/backup/backup.tar.bz2のファイルサイズが2Gを超えてしまったため、2Gを超えるファイルに対応してないtripwireがエラーを出したようだ。なので、/backupのディレクトリーをチェック対象外にすることにした。

ポリシーファイル(テキスト版)の復活
[root@server ~]# twadmin -m p -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key > /etc/tripwire/twpol.txt
ポリシーファイル(テキスト版)の編集
[root@server ~]# vi /etc/tripwire/twpol.txt
################################################
#                                              ##
################################################ #
#                                              # #
#  Monitor Filesystems                         # #
#                                              ##
################################################
(
rulename = "Monitor Filesystems",
)
{
/                             -> $(ReadOnly) ;
/home                         -> $(ReadOnly) ;  # Modify as needed
/usr                          -> $(ReadOnly) ;
/var                          -> $(ReadOnly) ;
!/backup; ← /backupをチェック対象外にするので追加
}
ポリシーファイル(暗号署名版)を作成
[root@server ~]# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt
Please enter your site passphrase: ← サイトパスフレーズを入力
Wrote policy file: /etc/tripwire/tw.pol
ポリシーファイル(テキスト版)を削除
[root@server ~]# rm -f /etc/tripwire/twpol.txt
ポリシーファイルよりデータベースを作成
[root@server ~]# tripwire -m i -s -c /etc/tripwire/tw.cfg
Please enter your local passphrase: ← ローカルパスフレーズを入力
※データベースを作成するには結構時間がかかる

Tripwire エラー

/root/tripwire.shを実行すると以下のようなエラーが出るようになった。

[root@server ~]# /root/tripwire.sh
### Warning: File system error.
### Filename: /var/lib/rpm/__db.001
### \xa4\xbd\xa4\xce\xa4\xe8\xa4\xa6\xa4\xca\xa5\xd5\xa5\xa1\xa5\xa4\xa5\xeb\xa4\xe4\xa5\xc7\xa5\xa3\xa5\xec\xa5\xaf\xa5\xc8\xa5\xea\xa4\xcf\xa4\xa2\xa4\xea\xa4\xde\xa4\xbb\xa4\xf3
### Continuing...
### Warning: File system error.
### Filename: /var/lib/rpm/__db.002
### \xa4\xbd\xa4\xce\xa4\xe8\xa4\xa6\xa4\xca\xa5\xd5\xa5\xa1\xa5\xa4\xa5\xeb\xa4\xe4\xa5\xc7\xa5\xa3\xa5\xec\xa5\xaf\xa5\xc8\xa5\xea\xa4\xcf\xa4\xa2\xa4\xea\xa4\xde\xa4\xbb\xa4\xf3
### Continuing...
### Warning: File system error.
### Filename: /var/lib/rpm/__db.003
### \xa4\xbd\xa4\xce\xa4\xe8\xa4\xa6\xa4\xca\xa5\xd5\xa5\xa1\xa5\xa4\xa5\xeb\xa4\xe4\xa5\xc7\xa5\xa3\xa5\xec\xa5\xaf\xa5\xc8\xa5\xea\xa4\xcf\xa4\xa2\xa4\xea\xa4\xde\xa4\xbb\xa4\xf3
### Continuing...

rpmのデータベース/var/lib/rpm/__db.001~/var/lib/rpm/__db.003を念のため移動してから再構築する。

[root@server ~]# ls -l /var/lib/rpm/
合計 46964
-rw-r--r-- 1 rpm  rpm    196608  8月 11 17:17 Requireversion
-rw-r--r-- 1 rpm  rpm     81920  8月 11 17:17 Sha1header
-rw-r--r-- 1 rpm  rpm     49152  8月 11 17:17 Sigmd5
-rw-r--r-- 1 rpm  rpm     12288  7月 15 06:01 Triggername
-rw-r--r-- 1 root root    24576  8月 11 18:46 __db.001
-rw-r--r-- 1 root root  1318912  8月 11 18:46 __db.002
-rw-r--r-- 1 root root   450560  8月 11 18:46 __db.003
[root@server ~]# mv /var/lib/rpm/__db.00? /tmp
[root@server ~]# rpm --rebuilddb

再構築が終了したら正常に動作するか確認する。

[root@server ~]# rpm -qa
[root@server ~]# yum list

再度/root/tripwire.shを実行

[root@server ~]# /root/tripwire.sh

エラーは出ないようになった。