顯示具有 OSSEC 標籤的文章。 顯示所有文章
顯示具有 OSSEC 標籤的文章。 顯示所有文章

2026年9月2日 星期三

[研究]OSSEC HIDS v4.1.0 Server 安裝 (Ubuntu 26.04 LTS)

[研究]OSSEC HIDS v4.1.0 Server 安裝 (Ubuntu 26.04 LTS) 

HIDS 主機型入侵偵測系統

2026-09-01

OSSEC Open Source Security Version: 4.2.0
https://www.ossec.net/ossec-downloads/

基本架構


Windows Server 2019 │ │ UDP 1514 ▼ ┌─────────────────────┐ │ Ubuntu OSSEC 4.2.0 │ │ Manager │ │ │ │ /var/ossec/ │ │ ├── etc/ │ │ ├── logs/ │ │ ├── rules/ │ │ └── bin/ │ └─────────────────────┘

Installation requirements
https://www.ossec.net/docs/docs/manual/installation/installation-requirements.html#install-req

Manager/Agent Installation
https://www.ossec.net/docs/docs/manual/installation/install-source.html

APT Automated Installation on Ubuntu
https://www.ossec.net/download-ossec/


wget -q -O - https://updates.atomicorp.com/installers/atomic | sudo bash apt-get update apt-get install ossec-hids-server


OSSEC 4.2.0 — ossec-control
https://www.ossec.net/docs/docs/programs/ossec-control.html


sudo /var/ossec/bin/ossec-control start sudo /var/ossec/bin/ossec-control stop sudo /var/ossec/bin/ossec-control restart sudo /var/ossec/bin/ossec-control status



user1@ubuntu2604lts:~$ sudo /var/ossec/bin/ossec-control status ossec-monitord not running... ossec-logcollector not running... ossec-remoted not running... ossec-syscheckd not running... ossec-analysisd not running... ossec-maild not running... ossec-execd not running... user1@ubuntu2604lts:~$ sudo /var/ossec/bin/ossec-control start Starting OSSEC HIDS v4.1.0... 2026/09/01 13:58:56 ossec-maild(1501): ERROR: Invalid SMTP Server: smtp.example.com. 2026/09/01 13:58:56 ossec-maild(1202): ERROR: Configuration error at '/var/ossec/etc/ossec.conf'. Exiting. 2026/09/01 13:58:56 ossec-maild(1202): ERROR: Configuration error at '/var/ossec/etc/ossec.conf'. Exiting. ossec-maild did not start correctly. user1@ubuntu2604lts:~$


修改設定,


sudo nano /var/ossec/etc/ossec.conf




user1@ubuntu2604lts:~$ sudo cat /var/ossec/etc/ossec.conf <!-- OSSEC example config --> <ossec_config> <global> <email_notification>yes</email_notification> <email_to>daniel.cid@example.com</email_to> <smtp_server>smtp.example.com.</smtp_server> <email_from>ossecm@ossec.example.com.</email_from> </global> <rules> <include>rules_config.xml</include> <include>pam_rules.xml</include> <include>sshd_rules.xml</include> <include>telnetd_rules.xml</include> <include>syslog_rules.xml</include> <include>arpwatch_rules.xml</include> <include>symantec-av_rules.xml</include> <include>symantec-ws_rules.xml</include> <include>pix_rules.xml</include> <include>named_rules.xml</include> <include>smbd_rules.xml</include> <include>vsftpd_rules.xml</include> <include>pure-ftpd_rules.xml</include> <include>proftpd_rules.xml</include> <include>ms_ftpd_rules.xml</include> <include>ftpd_rules.xml</include> <include>hordeimp_rules.xml</include> <include>roundcube_rules.xml</include> <include>wordpress_rules.xml</include> <include>cimserver_rules.xml</include> <include>vpopmail_rules.xml</include> <include>vmpop3d_rules.xml</include> <include>courier_rules.xml</include> <include>web_rules.xml</include> <include>web_appsec_rules.xml</include> <include>apache_rules.xml</include> <include>nginx_rules.xml</include> <include>php_rules.xml</include> <include>mysql_rules.xml</include> <include>postgresql_rules.xml</include> <include>ids_rules.xml</include> <include>squid_rules.xml</include> <include>firewall_rules.xml</include> <include>apparmor_rules.xml</include> <include>cisco-ios_rules.xml</include> <include>netscreenfw_rules.xml</include> <include>sonicwall_rules.xml</include> <include>postfix_rules.xml</include> <include>sendmail_rules.xml</include> <include>imapd_rules.xml</include> <include>mailscanner_rules.xml</include> <include>dovecot_rules.xml</include> <include>ms-exchange_rules.xml</include> <include>racoon_rules.xml</include> <include>vpn_concentrator_rules.xml</include> <include>spamd_rules.xml</include> <include>msauth_rules.xml</include> <include>mcafee_av_rules.xml</include> <include>trend-osce_rules.xml</include> <include>ms-se_rules.xml</include> <!-- <include>policy_rules.xml</include> --> <include>zeus_rules.xml</include> <include>solaris_bsm_rules.xml</include> <include>vmware_rules.xml</include> <include>ms_dhcp_rules.xml</include> <include>asterisk_rules.xml</include> <include>ossec_rules.xml</include> <include>attack_rules.xml</include> <include>dropbear_rules.xml</include> <include>unbound_rules.xml</include> <include>sysmon_rules.xml</include> <include>opensmtpd_rules.xml</include> <include>exim_rules.xml</include> <include>openbsd-dhcpd_rules.xml</include> <include>dnsmasq_rules.xml</include> <include>local_rules.xml</include> </rules> <syscheck> <!-- Frequency that syscheck is executed -- default every 20 hours --> <frequency>72000</frequency> <!-- Directories to check (perform all possible verifications) --> <directories check_all="yes">/etc,/usr/bin,/usr/sbin</directories> <directories check_all="yes">/bin,/sbin,/boot</directories> <!-- Files/directories to ignore --> <ignore>/etc/mtab</ignore> <ignore>/etc/hosts.deny</ignore> <ignore>/etc/mail/statistics</ignore> <ignore>/etc/random-seed</ignore> <ignore>/etc/random.seed</ignore> <ignore>/etc/adjtime</ignore> <ignore>/etc/httpd/logs</ignore> <!-- Check the file, but never compute the diff --> <nodiff>/etc/ssl/private.key</nodiff> </syscheck> <rootcheck> <rootkit_files>/var/ossec/etc/shared/rootkit_files.txt</rootkit_files> <rootkit_trojans>/var/ossec/etc/shared/rootkit_trojans.txt</rootkit_trojans> </rootcheck> <global> <white_list>127.0.0.1</white_list> <white_list>::1</white_list> <white_list>192.168.2.1</white_list> <white_list>192.168.2.190</white_list> <white_list>192.168.2.32</white_list> <white_list>192.168.2.10</white_list> </global> <remote> <connection>secure</connection> </remote> <alerts> <log_alert_level>1</log_alert_level> <email_alert_level>7</email_alert_level> </alerts> <command> <name>host-deny</name> <executable>host-deny.sh</executable> <expect>srcip</expect> <timeout_allowed>yes</timeout_allowed> </command> <command> <name>firewall-drop</name> <executable>firewall-drop.sh</executable> <expect>srcip</expect> <timeout_allowed>yes</timeout_allowed> </command> <command> <name>disable-account</name> <executable>disable-account.sh</executable> <expect>user</expect> <timeout_allowed>yes</timeout_allowed> </command> <!-- Active Response Config --> <active-response> <!-- This response is going to execute the host-deny - command for every event that fires a rule with - level (severity) >= 6. - The IP is going to be blocked for 600 seconds. --> <command>host-deny</command> <location>local</location> <level>7</level> <timeout>600</timeout> </active-response> <active-response> <!-- Firewall Drop response. Block the IP for - 600 seconds on the firewall (iptables, - ipfilter, etc). --> <command>firewall-drop</command> <location>local</location> <level>7</level> <timeout>600</timeout> </active-response> <!-- Files to monitor (localfiles) --> <localfile> <log_format>syslog</log_format> <location>/var/log/messages</location> </localfile> <localfile> <log_format>syslog</log_format> <location>/var/log/authlog</location> </localfile> <localfile> <log_format>syslog</log_format> <location>/var/log/auth.log</location> </localfile> <localfile> <log_format>syslog</log_format> <location>/var/log/secure</location> </localfile> <localfile> <log_format>syslog</log_format> <location>/var/log/xferlog</location> </localfile> <localfile> <log_format>syslog</log_format> <location>/var/log/maillog</location> </localfile> <localfile> <log_format>apache</log_format> <location>/var/www/logs/access_log</location> </localfile> <localfile> <log_format>apache</log_format> <location>/var/www/logs/error_log</location> </localfile> <localfile> <log_format>syslog</log_format> <location>/var/log/exim_mainlog</location> </localfile> </ossec_config> user1@ubuntu2604l


如果沒有要寄信,把下面 yes 改成 no,重新啟動


<email_notification>yes</email_notification>


重新啟動


user1@ubuntu2604lts:~$ sudo /var/ossec/bin/ossec-control restart ossec-monitord not running .. ossec-logcollector not running .. ossec-remoted not running .. ossec-syscheckd not running .. ossec-analysisd not running .. ossec-maild not running .. ossec-execd not running .. OSSEC HIDS v4.1.0 Stopped Starting OSSEC HIDS v4.1.0... Started ossec-execd... Started ossec-analysisd... Started ossec-logcollector... Started ossec-remoted... Started ossec-syscheckd... Started ossec-monitord... Completed. user1@ubuntu2604lts:~$


4.2.0版才有version參數


ser1@ubuntu2604lts:~$ sudo /var/ossec/bin/ossec-control version Usage: /var/ossec/bin/ossec-control {start|stop|reload|restart|status|enable|disable} user1@ubuntu2604lts:~$



user1@ubuntu2604lts:~$ dpkg -l | grep ossec ii ossec-hids-server 4.1.0-40639resolute amd64 OSSEC Server - Host Based Intrusion Detection System user1@ubuntu2604lts:~$



ser1@ubuntu2604lts:~$ sudo tail -f /var/ossec/logs/ossec.log 2026/09/01 14:09:02 ossec-syscheckd: INFO: Starting syscheck scan (forwarding database). 2026/09/01 14:09:02 ossec-syscheckd: INFO: Starting syscheck database (pre-scan). 2026/09/01 14:10:11 ossec-logcollector(1904): INFO: File not available, ignoring it: '/var/log/messages'. 2026/09/01 14:10:11 ossec-logcollector(1904): INFO: File not available, ignoring it: '/var/log/authlog'. 2026/09/01 14:10:11 ossec-logcollector(1904): INFO: File not available, ignoring it: '/var/log/secure'. 2026/09/01 14:10:11 ossec-logcollector(1904): INFO: File not available, ignoring it: '/var/log/xferlog'. 2026/09/01 14:10:11 ossec-logcollector(1904): INFO: File not available, ignoring it: '/var/log/maillog'. 2026/09/01 14:10:11 ossec-logcollector(1904): INFO: File not available, ignoring it: '/var/www/logs/access_log'. 2026/09/01 14:10:11 ossec-logcollector(1904): INFO: File not available, ignoring it: '/var/www/logs/error_log'. 2026/09/01 14:10:11 ossec-logcollector(1904): INFO: File not available, ignoring it: '/var/log/exim_mainlog'.


OSSEC Web GUI 比較

名稱 OSSEC 4.x Ubuntu 26.04 Web URL Agent 管理 Alert FIM 安裝難度 推薦
OSSEC Web UI (ossec-wui) ⚠️ 未正式支援 ⚠️ 不建議 http://Server/ossec-wui/ △ ✅ △ ★★☆☆☆ 35/100
KOFE:Kibana + OSSEC + Filebeat + Elasticsearch ⚠️ 舊架構 ❌ 不建議直接使用 Kibana URL ❌ ✅ △ ★★★★☆ 45/100
Kibana + OSSEC Log/Filebeat 自建 △ △ http://Server:5601 ❌ ✅ △ ★★★★★ 50/100
Splunk + OSSEC △ ✅ https://Server:8000 ❌ ✅ △ ★★★★☆ 55/100
OpenSearch Dashboards + OSSEC △ △ https://Server:5601 ❌ ✅ △ ★★★★☆ 65/100
Atomic OSSEC GUI ✅ 依版本 Web GUI ✅ ✅ ✅ ★★★☆☆ 90/100*
Wazuh Dashboard ❌(不是 OSSEC Server GUI) ✅* https://Server/ ✅ ✅ ✅ ★★★☆☆ 95/100*

* Atomic OSSEC GUI 並不是單純免費 OSSEC 的 Web GUI;官方目前將 GUI、SIEM、FIM、OpenSearch 整合等列為 Atomic OSSEC 的功能。官方也明確區分免費 OSSEC 與商業 Atomic OSSEC。

* Wazuh 是 OSSEC 的衍生/獨立發展平台,不應該理解成「OSSEC 4.x 的 Web GUI」。Wazuh 自己有 Server、Indexer、Dashboard 三個核心元件,Dashboard 才是它的 Web 管理介面。

Web畫面推薦

排名方案評分我的建議
🥇Wazuh95⭐⭐⭐⭐⭐ 最推薦,但不是 OSSEC 4.x GUI
🥈OpenSearch + OSSEC65⭐⭐⭐⭐ 適合自己組 SIEM
🥉Splunk + OSSEC55⭐⭐⭐ 有強大搜尋,但不是完整 OSSEC GUI
4Kibana + OSSEC/Filebeat50⭐⭐⭐ 舊架構,不建議新建
5KOFE45⭐⭐ 太舊
6OSSEC Web UI35⭐ 不建議,已 Deprecated

https://www.ossec.net/ossec-gui-dashboard/

建議直接架設 Wazuh。

(完)

2026年8月27日 星期四

[研究]OSSEC 和 Wazuh 演變關係?

[研究]OSSEC 和 Wazuh 演變關係?

2026-08-27

1. OSSEC 與 Wazuh 的演變關係


OSSEC (原始 HIDS 專案) │ │ 2015 ▼ Wazuh (OSSEC Fork) │ ┌─────────┴──────────┐ │ │ Wazuh Agent Wazuh Manager │ │ └──────────┬─────────┘ ▼ Wazuh Platform SIEM + XDR + HIDS/FIM

Wazuh 是 OSSEC 的 fork,不是 OSSEC 的下一個版本。 Wazuh 團隊在 2015 年從 OSSEC fork 出來,最初保留大量 OSSEC 核心能力,之後逐漸加入自己的功能與架構。Wazuh 官方也明確稱它是 OSSEC fork。

2. 還有另一條重要分支:Atomic OSSEC


OSSEC │ ┌─────────────┴─────────────┐ │ │ Wazuh(2015) Atomic OSSEC │ │ Open Source 商業產品 │ SIEM / XDR / HIDS FIM / Log / EDR-like

OSSEC 目前仍然存在,而且官方網站目前仍把它定位為免費、開源 HIDS;Atomicorp 則在 OSSEC 基礎上推出 Atomic OSSEC 商業增強版。

https://www.ossec.net/

3. 三者比較

項目 OSSEC Wazuh Atomic OSSEC
關係 原始專案 OSSEC fork OSSEC 商業增強版
起源 2004 年左右 2015 fork Atomicorp 擴充 OSSEC
授權 GPLv2 GPLv2 / Open Source 商業
HIDS ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Log Analysis ✅ ✅ 加強 ✅ 加強
FIM 目錄/檔案監控 ✅ ✅ 加強 ✅ 強
Windows Agent ✅ ✅ ✅
Linux Agent ✅ ✅ ✅
Active Response ✅ ✅ ✅
Rootkit Detection ✅ ✅ ✅
Vulnerability Detection 較有限 ✅ ✅
Compliance ✅ ✅ 強化 ✅ 強化
Web GUI 較弱/非核心 ✅ ✅
REST API 較有限 ✅ ✅
SIEM ❌ 傳統 HIDS ✅ ✅
XDR ❌ ✅ ✅
EDR 能力 ❌/有限 部分 EDR/XDR 能力 較完整
Cloud Security 有限 ✅ ✅
Container Security 有限 ✅ ✅
適合新建環境 △ ◎ ◎
免費 ✅ ✅ ❌

Wazuh 後來加入 Elastic Stack、OpenSCAP、API、較強的 JSON/log processing,以及逐漸發展成 SIEM/XDR 平台;Wazuh 官方在 4.x 時已明確將產品定位為統一的 SIEM/XDR 平台。

https://wazuh.com/blog/introducing-wazuh-4-3-0/


(完)

2014年8月16日 星期六

[研究] OSSEC - HIDS 2.8 主機型入侵偵測系統 - local 安裝 (CentOS 7.0 x86_64)

[研究] OSSEC - HIDS 2.8 主機型入侵偵測系統 - local 安裝 (CentOS 7.0 x86_64)

2014-08-16

官方網站
http://www.ossec.net/

下載
http://www.ossec.net/main/downloads

安裝


yum -y install gcc httpd php
service httpd restart
cd /usr/local/src
wget http://www.ossec.net/files/ossec-hids-2.8.tar.gz
wget http://www.ossec.net/files/ossec-wui-0.8.tar.gz

tar zxvf ossec-hids-2.8.tar.gz
cd ossec-hids-2.8
./install.sh
cd ..

tar zxvf ossec-wui-0.8.tar.gz -C /var/www/html
mv  /var/www/html/ossec-wui-0.8  /var/www/html/ossec

usermod -G ossec apache
cat /etc/group | grep ossec

# /var/ossec/bin/ossec-control start
# vi /var/ossec/etc/ossec.conf

service ossec restart
systemctl  status  ossec
service httpd restart
firefox http://localhost/ossec &


對 ossec-hids-2.8.tar.gz 做 install.sh 時候會出現一些設定詢問,基本上都是 Enter 用預設值
(安裝型態小弟選 local,有空再測試 server 和 agent)

 (en/br/cn/de/el/es/fr/it/jp/nl/pl/ru/sr/tr) [en]:

1- What kind of installation do you want (server, agent, local or help)?  local  
...(略)

 - System is Redhat Linux.
 - Init script modified to start OSSEC HIDS during boot.

 - Configuration finished properly.

 - To start OSSEC HIDS:
                /var/ossec/bin/ossec-control start

 - To stop OSSEC HIDS:
                /var/ossec/bin/ossec-control stop

 - The configuration can be viewed or modified at /var/ossec/etc/ossec.conf


    Thanks for using the OSSEC HIDS.
    If you have any question, suggestion or if you find any bug,
    contact us at contact@ossec.net or using our public maillist at
    ossec-list@ossec.net
    ( http://www.ossec.net/main/support/ ).

    More information can be found at http://www.ossec.net

    ---  Press ENTER to finish (maybe more information below). ---


[root@localhost ossec-hids-2.8]#








(完)

[研究] OSSEC - HIDS 2.8 主機型入侵偵測系統 - local 安裝 (CentOS 7.0 x86_64)
http://shaurong.blogspot.com/2014/08/ossec-hids-28-local-centos-70-x8664.html

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - server/agent 安裝 (CentOS 6.5 x64)
http://shaurong.blogspot.com/2014/02/ossec-hids-271-serveragent-centos-65-x64.html

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - local 安裝 (CentOS 6.5 x64)
http://shaurong.blogspot.com/2014/02/ossec-hids-271-local-centos-65-x64.html

[研究] OSSEC - HIDS 2.6 主機型入侵偵測系統 (CentOS 6.0 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=20340

2014年2月5日 星期三

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - server/agent 安裝 (CentOS 6.5 x64)

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - server/agent 安裝 (CentOS 6.5 x64)

2014-02-05

官方網站
http://www.ossec.net/

下載
http://www.ossec.net/main/downloads

環境

192.168.128.101   OSSEC - HIDS 2.7.1 server  (CentOS 6.5 x86_64)
192.168.128.102   OSSEC - HIDS 2.7.1 agent   (CentOS 6.5 x86_64)

(一) Server 安裝


yum -y install gcc httpd php
service httpd restart
wget http://www.ossec.net/files/ossec-hids-2.7.1.tar.gz
wget http://www.ossec.net/files/ossec-wui-0.8.tar.gz

tar zxvf ossec-hids-2.7.1.tar.gz
cd ossec-hids-2.7.1
# install.sh 的設定稍後說明,有 server, agnet, local 等不同選擇設定
./install.sh
cd ..

tar zxvf ossec-wui-0.8.tar.gz -C /var/www/html
mv  /var/www/html/ossec-wui-0.8  /var/www/html/ossec

usermod -G ossec apache
cat /etc/group | grep ossec

# /var/ossec/bin/ossec-control start
# vi /var/ossec/etc/ossec.conf

service ossec restart
service httpd restart
firefox http://localhost/ossec &


對 ossec-hids-2.7.1.tar.gz 做 install.sh 時候會出現一些設定詢問,基本上都是 Enter 用預設值
(安裝型態小弟選 local,有空再測試 server 和 agent)


[root@server ossec-hids-2.7.1]# ./install.sh

 (en/br/cn/de/el/es/fr/it/jp/nl/pl/ru/sr/tr) [en]:

 OSSEC HIDS v2.7.1 Installation Script - http://www.ossec.net

 You are about to start the installation process of the OSSEC HIDS.
 You must have a C compiler pre-installed in your system.
 If you have any questions or comments, please send an e-mail
 to dcid@ossec.net (or daniel.cid@gmail.com).

  - System: Linux server 2.6.32-431.el6.x86_64
  - User: root
  - Host: server


  -- Press ENTER to continue or Ctrl-C to abort. --


1- What kind of installation do you want (server, agent, local, hybrid or help)? server

  - Server installation chosen.

2- Setting up the installation environment.

 - Choose where to install the OSSEC HIDS [/var/ossec]:

    - Installation will be made at  /var/ossec .

3- Configuring the OSSEC HIDS.

  3.1- Do you want e-mail notification? (y/n) [y]:
   - What's your e-mail address? root@localhost

   - We found your SMTP server as: 127.0.0.1
   - Do you want to use it? (y/n) [y]:

   --- Using SMTP server:  127.0.0.1

  3.2- Do you want to run the integrity check daemon? (y/n) [y]:

   - Running syscheck (integrity check daemon).

  3.3- Do you want to run the rootkit detection engine? (y/n) [y]:

   - Running rootcheck (rootkit detection).

  3.4- Active response allows you to execute a specific
       command based on the events received. For example,
       you can block an IP address or disable access for
       a specific user.
       More information at:
       http://www.ossec.net/en/manual.html#active-response

   - Do you want to enable active response? (y/n) [y]:

     - Active response enabled.

   - By default, we can enable the host-deny and the
     firewall-drop responses. The first one will add
     a host to the /etc/hosts.deny and the second one
     will block the host on iptables (if linux) or on
     ipfilter (if Solaris, FreeBSD or NetBSD).
   - They can be used to stop SSHD brute force scans,
     portscans and some other forms of attacks. You can
     also add them to block on snort events, for example.

   - Do you want to enable the firewall-drop response? (y/n) [y]:

     - firewall-drop enabled (local) for levels >= 6

   - Default white list for the active response:
      - 192.168.128.2

   - Do you want to add more IPs to the white list? (y/n)? [n]:

  3.5- Do you want to enable remote syslog (port 514 udp)? (y/n) [y]:

   - Remote syslog enabled.

  3.6- Setting the configuration to analyze the following logs:
    -- /var/log/messages
    -- /var/log/secure
    -- /var/log/maillog
    -- /var/log/httpd/error_log (apache log)
    -- /var/log/httpd/access_log (apache log)

 - If you want to monitor any other file, just change
   the ossec.conf and add a new localfile entry.
   Any questions about the configuration can be answered
   by visiting us online at http://www.ossec.net .


   --- Press ENTER to continue ---

... (略)


 - System is Redhat Linux.
 - Init script modified to start OSSEC HIDS during boot.

 - Configuration finished properly.

 - To start OSSEC HIDS:
                /var/ossec/bin/ossec-control start

 - To stop OSSEC HIDS:
                /var/ossec/bin/ossec-control stop

 - The configuration can be viewed or modified at /var/ossec/etc/ossec.conf


    Thanks for using the OSSEC HIDS.
    If you have any question, suggestion or if you find any bug,
    contact us at contact@ossec.net or using our public maillist at
    ossec-list@ossec.net
    ( http://www.ossec.net/main/support/ ).

    More information can be found at http://www.ossec.net

    ---  Press ENTER to finish (maybe more information below). ---



 - In order to connect agent and server, you need to add each agent to the server.
   Run the 'manage_agents' to add or remove them:

   /var/ossec/bin/manage_agents

   More information at:
   http://www.ossec.net/en/manual.html#ma


接下來在 Server 主機上增加 Agent 主機資訊 (Agent 主機可以稍後再安裝)


[root@server ossec-hids-2.7.1]# /var/ossec/bin/manage_agents


****************************************
* OSSEC HIDS v2.7.1 Agent manager.     *
* The following options are available: *
****************************************
   (A)dd an agent (A).
   (E)xtract key for an agent (E).
   (L)ist already added agents (L).
   (R)emove an agent (R).
   (Q)uit.
Choose your action: A,E,L,R or Q: A

- Adding a new agent (use '\q' to return to the main menu).
  Please provide the following:
   * A name for the new agent: 192.168.128.102
   * The IP Address of the new agent: 192.168.128.102
   * An ID for the new agent[001]:
Agent information:
   ID:001
   Name:192.168.128.102
   IP Address:192.168.128.102

Confirm adding it?(y/n): y
Agent added.


****************************************
* OSSEC HIDS v2.7.1 Agent manager.     *
* The following options are available: *
****************************************
   (A)dd an agent (A).
   (E)xtract key for an agent (E).
   (L)ist already added agents (L).
   (R)emove an agent (R).
   (Q)uit.
Choose your action: A,E,L,R or Q: E

Available agents:
   ID: 001, Name: 192.168.128.102, IP: 192.168.128.102
Provide the ID of the agent to extract the key (or '\q' to quit): 001

Agent key information for '001' is:
MDAxIDE5Mi4xNjguMTI4LjEwMiAxOTIuMTY4LjEyOC4xMDIgMzgwODI4MGFlYmYyODI4MzZmOWYwNWI2NDY0YjY1YjU5YTQxZWNkNjE0YzYyZjgxNDFkZDNhOGY1YWI1OGY5ZQ==

** Press ENTER to return to the main menu.



****************************************
* OSSEC HIDS v2.7.1 Agent manager.     *
* The following options are available: *
****************************************
   (A)dd an agent (A).
   (E)xtract key for an agent (E).
   (L)ist already added agents (L).
   (R)emove an agent (R).
   (Q)uit.
Choose your action: A,E,L,R or Q: L

Available agents:
   ID: 001, Name: 192.168.128.102, IP: 192.168.128.102

** Press ENTER to return to the main menu.



****************************************
* OSSEC HIDS v2.7.1 Agent manager.     *
* The following options are available: *
****************************************
   (A)dd an agent (A).
   (E)xtract key for an agent (E).
   (L)ist already added agents (L).
   (R)emove an agent (R).
   (Q)uit.
Choose your action: A,E,L,R or Q: Q

** You must restart OSSEC for your changes to take effect.

manage_agents: Exiting ..
[root@server ossec-hids-2.7.1]#



*********************************************************************************

(二) Agent 安裝


yum -y install gcc httpd php
service httpd restart
wget http://www.ossec.net/files/ossec-hids-2.7.1.tar.gz
wget http://www.ossec.net/files/ossec-wui-0.8.tar.gz

tar zxvf ossec-hids-2.7.1.tar.gz
cd ossec-hids-2.7.1
# install.sh 的設定稍後說明,有 server, agnet, local 等不同選擇設定
./install.sh
cd ..

tar zxvf ossec-wui-0.8.tar.gz -C /var/www/html
mv  /var/www/html/ossec-wui-0.8  /var/www/html/ossec

usermod -G ossec apache
cat /etc/group | grep ossec

# /var/ossec/bin/ossec-control start
# vi /var/ossec/etc/ossec.conf

service ossec restart
service httpd restart
firefox http://localhost/ossec &


對 ossec-hids-2.7.1.tar.gz 做 install.sh 時候會出現一些設定詢問,基本上都是 Enter 用預設值
(安裝型態小弟選 local,有空再測試 server 和 agent)


[root@server ossec-hids-2.7.1]# ./install.sh

 (en/br/cn/de/el/es/fr/it/jp/nl/pl/ru/sr/tr) [en]:

 OSSEC HIDS v2.7.1 Installation Script - http://www.ossec.net

 You are about to start the installation process of the OSSEC HIDS.
 You must have a C compiler pre-installed in your system.
 If you have any questions or comments, please send an e-mail
 to dcid@ossec.net (or daniel.cid@gmail.com).

  - System: Linux server 2.6.32-431.el6.x86_64
  - User: root
  - Host: server


  -- Press ENTER to continue or Ctrl-C to abort. --


1- What kind of installation do you want (server, agent, local, hybrid or help)? agent

  - Agent(client) installation chosen.

2- Setting up the installation environment.

 - Choose where to install the OSSEC HIDS [/var/ossec]:

    - Installation will be made at  /var/ossec .

3- Configuring the OSSEC HIDS.

  3.1- What's the IP Address or hostname of the OSSEC HIDS server?: 192.168.128.101

   - Adding Server IP 192.168.128.101

  3.2- Do you want to run the integrity check daemon? (y/n) [y]:

   - Running syscheck (integrity check daemon).

  3.3- Do you want to run the rootkit detection engine? (y/n) [y]:

   - Running rootcheck (rootkit detection).

  3.4 - Do you want to enable active response? (y/n) [y]:


  3.5- Setting the configuration to analyze the following logs:
    -- /var/log/messages
    -- /var/log/secure
    -- /var/log/maillog
    -- /var/log/httpd/error_log (apache log)
    -- /var/log/httpd/access_log (apache log)

 - If you want to monitor any other file, just change
   the ossec.conf and add a new localfile entry.
   Any questions about the configuration can be answered
   by visiting us online at http://www.ossec.net .


   --- Press ENTER to continue ---

  3.6- Setting the configuration to analyze the following logs:
    -- /var/log/messages
    -- /var/log/secure
    -- /var/log/maillog
    -- /var/log/httpd/error_log (apache log)
    -- /var/log/httpd/access_log (apache log)

 - If you want to monitor any other file, just change
   the ossec.conf and add a new localfile entry.
   Any questions about the configuration can be answered
   by visiting us online at http://www.ossec.net .


   --- Press ENTER to continue ---

... (略)



 - System is Redhat Linux.
 - Init script modified to start OSSEC HIDS during boot.

 - Configuration finished properly.

 - To start OSSEC HIDS:
                /var/ossec/bin/ossec-control start

 - To stop OSSEC HIDS:
                /var/ossec/bin/ossec-control stop

 - The configuration can be viewed or modified at /var/ossec/etc/ossec.conf


    Thanks for using the OSSEC HIDS.
    If you have any question, suggestion or if you find any bug,
    contact us at contact@ossec.net or using our public maillist at
    ossec-list@ossec.net
    ( http://www.ossec.net/main/support/ ).

    More information can be found at http://www.ossec.net

    ---  Press ENTER to finish (maybe more information below). ---



 - You first need to add this agent to the server so they
   can communicate with each other. When you have done so,
   you can run the 'manage_agents' tool to import the
   authentication key from the server.

   /var/ossec/bin/manage_agents

   More information at:
   http://www.ossec.net/en/manual.html#ma

[root@agent ossec-hids-2.7.1]#


接下來在 Agent 主機進行設定


[root@agent ~]# /var/ossec/bin/manage_agents


****************************************
* OSSEC HIDS v2.7.1 Agent manager.     *
* The following options are available: *
****************************************
   (I)mport key from the server (I).
   (Q)uit.
Choose your action: I or Q: I

* Provide the Key generated by the server.
* The best approach is to cut and paste it.
*** OBS: Do not include spaces or new lines.

Paste it here (or '\q' to quit): MDAxIDE5Mi4xNjguMTI4LjEwMiAxOTIuMTY4LjEyOC4xMDIgMzgwODI4MGFlYmYyODI4MzZmOWYwNWI2NDY0YjY1YjU5YTQxZWNkNjE0YzYyZjgxNDFkZDNhOGY1YWI1OGY5ZQ==

Agent information:
   ID:001
   Name:192.168.128.102
   IP Address:192.168.128.102

Confirm adding it?(y/n): y
Added.
** Press ENTER to return to the main menu.



****************************************
* OSSEC HIDS v2.7.1 Agent manager.     *
* The following options are available: *
****************************************
   (I)mport key from the server (I).
   (Q)uit.
Choose your action: I or Q: q

** You must restart OSSEC for your changes to take effect.

manage_agents: Exiting ..
[root@agent ~]#


接下來可以找接滲透測試工具去攻擊 Agent 主機看看

(完)

相關

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - server/agent 安裝 (CentOS 6.5 x64)
http://shaurong.blogspot.com/2014/02/ossec-hids-271-serveragent-centos-65-x64.html
http://forum.icst.org.tw/phpbb/viewtopic.php?f=11&t=80717

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - local 安裝 (CentOS 6.5 x64)
http://shaurong.blogspot.com/2014/02/ossec-hids-271-local-centos-65-x64.html
http://forum.icst.org.tw/phpbb/viewtopic.php?f=11&t=80716

[研究] OSSEC - HIDS 2.6 主機型入侵偵測系統 (CentOS 6.0 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=20340

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - local 安裝 (CentOS 6.5 x64)

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - local 安裝 (CentOS 6.5 x64)

2014-02-05

官方網站
http://www.ossec.net/

下載
http://www.ossec.net/main/downloads

安裝


yum -y install gcc httpd php
service httpd restart
wget http://www.ossec.net/files/ossec-hids-2.7.1.tar.gz
wget http://www.ossec.net/files/ossec-wui-0.8.tar.gz

tar zxvf ossec-hids-2.7.1.tar.gz
cd ossec-hids-2.7.1
./install.sh
cd ..

tar zxvf ossec-wui-0.8.tar.gz -C /var/www/html
mv  /var/www/html/ossec-wui-0.8  /var/www/html/ossec

usermod -G ossec apache
cat /etc/group | grep ossec

# /var/ossec/bin/ossec-control start
# vi /var/ossec/etc/ossec.conf

service ossec restart
service httpd restart
firefox http://localhost/ossec &


對 ossec-hids-2.7.1.tar.gz 做 install.sh 時候會出現一些設定詢問,基本上都是 Enter 用預設值
(安裝型態小弟選 local,有空再測試 server 和 agent)

 (en/br/cn/de/el/es/fr/it/jp/nl/pl/ru/sr/tr) [en]:

1- What kind of installation do you want (server, agent, local or help)?  local  
  - Local installation chosen.

2- Setting up the installation environment.

 - Choose where to install the OSSEC HIDS [/var/ossec]:

    - Installation will be made at  /var/ossec .

3- Configuring the OSSEC HIDS.

  3.1- Do you want e-mail notification? (y/n) [y]:
   - What's your e-mail address? root@localhost

   - We found your SMTP server as: 127.0.0.1
   - Do you want to use it? (y/n) [y]:

   --- Using SMTP server:  127.0.0.1

  3.2- Do you want to run the integrity check daemon? (y/n) [y]:

   - Running syscheck (integrity check daemon).

  3.3- Do you want to run the rootkit detection engine? (y/n) [y]:

   - Running rootcheck (rootkit detection).

  3.4- Active response allows you to execute a specific
       command based on the events received. For example,
       you can block an IP address or disable access for
       a specific user.
       More information at:
       http://www.ossec.net/en/manual.html#active-response

   - Do you want to enable active response? (y/n) [y]:

     - Active response enabled.

   - By default, we can enable the host-deny and the
     firewall-drop responses. The first one will add
     a host to the /etc/hosts.deny and the second one
     will block the host on iptables (if linux) or on
     ipfilter (if Solaris, FreeBSD or NetBSD).
   - They can be used to stop SSHD brute force scans,
     portscans and some other forms of attacks. You can
     also add them to block on snort events, for example.

   - Do you want to enable the firewall-drop response? (y/n) [y]:

     - firewall-drop enabled (local) for levels >= 6

   - Default white list for the active response:
      - 168.95.1.1

   - Do you want to add more IPs to the white list? (y/n)? [n]:

  3.6- Setting the configuration to analyze the following logs:
    -- /var/log/messages
    -- /var/log/secure
    -- /var/log/maillog
    -- /var/log/httpd/error_log (apache log)
    -- /var/log/httpd/access_log (apache log)

 - If you want to monitor any other file, just change
   the ossec.conf and add a new localfile entry.
   Any questions about the configuration can be answered
   by visiting us online at http://www.ossec.net .








(完)

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - server/agent 安裝 (CentOS 6.5 x64)
http://shaurong.blogspot.com/2014/02/ossec-hids-271-serveragent-centos-65-x64.html

[研究] OSSEC - HIDS 2.7.1 主機型入侵偵測系統 - local 安裝 (CentOS 6.5 x64)
http://shaurong.blogspot.com/2014/02/ossec-hids-271-local-centos-65-x64.html

[研究] OSSEC - HIDS 2.6 主機型入侵偵測系統 (CentOS 6.0 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=20340