OURMON Installation

Copyright © 2011 by RealPowerWork

 

Ourmon ist ein Netzwerkmonitor der auf Anomalien im Netzwerk achtet, welche durch Würmer oder ähnliche Schädlinge verursacht werden.

Im Grunde arbeitet das Programm wie ein normaler Netzwerkmonitor als SNMP-Rmon-System.

Verwaltet wird das Programm über ein Webinferface. Die Netzwerkkarte arbeite dabei im sogenannten „Promiscous“ Modus, d.h. alle Pakete diese Netzwerkstrange werden empfangen und ausgwertet.

In der Terminalogie von Ourmon werden als Frontend die Aufzeichnugsmodule des Netzwerkverkehr bezeichne. Das Backend sind das Auswertungsinterface und die Anzeige auf der Website.

Installation von Ourmon

1.       Schalten Sie die Netzwerkkarte welche den Datenverkehr aufzeichnen soll in den „Promiscous“ Modus: „ifconfig eth0 promisc“.

2.       Donwload der Quelldateien von http://ourmon.sourceforge.net

3.       Entpacken der Dateien mit „tar svf ourmon29.tar.gz“.

4.       Notwendige Pakete für Ourmon sind:
- „libpcap“
- „pcre“
- „perl/rrdtool“ für Backend

Überprüfen Sie ob die Paktet vorhanden sind:
rpm –q libpcap
rpm –q pcre
rpm –q rrdtool

5.       Kopieren Sie die Quelldateien in das Ausführungsverzeichnis:
cp –r mrourmon /usr/local/“

6.       Bei Ubuntu kann für die Installation „ubuntudep.sh“ aufgerufen werden:
sudo ./ubuntudep.sh“ bei allen anderen Linux Varianten wird mit „./configure.pl“ die Installation durchgeführt.

7.       Die nächsten Schritte beziehen sich auf eine Installation mit „configure.pl“.
Als erstes kommt dann Frage ob Sie das Programm installieren wollen, für die Default-Einstellung „[y]“ können Sie mit <Enter> weitergehen.

sles10:~/mrourmon # ./configure.pl

configuration script to install ourmon.

note: default is suggested like so: [default]

note: just hit carriage-return for default actions

---------------------------------------------------

Would you like to install the ourmon probe? [y]

 

8.       Dann kommt die Frage ob Sie das Programm kompilieren oder nur installieren wollen, weiter mit <Enter>.

Front-end configuration phase started ####################

 

Would you like to compile/install ourmon? [y]

 

9.       Dann kommt die Frage on die „ourmon.conf“ in „/usr/local/mrourmon/etc/“ abgelegt werden soll. Weiter mit <Enter>.

 

cc -O4 -DLINUX -c pktlinux.c

cc -O4 -o ourmon ourmon.o ipanalyze.o machdep.o util.o interfaces.o filter.o monconfig.o hashsort.o hashport.o signal.o

hashsyn.o hashicmp.o hashscan.o ircscan.o trigger.o cprogram.o nonipanalyze.o patmatch.o spinlock.o sync.o ourpcap.o has

hblist.o thread.o stringstore.o hashdns.o pktlinux.o -lpcre -lpcap

 

Next we determine the ourmon config/filter file to use.

By default, we use the local /usr/local/mrourmon/etc/ourmon.conf to provide input filters to ourmon.

WARNING: you should read/edit/understand ourmon.conf!

Do you want to use another ourmon.conf file in some other directory than /usr/local/mrourmon/etc? [n]

 

10.   Dann kommt der Hinweis, dass Sie für eine Default-Installation die Netzwerkadresse und Subnet-Maske Ihres Rechners angeben sollten. Weiter mit <Enter> damit die Eingabemaske erscheint.

Next we suggest one modification to the ourmon.conf file.

 

If this is a default install, you should change the following config directive:

 

        topn_syn_homeip network/netmask

 

and set it to your home network and mask (A.B.C.D/maskbits style)

Do you want to change the topn_syn home network address? [y]

 

11.   Dann die IP Adresse des Netzwerkes mit Subnetmask eingeben: 10.0.0.144/32

note: the home net address may be a subnet or host address (/32).

enter a home net address and mask. [127.0.0.1/32] 10.0.0.144/32

 

12.   Dann kommt die Frage ob ein Startup Script erstellt werden soll, weiter mit <Enter>.

enter a home net address and mask. [127.0.0.1/32] 10.0.0.144/32

netmask: 10.0.0.144/32

 

Do you want to install the ourmon startup script in the ourmon bin? [y]

 

13.   Danach kommt die Frage von welcher Netzwerkkarte aufgezeichnet werden soll. In diesen Fall war dies „eth0“ also mit <Enter> weiter.

WARNING: the default for the interface may not be what you want.

WARNING: use #ifconfig -a to determine interfaces.

Please enter the input interface name to sniff from: [eth0]

 

14.   Frage in welchem Verzeichnis die Probe Ausgabedaten abgelegt werden sollen. Weiter mit <Enter>.

input interface is eth0

 

Please enter directory for probe output files (mon.lite, etc.): [/usr/local/mrourmon/tmp]

 

15.   Dann wird ein Hinweis für die Erstellung der des Startup-Scripts angezeigt. Je nach verwendeten Betriebssystem könnten die Startup-Script unterschiedlich zu installieren sein. Wir gehen weiter mit <Enter>.

probe output directory name is: /usr/local/mrourmon/tmp

 

Creating bin/ourmon.sh driver for startup of ourmon.

ourmon.sh placed in ourmon bin for ourmon front-end/probe startup

./ourmon.sh start

WARNING: this is a gross guess and it may be best handled by you yourself!

WARNING: linux has at least two major variations in distributions in this area!

 

install the startup script (bin/ourmon.sh) in /etc somewhere for boot startup? [y]

 

16.   Es beginnt jetzt der Part 2 der Installation.

LINUX NOTE: for boot: /etc/init.d exists

        and we place ourmon.sh there with rc linkages

ln: creating symbolic link `/etc/rc0.d/K120ourmon' to `/etc/init.d/ourmon.sh': No such file or directory

ln: creating symbolic link `/etc/rc1.d/K120ourmon' to `/etc/init.d/ourmon.sh': No such file or directory

ln: creating symbolic link `/etc/rc2.d/S120ourmon' to `/etc/init.d/ourmon.sh': No such file or directory

ln: creating symbolic link `/etc/rc3.d/S120ourmon' to `/etc/init.d/ourmon.sh': No such file or directory

ln: creating symbolic link `/etc/rc4.d/S120ourmon' to `/etc/init.d/ourmon.sh': No such file or directory

ln: creating symbolic link `/etc/rc5.d/S120ourmon' to `/etc/init.d/ourmon.sh': No such file or directory

ln: creating symbolic link `/etc/rc6.d/K120ourmon' to `/etc/init.d/ourmon.sh': No such file or directory

ourmon front-end install complete

ourmon front-end build worked

 

You should now run /usr/local/mrourmon/bin/ourmon.sh to start ourmon

 

e.g., # /usr/local/mrourmon/bin/ourmon.sh start

 

You can use ourmon.sh stop to stop ourmon

 

part 2: install the back-end, omupdate.pl, etc. (web part)? [y]

 

Anmerkung: Die obige Ausgabe zeigt das nicht alle Komponenten des  Startup-Script richtig installiert werden konnten. Hier ist ggf. ein manueller Eingriff zur Korrektur der Startup-Scripts notwendig.

 

17.   Als Pfad für das Web-‘Frontend wurde “/srv/www/htdocs/ourmon” eingegeben. Damit die Struktur angelegt wird bestätigen Sie „y“ mit <Enter>.

Back-end configuration phase started ######################################

We need a local web directory for generated web output.

hint: the webpath given here is a guess: give the CORRECT base web directory with /ourmon at the end

enter absolute web server web path directory: [/var/www/apache2-default/ourmon] /srv/www/htdocs/ourmon

your output web path is: /srv/www/htdocs/ourmon

 

Do you want to create the web directory for ourmon?

HINT: good idea if it doesn't exist. [y]

 

18.   Sie sehen dann die Durchgeführten Kommandos für die Website-Installation. Danach kommt noch Hinweis für die Logverzeichnisse, bestätigen Sie mit <Enter>.

mkdir: cannot create directory `/srv/www/htdocs/ourmon': File exists

cp bard/* /srv/www/htdocs/ourmon/bard

cp batchip.sh batchipall.sh omupdate.sh /usr/local/mrourmon/bin

cp ombatch*.pl wormtolog.pl daily.pl monbackup.pl /usr/local/mrourmon/bin

cp omupdate.pl tcpworm.pl irc.pl /usr/local/mrourmon/bin

cp mklogdir.sh /usr/local/mrourmon/bin

chmod +x /usr/local/mrourmon/bin/*.sh

chmod +x /usr/local/mrourmon/bin/*.pl

 

INFO only: also setting up logging directory (if needed)

creating log rrddata tmp dirs, if necessary, in /usr/local/mrourmon

hit CR to continue:

 

19.   Geben Sie das Verzeichnis für die Frontend Ausgabateien an. Mit <Enter> weiter.

creating log rrddata tmp dirs, if necessary, in /root/mrourmon

hit CR to continue:

 

If different, enter front-end output file directory absolute path: [/root/mrourmon/tmp]

 

20.   Bestätigen Sie die Frage ob die “html” Dateien in das vorher angegeben Webverzeichnis kopiert werden sollen mit <Enter>.

probe output file path (back-end input/s) is /root/mrourmon/tmp

 

 

Now we copy supplied .html files to the web directory for later editing

do you want to copy base web files to the web directory? [y]

 

21.   Nun wird eine Information zu der Ablage der “rrdbase” Daten angezeigt. Wenn z.B. neue BPF Filter erstellt werden, so sollte man in die Datei „rrdbase/oumon.log“ nach Errors durchsuchen.

INFO only: setting up local rrdbase directory at /root/mrourmon/rrddata

your runtime rrds get stored in this directory, along with the rrd error log file

if you create new BPF filters, check rrdbase/ourmon.log for errors.

hit CR to continue:

 

22.   Bestätigen Sie die Standard UDP Schwelle mit <Enter>.

We need a UDP weight threshold for UDP scan alerts

what should the weight be (default is given): [10000000]

 

23.   Als letztes werden jetzt noch die Crontab Jobs für die „Probes“ angelegt. Weiter mit <Enter>.

Install backend crontab commands in /etc/crontab (default answer y)?: [y]

 

24.   Damit ist die Installation abgeschlossen.
 

ourmon system config complete

see INSTALL for post-config sanity checking

sles10:~/mrourmon #

 

 


 

Ourmon Deinstallation

Wenn Sie Outmon von Ihrem System wieder entfernen wollen gehen Sie wie folgt vor. Das Arbeitsverzeichnis von Ourmon sollte erst ganz zum Schluß entfernt werden.

 

1.       Kontrolle welche Prozesse von Ourmon noch laufen:

sles10:~ # ps -ef | grep ourmon

root     14186  0.2  0.2   2576  1164 ?        Ss   07:38   0:00 /bin/sh /usr/local/mrourmon/bin/omupdate.sh

 

2.       In /etc/crontab” wurde folgendes eingetragen, entfernen Sie alle diese Zeilen wieder.

############## ourmon crontab entries ###############

# run ourmon back-end omupdate.pl etc. per minute

*/1     *       *       *       *       root    /usr/local/mrourmon/bin/omupdate.sh

# batchip.sh - hourly log summary

0       *       *       *       *       root    /usr/local/mrourmon/bin/batchip.sh

# batchipall.sh - roll over daily summary logs at almost midnight

50      23      *       *       *       root    /usr/local/mrourmon/bin/batchipall.sh

# daily.pl - re init next day logs at midnight

0       0       *       *       *       root    /usr/local/mrourmon/bin/daily.pl /root/mrourmon/logs

 

3.       Die Ourmon Script sind installiert unter „/usr/local/mrourmon/bin/“. Beenden Sie den Ourmon Fronend-Service mit:

 

sles10:~ # cd /usr/local/mrourmon/bin/

sles10: /usr/local/mrourmon/bin # ./ourmon.sh stop



4.       Kontrollieren Sie nochmals mit „ps –ef | grep ourmon“ ob alle Prozesse gestoppt sind. Die Ausgabe sollte dann so aussehen:

 

sles10:~ # ps -ef | grep ourmon

root     18575  7619  0 08:14 pts/1    00:00:00 grep ourmon

 

Sollten noch irgendwelche Ourmon Prozesse laufen, so können Sie diesen killen.

 

5.       Entfernen von Oumon aus dem Autostart Services:

 

sles10:~ # chkconfig ourmon.sh

ourmon.sh off

sles10:~ # rm /etc/init.d/ourmon.sh

sles10:~ # rm /etc/init.d/rc3.d/*ourmon*

sles10:~ # rm /etc/init.d/rc5.d/*ourmon*

 

6.       Gehen Sie in das Installationsverzeichnis von Ourmon z.B. /usr/local/mrourmon und starten Sie dann „./makeclean.sh“

 

sles10:~ # cd /usr/local/mrourmon

sles10: /usr/local/mrourmon # ./makeclean.sh

 

7.         Jetzt wird das komplette Installationsverzeichnis von Ourmon gelöscht.

 

sles10:~ # rm –fr /usr/local/mrourmon

 

8.       Als letztes wird jetzt auch das Web-Frontend Verzeichnis gelöscht.

 

sles10:~ # rm –fr /srv/www/htdocs/ourmon

 

 

Fehler beim kompilieren mit „./configure.pl“

 

ourmon build: using make -f Makefile.linux

cc -I. -I/usr/local/include  -O4 -DLINUX -DDAEMON -c ourmon.c

In file included from ourmon.h:22,

                 from ourmon.c:95:

patmatch.h:3:18: error: pcre.h: No such file or directory

In file included from ourmon.h:22,

                 from ourmon.c:95:

patmatch.h:95: error: expected specifier-qualifier-list before 'pcre'

make: *** [ourmon.o] Error 1

ourmon compile failed

See INSTALL file for more info.

you may need to get a new libpcap library

or try making src/ourmon/ourmon by hand.

config terminated.

 

Behebung

Die Meldung deutet darauf hin, dass das Paket „pcre-devel“ nicht installiert ist.

 

Web-Frontend Zeigt keine Grafiken an

 

 

Behebung

Warten Sie einige Zeit ob die Grafiken nicht doch noch erscheinen. Ansonsten kontrollieren Sie den Start von Prozess „ourmon.sh“.

 

Fehler in der Datei „ourmon.conf“ falsches Verzeichnis

In der Datei “ourmon.conf” ist ein falsches Verzeichnis angegeben unter:

“topn_syn_wormfile /home/mrourmon/tmp”

Das Verzeichnis “/home/mrourmon/tmp” gibt es nicht.