Um zu sehen was die Firewall denn so tut habe ich ja bereits ein kleines
Perlprogramm pflog.pl vorgestellt.
Aber ein Bild sagt manchmal mehr als tausend Zahlen. Aus diesem Grund
moechte ich heute kurz pfstat vorstellen.
Ich habe mich hierbei stark an die Dokumentation von Hatchet angelehnt
(die dieses auch enthaelt) ... allerding ist Hatchet zum Einen leider
etwas instabil was die Darstellung der Tabellen betrifft und zum Anderen
inzwischen auch etwas ueberladen.
Nun folgen einfach aufgelistet alle Schritte (maximal 10 minuten) die
man einfach abarbeiten muss:
% su
% setenv PKG_PATH ftp://openbsd.bay13.net/pub/OpenBSD/3.4/packages/i386
% pkg_add pfstat-1.6
Danach sollte man kontrollieren ob alles ordentlich installiert wurde:
% pkg_info
freetype-1.3.1p1 free and portable TrueType font rendering engine
png-1.2.5p1 library for manipulating PNG images
jpeg-6b IJG's JPEG compression utilities
gd-1.8.3 graphics library for fast PNG creation
pfstat-1.6 packet filter statistics visualization
Weiter gehts mit der pfstat.conf (siehe Anlage):
% cp pfstat.conf /etc
Dann die root-crontab editieren:
* * * * * /usr/local/bin/pfstat -q >>/var/log/pfstat
1 1 * * 1 tail -n 50000 /var/log/pfstat >/tmp/pfstat && \
mv /tmp/pfstat /var/log/pfstat
*/5 * * * * /usr/local/bin/pfstat -c /etc/pfstat.conf -d \
/var/log/pfstat >/dev/null
Und:
% cd /var/www/htdocs
% mkdir graphs
Nicht vergessen in der /etc/pf.conf das Loginterface zu definieren!:
set loginterface tx0
Und zum Schluss noch 'apachectl start' sowie in Eigeninitiative noch ne
schoene html-Seite drumherum, done. :-)
Zur Erklaerung was man auf den pic's sieht:
pfstat0-*.jpg: Bits Incoming/Outgoing
pfstat1-*.jpg: Packets Allowed
pfstat2-*.jpg: Packets Denied (siehe Beispiel-Link oben)
pfstat3-*.jpg: Stateful Inserts, Removals and Searches
--- pfstat.conf ---
image "/var/www/htdocs/graphs/pfstat0-week-small.jpg" {
from 1 weeks to now
width 600 height 200
left
graph bytes_v4_in label "incoming" color 0 192 0 filled
right
graph bytes_v4_out label "outgoing" color 0 0 255
}
image "/var/www/htdocs/graphs/pfstat0-day-small.jpg" {
from 1 days to now
width 600 height 200
left
graph bytes_v4_in label "incoming" color 0 192 0 filled
right
graph bytes_v4_out label "outgoing" color 0 0 255
}
image "/var/www/htdocs/graphs/pfstat1-week-small.jpg" {
from 1 weeks to now
width 600 height 200
left
graph packets_v4_in_pass label "passed in" color 0 192 0 filled
right
graph packets_v4_out_pass label "passed out" color 0 0 255
}
image "/var/www/htdocs/graphs/pfstat1-day-small.jpg" {
from 1 days to now
width 600 height 200
left
graph packets_v4_in_pass label "passed in" color 0 192 0 filled
right
graph packets_v4_out_pass label "passed out" color 0 0 255
}
image "/var/www/htdocs/graphs/pfstat2-week-small.jpg" {
from 1 weeks to now
width 600 height 200
left
graph packets_v4_in_drop label "block in" color 255 0 0 filled
right
graph packets_v4_out_drop label "block out" color 0 0 255
}
image "/var/www/htdocs/graphs/pfstat2-day-small.jpg" {
from 1 days to now
width 600 height 200
left
graph packets_v4_in_drop label "block in" color 255 0 0 filled
right
graph packets_v4_out_drop label "block out" color 0 0 255
}
image "/var/www/htdocs/graphs/pfstat3-week-small.jpg" {
from 1 weeks to now
width 600 height 200
left
graph states_inserts label "inserts" color 0 192 0 filled,
graph states_removals label "removals" color 0 0 255
right
graph states_searches label "searches" color 255 0 0,
graph states_entries label "entries" color 192 192 0
}
image "/var/www/htdocs/graphs/pfstat3-day-small.jpg" {
from 1 days to now
width 600 height 200
left
graph states_inserts label "inserts" color 0 192 0 filled,
graph states_removals label "removals" color 0 0 255
right
graph states_searches label "searches" color 255 0 0,
graph states_entries label "entries" color 192 192 0
}
--- end ---
--
I.S.
|