QNAP na straży bezpieczeństwa w firmie, czyli darmowy HIDS

QNAP na straży bezpieczeństwa w firmie, czyli darmowy HIDS

Warto wiedzieć co się dzieje w firmie, logi, rootkit czy nawet kiedy były modyfikowane ważne pliki – dokumenty etc…

Z pomocą przychodzi nam aplikacja OSSEC.

Oczywiście całość jak zawsze zaczynamy od postawienia kontenera z Debianem – nie będę już tego opisywał, gdyż jest to w wielu poprzednich wpisach.

Na początek

apt-get install anacron rsyslog openssh-server vim-nox wget build-essential

Kontener jest golasem więc kilka paczek jak wyżej zawsze instaluje.

cd /usr/src
wget https://github.com/ossec/ossec-hids/archive/2.9.1.tar.gz
tar zxvf 2.9.1.tar.gz
cd ossec-hids-2.9.1/
./install.sh

Pytanie o rodzaj instalacji:

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

Dalej entery :)

I mamy zainstalowane:

- System is Debian (Ubuntu or derivative).
- 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

Uruchamiamy:

/var/ossec/bin/ossec-control start

Pobiermy agenta dla Windows: https://updates.atomicorp.com/channels/atomic/windows/ossec-agent-win32-2.9.0-1738.exe

Na serwerze musimy dodać agenta

cd /var/ossec/bin

./manage_agents

****************************************
* OSSEC HIDS v2.9.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: windows
* The IP Address of the new agent: 192.168.1.110
* An ID for the new agent[001]:
Agent information:
ID:001
Name:windows
IP Address:192.168.1.110

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

Pobieramy klucz

****************************************
* OSSEC HIDS v2.9.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: windows, IP: 192.168.1.110
Provide the ID of the agent to extract the key (or '\q' to quit): 001

Agent key information for '001' is:
MDAxIHdpbmRvd3MgMTkyLjE2OC4xLjExMCA2OGMwNGIwN2QzYWIwNDExMzA1ZTJhOTYyMWZmYmM1MzJlMDBhNGJiYmMxMTllZjYwNmQxZmI2YmMxYzE2ODA0

** Press ENTER to return to the main menu.

Doodajemy IP serwera oraz klucz w agencie:

W menu File startujemy agenta. W logu widać co monitoruje domyślnie:

Logi pracy znajdziemy w: /var/ossec/logs/alerts/alerts.log

Przykładowy alert z maszyny z systemem Linux

** Alert 1502949027.9437: mail - syslog,dpkg,config_changed,
2017 Aug 17 05:50:27 ossec->/var/log/dpkg.log
Rule: 2902 (level 7) -> 'New dpkg (Debian Package) installed.'
2017-08-17 05:50:27 status installed libc-bin:amd64 2.19-18+deb8u4