0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

侵入検知システム(IDS:Intrusion Detection System)の設定 AIDE

Posted at

ホスト型IDS 「AIDE」

IDSはネットワークやサーバ上の不正侵入を検出する機能
AIDEはホスト型IDSです。

# データベースを初期化する(現在のデータ情報を登録)
aide --init

AIDE, version 0.15.1

### AIDE database at /var/lib/aide/aide.db.new.gz initialized.
# 初期化したデータベース情報を使用するデータベースファイルにコピー
cp /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
# 情報に差異がないかチェック
aide --check
# tail -f /var/log/aide.log  リアルタイムで出力する場合は別ターミナルで実行

# 対象のファイル、ディレクトリが変更(改ざん)されていない場合の出力
AIDE, version 0.15.1

### All files match AIDE database. Looks okay!

# ファイルを変更する
chmod g+w /etc/passwd
-rw-rw-r-- 1 root root 1139 May 14 14:41 /etc/passwd
# 情報に差異がないかチェック
aide --check
# 対象のファイル、ディレクトリが変更(改ざん)されている場合の出力
AIDE 0.15.1 found differences between database and filesystem!!
Start timestamp: 2020-06-20 09:38:05

Summary:
  Total number of files:	47788
  Added files:			0
  Removed files:		0
  Changed files:		1


---------------------------------------------------
Changed files:
---------------------------------------------------

changed: /etc/passwd

---------------------------------------------------
Detailed information about changes:
---------------------------------------------------


File: /etc/passwd
 Perm     : -rw-r--r--                       , -rw-rw-r--
 ACL      : old = A:
----
user::rw-
group::r--
other::r--
----
                  D: <NONE>
            new = A:
----
user::rw-
group::rw-
other::r--
----
                  D: <NONE>

/etc/aide.confファイルでチェックするファイル、ディレクトリの詳細を設定する

/etc/aide.conf

vi /etc/aide/aide.conf
@@define DBDIR /var/lib/aide
@@define LOGDIR /var/log/aide

# The location of the database to be read.
database=file:@@{DBDIR}/aide.db.gz

# The location of the database to be written.
# database_out=sql:host:port:database:login_name:passwd:table
# database_out=file:aide.db.new
database_out=file:@@{DBDIR}/aide.db.new.gz

# Whether to gzip the output to database.
gzip_dbout=yes

# Default.
verbose=5

report_url=file:@@{LOGDIR}/aide.log
report_url=stdout
# report_url=stderr
# NOT IMPLEMENTED report_url=mailto:root@foo.com
# NOT IMPLEMENTED report_url=syslog:LOG_AUTH
# These are the default rules.
# p:      permissions
# i:      inode:
# n:      number of links
# u:      user
# g:      group
# s:      size
# b:      block count
# m:      mtime
# a:      atime
# c:      ctime
# S:      check for growing size
# acl:    Access Control Lists
# selinux:  SELinux security context
# xattrs:  Extended file attributes
# md5:    md5 checksum
# sha1:   sha1 checksum
# sha256:  sha256 checksum
# sha512:  sha512 checksum
# rmd160: rmd160 checksum
# tiger:  tiger checksum
# haval:  haval checksum (MHASH only)
# gost:   gost checksum (MHASH only)
# crc32:  crc32 checksum (MHASH only)
# whirlpool:     whirlpool checksum (MHASH only)
HFIPSR = p+i+n+u+g+s+m+c+acl+selinux+xattrs+sha256
# R: p+i+n+u+g+s+m+c+acl+selinux+xattrs+md5
# L: p+i+n+u+g+acl+selinux+xattrs
# E: Empty group
# >: Growing logfile p+u+g+i+n+S+acl+selinux+xattrs
# You can create custom rules like this.
# With MHASH...
# ALLXTRAHASHES = sha1+rmd160+sha256+sha512+whirlpool+tiger+haval+gost+crc32
HALLXTRAHASHES = sha1+rmd160+sha256+sha512+tiger
# Everything but access time (Ie. all changes)
HEVERYTHING = R+ALLXTRAHASHES
# Sane, with one good hash.
# NORMAL = sha256
NORMAL = sha256
# For directories, don't bother doing hashes.
DIR = p+i+n+u+g+acl+selinux+xattrs
# Access control only.
PERMS = p+u+g+acl+selinux+xattrs
# Access + inode changes + file type.
STATIC = p+u+g+acl+selinux+xattrs+i+n+b+c+ftype
# Logfiles only check access w/o xattrs.
LOG = p+u+g+n+acl+selinux+ftype
# Content + file type.
CONTENT = sha256+ftype
# Extended content + file type + access.
CONTENT_EX = sha256+ftype+p+u+g+n+acl+selinux+xattrs
# Some files get updated automatically, so the inode/ctime/mtime change
# but we want to know when the data inside them changes.
DATAONLY =  p+n+u+g+s+acl+selinux+xattrs+sha256

(略)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?