Perşembe, Şubat 14, 2013

OpenBSD Nfsen install

I was  trying to find a solution for network monitoring as a friend's request. OpenBSD is the firewall. I saw the Nfsen packages and installed to a 5.2 server. After some effort trying to understand what is going on behind, I realised that Netflow is a protocol by Cisco designed to export router traffic to outside. And OpenBSD has a support of it with pflow interface.
First I made a new pflow0 interface like
ifconfig pflow0 flowdst 127.0.0.1:9998 flowsrc 127.0.0.1 up
Then made some configuration changesto /etc/nfsen.conf and /var/www/htdocs/nfsen/conf.php.
Because Apache in OpenBSD runs in chrooted by default, if you dont make the necessary changes in these pages you got an error stating

 ERROR: nfsend connect() error: Permission denied!
 ERROR: nfsend - connection failed!!
 ERROR: Can not initialize globals!

which is because apache cant reach the communication socket which is initially  located at $PIDDIR/nfsen.comm namely /var/db/nfsen/run directory.

As described here  we change it to somewhere readable by Apache like

$COMMSOCKET = "/var/www/var/tmp/nfsen.comm";

and in the nfsen/conf.php we declare it too.
$COMMSOCKET = "/var/tmp/nfsen.comm";

Restarting nfsen daemon will solve the problem.