ROOT ON FIRE Security, Monitoring, Networking, Linux

17Feb/100

Netzwerk und Service Discovery mit Fing

Fing ist ein kostenloses Kommandozeilen Tool zur Netzwerk und Service Discovery. Die Ausgabe kann auf verschiedene Arten erfolgen: CSV, XML, Text oder HTML. Zur Zeit gibt es noch keine GUI, es wird jedoch ein Step-by-Step Assistent mitgeliefert. Der Nachfolger von Look@LAN ist für Linux, Mac OS und Windows verfügbar.

Beispiel:

C:\>fing -n 192.168.1.0/24 -o table,html,C:\test.html

Host Discovery HTML-Report:

Bsp. HTML-Report

Service Discovery HTML-Report:

Quelle: http://www.over-look.com

16Feb/100

HowTo: Icinga und IDOUtils mit MySQL installieren

icinga logoDie Installation und Konfiguration von Icinga ohne IDOUtils habe ich hier erklärt.

I. Requirements

- Apache
- GCC-Compiler
- C/C++ development libraries
- GD-Development-Libraries für statusmap- und trends-CGIs
- libdbi & libdbi-Treiber

Installation unter Debian 5:

r-o-f:~# aptitude install apache2 build-essential libgd2-xpm-dev
r-o-f:~# aptitude install libjpeg62 libjpeg62-dev libpng12-0 libpng12-0-dev
r-o-f:~# aptitude install mysql-server mysql-client libdbi0 libdbi0-dev libdbd-mysql

II. Pakete herunterladen, validieren und entpacken

Download Icingia Core inkl. MD5 Sums:

r-o-f:~# wget http://downloads.sourceforge.net/project/icinga/icinga/1.0/icinga-1.0.tar.gz
r-o-f:~# http://sourceforge.net/projects/icinga/files/icinga/1.0/icinga-1.0.tar.gz.md5/download

validieren:

r-o-f:~# md5sum -c icinga-1.0.tar.gz.md5
icinga-1.0.tar.gz: OK

entpacken:

r-o-f:~# tar xvzf icinga-1.0.tar.gz

III. Icinga Benutzer und Gruppe anlegen, Passwort definieren

Benutzer anlegen und Passwort definieren:

r-o-f:~# useradd -m icinga
r-o-f:~# passwd icinga
Geben Sie ein neues UNIX-Passwort ein:
Geben Sie das neue UNIX-Passwort erneut ein:
passwd: Passwort erfolgreich geändert

Gruppe für Webinterface definieren und User hinzufügen:

r-o-f:~# groupadd icinga-cmd
r-o-f:~# usermod -a -G icinga-cmd icinga
r-o-f:~# usermod -a -G icinga-cmd www-data

IV. Kompilieren und Installieren

r-o-f:~# cd ./icinga-1.0
r-o-f:~# ./configure --with-command-group=icinga-cmd --enable-idoutils
...

*** Configuration summary for icinga-core 1.0 12-16-2009 ***:

 General Options:
 -------------------------
        Icinga executable:  icinga
        Icinga user/group:  icinga,icinga
       Command user/group:  icinga,icinga-cmd
            Embedded Perl:  no
             Event Broker:  yes
           Build IDOUtils:  yes
        Install ${prefix}:  /usr/local/icinga
                Lock file:  ${prefix}/var/icinga.lock
   Check result directory:  ${prefix}/var/spool/checkresults
           Init directory:  /etc/init.d
  Apache conf.d directory:  /etc/apache2/conf.d
             Mail program:  /usr/bin/mail
                  Host OS:  linux-gnu

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/icinga/
                  CGI URL:  http://localhost/icinga/cgi-bin/
 Traceroute (used by WAP):  /usr/sbin/traceroute


Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.


!!! Please take care about the upgrade documentation !!!
...
r-o-f:~# make all
...
r-o-f:~/icinga-1.0# make fullinstall

Mit make fullinstall wird das Hauptprogramm, CGIs, API, HTML Files, Init-Scripte (/etc/init.d/) installiert und die Berechtigungen für das External-Command-Verzeichnis gesetzt.
Unter /usr/local/icinga/etc wird eine Beispielkonfiguration angelegt. Zusätzlich wird unter /etc/apache2/conf.d/icinga.conf die Konfiguration für das Web-Interface plaziert. Danach muss der Webserver neu gestartet werden.

V. User für Web-Interface definieren

r-o-f:~# htpasswd -c /usr/local/icinga/etc/htpasswd.users root-on-fire
New password:
Re-type new password:
Adding password for user root-on-fire

Mit dem -c Parameter legt htpasswd die htpasswd.users Datei neu an bzw. überschreibt ohne Nachfrage das alte File!
Weitere user können ganz einfach mit folgendem Befehl angelegt werden:

r-o-f:~# htpasswd /usr/local/icinga/etc/htpasswd.users admin

VI. Kontakt & Berechtigungen definieren

Icinga regelt die Benutzerberechtigung wie Nagios über die Kontaktgruppen. Der Web-User muss in einer der definierten Kontaktgruppen sein. Sonst kann er sich zwar einloggen, wird aber nichts sehen.
Ein neuer Kontakt kann in der /usr/local/icinga/etc/objects/contacts.cfg definiert werden:

define contact{
        contact_name                    root-on-fire
        use                             generic-contact  
        alias                           ROOT ON FIRE
        email                           icinga@root-on-fire.com
        }
....

define contactgroup{
        contactgroup_name               admins
        alias                           Icinga Administrators
        members                         icingaadmin,root-on-fire
        }

Detailierte Web-Berechtigungen werden in der /usr/local//icinga/etc/cgi.cfg definiert.

VII. MySQL Datenbank und IDOUtils konfigurieren

Datenbank, Benutzer und Berechtigungen definieren:

r-o-f:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 33
Server version: 5.0.51a-24+lenny3 (Debian)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE DATABASE icinga;
Query OK, 1 row affected (0.00 sec)

mysql>  GRANT USAGE ON *.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT SELECT , INSERT , UPDATE , DELETE ON icinga.* TO 'icinga'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql>  FLUSH PRIVILEGES ;
Query OK, 0 rows affected (0.00 sec)

Datenbankstruktur importieren:

r-o-f:~# mysql -u root -p icinga < ./icinga-1.0/module/idoutils/db/mysql.sql

IDOUtils Datenbank definieren:

r-o-f:~# cd /usr/local/icinga/etc/
r-o-f:/usr/local/icinga/etc# cp ido2db.cfg-sample ido2db.cfg

Folgende Optionen müssen in der /usr/local/icinga/etc/ido2db.cfg evtl. angepasst werden:

 db_servertype=mysql
 db_port=3306
 db_user=icinga
 db_pass=<PASSWORT>


VIII. Nagios Plugins herunterladen, kompilieren und installieren

r-o-f:~# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
r-o-f:~# tar xvzf nagios-plugins-1.4.14.tar.gz
r-o-f:~# cd ./nagios-plugins-1.4.14
r-o-f:~/nagios-plugins-1.4.14# ./configure --prefix=/usr/local/icinga --with-nagios-user=icinga
r-o-f:~/nagios-plugins-1.4.14# make
r-o-f:~/nagios-plugins-1.4.14# make install

IX. Icinga & IDOUtils starten

Konfiguration überprüfen:

r-o-f:~# /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg
....
....
Things look okay - No serious problems were detected during the pre-flight check

WICHTIG: IDOUtils muss vor Icinga gestartet werden!

r-o-f:~# /etc/init.d/ido2db start
Starting ido2db: done.
...

r-o-f:~# /etc/init.d/icinga start
Starting icinga: done.

X. Firewalleinstellungen

Zugriff auf Web-Interface von außen ermöglichen:

r-o-f:~# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

Regel prüfen:

r-o-f:~# iptables  -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:www
....

XI. Screenshots

icinga01

icinga02

Quellen und weiterführende Links

Icinga Homepage: http://www.icinga.org/
Icinga Dokumentation: http://docs.icinga.org/
Icinga Demo: http://www.icinga.org/
Deutsche Nagios & Icinga Community: http://www.nagios-portal.org
Nagios Homepage: http://nagios.org/
Nagios-Plugins: http://nagios.org/download/plugins

4Feb/100

(IN)SECURE Magazine – Ausgabe 24 veröffentlicht

INSECURE MAGAZINEThemen:

  • Writing a secure SOAP client with PHP: Field report from a real-world project
  • How virtualized browsing shields against web-based attacks
  • Review: 1Password 3
  • Preparing a strategy for application vulnerability detection
  • Threats 2.0: A glimpse into the near future
  • Preventing malicious documents from compromising Windows machines
  • Balancing productivity and security in a mixed environment
  • AES and 3DES comparison analysis
  • OSSEC: An introduction to open source log and event management
  • Secure and differentiated access in enterprise wireless networks

Homepage: http://www.net-security.org

3Feb/100

1C3 1984 – Hacker in der Tagesschau



gefunden bei: http://www.sjmp.de/

2Feb/100

Netzwerk Pakete mit Nping generieren

Nping LogoNping ist ein Open Source Tool mit dem man Netzwerk Pakete generieren, Antwort-Pakete analysieren und Antwort-Zeiten im Netzwerk messen kann. Nping kann Pakete verschiedene Protokolle generieren und sämtliche Werte bzw. Flags im Protokoll-Headers manipulieren.

Die Ziele werden bei Nping genau wie bei Nmap auf verschiedene Arten bestimmt, alles was keine Option ist wird automatisch als Ziel definiert. Details zu den verschiedenen Möglichkeiten findet man in meinem Blog Post:
Nmap 5.0 – Howto Teil 1: Ziele richtig definieren.

Nping unterstützt verschiedene Paket Typen bzw. Test Arten: TCP Connect, TCP, UDP, ICMP, ARP und Traceroute.
Die Man Page liefert eine genaue Übersicht der verschiedenen Test Arten und der zahlreichen möglichen Funktionen.

Nping ist auf der Downloadseite für Linux, MAX OS X und Windows erhältlich.

I. Installation unter Debian

r-o-f:~# wget http://nmap.org/nping/dist/nping-0.1BETA2/nping-0.1BETA2.tar.gz
r-o-f:~# tar -xzf nping-0.1BETA2.tar.gz
r-o-f:~# cd ./nping-0.1BETA2
r-o-f:~/nping-0.1BETA2# ./configure
r-o-f:~/nping-0.1BETA2# make
r-o-f:~/nping-0.1BETA2# make install
r-o-f:~# nping --version

Nping version 0.1BETA2 ( http://nmap.org/nping )

II. Beispiel

Die Option -c: definiert die Anzahl der Durchläufe (=3), mit --tcp: wird der TCP Mode aktiviert und mit -p: werden die Ziel-Ports (80 & 443) bestimmt.

r-o-f:~# nping -c 3 --tcp -p 80,433 scanme.nmap.org

Starting Nping 0.1BETA2 ( http://nmap.org/nping ) at 2010-02-02 21:19 CET
SENT (0.0000s) TCP 10.0.0.10:63125 > 64.13.134.52:80 S ttl=64 id=7602 iplen=40  seq=1933904507 win=1480
RCVD (0.2080s) TCP 64.13.134.52:80 > 10.0.0.10:63125 SA ttl=44 id=0 iplen=44  seq=330730089 win=5840 <mss 1380>
SENT (1.0010s) TCP 10.0.0.10:63125 > 64.13.134.52:433 S ttl=64 id=5124 iplen=40  seq=1933904507 win=1480
SENT (2.0010s) TCP 10.0.0.10:63125 > 64.13.134.52:80 S ttl=64 id=37991 iplen=40  seq=1933904507 win=1480
RCVD (2.2420s) TCP 64.13.134.52:80 >10.0.0.10:63125 SA ttl=44 id=0 iplen=44  seq=332764473 win=5840 <mss 1380>
SENT (3.0040s) TCP 10.0.0.10:63125 > 64.13.134.52:433 S ttl=64 id=22002 iplen=40  seq=1933904507 win=1480
SENT (4.0050s) TCP 10.0.0.10:63125 > 64.13.134.52:80 S ttl=64 id=37289 iplen=40  seq=1933904507 win=1480
RCVD (4.2630s) TCP 64.13.134.52:80 > 10.0.0.10:63125 SA ttl=44 id=0 iplen=44  seq=334783067 win=5840 <mss 1380>
SENT (5.0060s) TCP 10.0.0.10:63125 > 64.13.134.52:433 S ttl=64 id=62138 iplen=40  seq=1933904507 win=1480

Max rtt: 257.629ms | Min rtt: 207.723ms | Avg rtt: 235.445ms
Raw packets sent: 6 (240B) | Rcvd: 3 (138B) | Lost: 3 (50.00%)
Tx time: 5.00633s | Tx bytes/s: 47.94 | Tx pkts/s: 1.20
Rx time: 6.00893s | Rx bytes/s: 22.97 | Rx pkts/s: 0.50
Nping done: 1 IP address pinged in 6.01 seconds
Get Adobe Flash playerPlugin by wpburn.com wordpress themes