Suricata : ネットワーク型 IDS2025/03/25 |
|
ネットワーク型 IDS (Intrusion Detection System)、Suricata のインストールと設定です。 |
|
| [1] | Suricata をインストールします。 |
|
# EPEL からインストール [root@dlp ~]# dnf --enablerepo=epel -y install suricata
|
| [2] | Suricata の設定です。 |
|
[root@dlp ~]#
vi /etc/suricata/suricata.yaml
# 18行目 : 自身のローカルネットワークに変更
HOME_NET: "[10.0.0.0/24]"
# 24行目 : 外部ネットワークを指定可
# デフォルトは上で指定したローカルネットワーク以外
EXTERNAL_NET: "!$HOME_NET"
#EXTERNAL_NET: "any"
# 622行目 : 自身のネットワークインターフェース名に変更
af-packet:
- interface: enp1s0
[root@dlp ~]#
vi /etc/sysconfig/suricata # 自身のネットワークインターフェース名に変更 OPTIONS="-i enp1s0 --user suricata " # update rules [root@dlp ~]# suricata-update 25/3/2025 -- 10:49:10 - <Info> -- Using data-directory /var/lib/suricata. 25/3/2025 -- 10:49:10 - <Info> -- Using Suricata configuration /etc/suricata/suricata.yaml 25/3/2025 -- 10:49:10 - <Info> -- Using /usr/share/suricata/rules for Suricata provided rules. 25/3/2025 -- 10:49:10 - <Info> -- Found Suricata version 7.0.8 at /usr/sbin/suricata. 25/3/2025 -- 10:49:10 - <Info> -- Loading /etc/suricata/suricata.yaml 25/3/2025 -- 10:49:10 - <Info> -- Disabling rules for protocol pgsql 25/3/2025 -- 10:49:10 - <Info> -- Disabling rules for protocol modbus 25/3/2025 -- 10:49:10 - <Info> -- Disabling rules for protocol dnp3 25/3/2025 -- 10:49:10 - <Info> -- Disabling rules for protocol enip 25/3/2025 -- 10:49:10 - <Info> -- No sources configured, will use Emerging Threats Open ..... .....[root@dlp ~]# systemctl enable --now suricata |
| [3] | アラートログは [/var/log/suricata] 配下に保管されます。. 例えば、Suricata の公式ドキュメントにあるように、他ホストから HTTP アクセスで [(Suricata ホスト)/uid/index.html] へアクセスすると、検知の動作を確認できます。 |
|
[root@dlp ~]# ll /var/log/suricata total 4 -rw-r--r--. 1 suricata suricata 0 Mar 25 10:50 eve.json -rw-r--r--. 1 suricata suricata 0 Mar 25 10:50 fast.log -rw-r--r--. 1 suricata suricata 0 Mar 25 10:50 stats.log -rw-r--r--. 1 suricata suricata 1759 Mar 25 10:50 suricata.log[root@dlp ~]# cat /var/log/suricata/fast.log
03/25/2025-11:03:09.950891 [**] [1:2034567:1] ET HUNTING curl User-Agent to Dotted Quad [**] [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 10.0.0.211:55808 -> 10.0.0.30:80
[root@dlp ~]# cat /var/log/suricata/eve.json | jq 'select(.event_type=="alert")'
{
"timestamp": "2025-03-25T00:44:54.901080+0000",
"flow_id": 1897831897634293,
"in_iface": "enp1s0",
"event_type": "alert",
"src_ip": "10.0.0.211",
"src_port": 41470,
"dest_ip": "10.0.0.30",
"dest_port": 80,
"proto": "TCP",
"pkt_src": "wire/pcap",
"metadata": {
"flowbits": [
"http.dottedquadhost"
]
},
"tx_id": 0,
"alert": {
"action": "allowed",
"gid": 1,
"signature_id": 2034567,
"rev": 1,
"signature": "ET HUNTING curl User-Agent to Dotted Quad",
"category": "Potentially Bad Traffic",
"severity": 2,
"metadata": {
"attack_target": [
"Client_Endpoint"
],
"confidence": [
"Medium"
],
"created_at": [
"2021_12_01"
],
"deployment": [
"Perimeter"
],
"signature_severity": [
"Informational"
],
"updated_at": [
"2021_12_01"
]
}
},
"http": {
"hostname": "10.0.0.30",
"url": "/uid/index.html",
"http_user_agent": "curl/8.5.0",
"http_content_type": "text/html",
"http_method": "GET",
"protocol": "HTTP/1.1",
"status": 404,
"length": 271
},
"app_proto": "http",
"direction": "to_server",
"flow": {
"pkts_toserver": 4,
"pkts_toclient": 3,
"bytes_toserver": 358,
"bytes_toclient": 638,
"start": "2025-03-25T00:44:54.900625+0000",
"src_ip": "10.0.0.211",
"dest_ip": "10.0.0.30",
"src_port": 41470,
"dest_port": 80
}
}
|
| Sponsored Link |
|
|