AIDE/ru

AIDE (Advanced Intrusion Detection Environment) is a host-based intrusion detection system. AIDE scans files and other resources and stores information about these files in a database. Stored information includes key file attributes such as file hash output, file size, ownership, modification time, creation time, and more. After the initial database has been created, AIDE then rescans the system and compares new scan results with previously stored values. If values differ then the file has been changed and the change will be reported. The idea behind using AIDE is to create a snapshot of a system then compare the snapshot to another created snapshot to find compromised files.

USE-флаги
It is easy to install after setting the USE flags accordingly.

USE flag changes specific to a certain package should be defined in the file, or a text file inside a directory called. For example, when using a file:

Emerge
After the USE flags have been set, install the software:

Configuration
Файл настроек aide не настолько устрашающий, как это может показаться с первого взгляда. Файл по умолчанию хранится в, но если это необходимо, администраторы легко могут создать множественные отдельные файлы настроек. Кроме нескольких переменных, файл настроек содержит несколько кратких обозначений для того, какие аспекты файлов нужно сканировать (только хэш-суммы, или также информацию об индексных дескрипторах (inodes), и т.д.) и затем, какие файлы нужно сканировать.

Давайте сначала рассмотрим переменные.

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.

The next file to consider is the file. The values of the variable 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):

Инициализация и частое сканирование
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:

Если произошло изменение файла(ов), будет послано уведомление:

Be clear on what to scan
Файл конфигурации AIDE по умолчанию полезен, но требуется его тонкая настройка для соответствия требованиям пользователей. Важно знать какие файлы нужно сканировать и почему.

Например, для сканирования всех файлов, связанных с аутентификацией, и никаких других файлов, используйте следующие настройки:

Храните базу данных на внешнем носителе и в режиме только для чтения
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.

Делайте автономное сканирование
Если необходимо, попытайтесь использовать автономные методы сканирования системы. В случае с виртуальными платформами, возможно сделать снимок системы, смонтировать этот снимок (с доступом только на чтение) и затем запустить aide сканирование на примонтированной файловой системе.

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.

Смотри также

 * Integrity/Concepts повествует об идеях связанных с целостностью системы

External resources

 * Tutorial on how to use AIDE (Linux.com)
 * Securing Linux with AIDE article (Symantec.com)