AIDE/ja

AIDE (Advanced Intrusion Detection Environment) はArticle description::ホストベースの侵入検知システムです. AIDE はファイルや他リソースをスキャンし、データベース内にこれらファイルの情報について保存します. 保存する情報はハッシュ値、ファイルサイズ、所有者、編集日時、作成日時等のような主だったファイルの属性値です. データベースを最初に作ったら、AIDE はそれからシステムを再スキャンして、前回の保存した値と今回のスキャン結果を比較します. もし値が前回と異なった場合は変更があったと報告します. AIDE の背景にある考え方は、スナップショット同士を比較して、改ざんファイルを見つけることです.

USE フラグ
USE フラグを次のように設定すると のインストールは簡単です.

特定のパッケージ固有の USE フラグは というファイルか、  と呼ばれるディレクトリの中にあるテキストファイルで設定する必要があります. 例えば ファイル の場合:

Emerge
USEフラグを設定した後、ソフトウェアをインストールします.

概要
の設定ファイルは第一印象ほどとっつきにくくはありません. デフォルトのファイルは に保存されていますが、システム管理者は必要に応じて、簡単に設定ファイルを複数作ることが出来ます. 幾つかの変数に加え、設定ファイルにはスキャンするファイル情報 (ただのハッシュ値とか、iノード情報等々) とスキャンするファイルの短い表記が含まれています.

データベースの変数を見てください:

The first line in the example above defines where the location of database that contains the known values. The second line defines where to store new databases when another is generated. It is generally recommended against having these variables point to the same database (having the same paths for each variable). If one database is to overwrite another, the best method is to manually copy over the generated database from one location to the other. For example, to overwrite the first database with the second, this command could be used:

For now, leave the database variables as they are; they will be covered in more detail later in the article.

Next, consider the variables which are short-hand notations for what information to record in the database.

The letters are described in the default file, but for convenience the following table provides an overview of the most common options:

Next is an overview of which directories to scan, and what to scan for. In three line example to follow, AIDE is instructed to scan the and  directories via the measures identified in the Binlib short-hand notation variable. The file will display the scan measures defined in the Logs variable defined above.

AIDE supports regular expressions and users are allowed to "remove" matches. For instance, to scan but not  then make an exclusion set by using the   (exclamation point) before the excluded path(s):

詳細オプション
The configuration file is based on regular expressions, macros and rules for files and directories. Users experienced with the tripwire solution will have no difficulties dealing with AIDE's configuration file. The following macros are available:

These macros become very handy when dealing with multiple Gentoo boxes, while using the same configuration on all. Not all machines run the same services or even have the same users.

Next we have a set of flags which identify the permissions, file properties, checksums, cryptographic hashes, ... to validate on files and directories.

If AIDE is compiled with mhash support, then the following flags can be used as well:

初期化と定期スキャン
For a basic AIDE setup, a database must be initialized. This is performed using the  option. To make sure AIDE uses the configuration settings defined in the sections before, be sure to pass the  option pointed to the correct configuration file:

Once initialized, any pre-existing database files can be copied over:

With a new database available, the entries can be scanned again (now or at a later date) using the  option. This will create another database containing any modifications that have made to the file system since the first database has been created. Be sure to use the  option pointed to the same configuration file that the first database was created with:

If file modification(s) occurred, a notification will be sent out:

スキャン対象の明確化
The default AIDE configuration is useful, but it needs to be fine-tuned to suit the users' needs. It is important to know which files to scan and why.

For instance, to scan for all authentication-related files but not for other files, use a configuration like so:

データベースをオフラインと読み取り専用に
A second important aspect is that the result database should be stored offline when not needed and should be used in read-only mode when the database is needed. This gives some protection against a malicious user that might have compromised the machine to modify the results database. For instance, provide the result database on a read-only NFS mount (for servers) or read-only medium (when physical access to the machine is possible) such as a CD/DVD or a read-only USB drive.

After storing the database on a read-only location, update the file to have   point to this new location.

オフラインスキャン
If applicable, try using offline scanning methods for the system. In case of virtual platforms, it might be possible to take a snapshot of the system, mount this snapshot (read-only) and then run the aide scan on the mounted file system.

The above approach uses. This is only needed when the initial file system has been scanned from the live system and the administrator wants to perform an offline validation. If the initial scan was done offline, then the file will point to the mount point already and the database will use these paths immediately, so then there is no need for chrooting.

参考

 * 完全性/コンセプト では、システムの完全性に関する概念について説明します.

外部の情報

 * AIDE の使い方チュートリアル (Linux.com)
 * Securing Linux with AIDE article (Symantec.com)