Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2912

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

$
0
0

ホスト型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
@@defineDBDIR /var/lib/aide
@@defineLOGDIR /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=5report_url=file:@@{LOGDIR}/aide.logreport_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

(略)

Viewing all articles
Browse latest Browse all 2912

Trending Articles