Install and configure NfSen on CentOS 7.x
Prerequisites:
tar zxf nfdump-1.6.13.tar.gz tar zxf nfsen-1.3.7.tar.gz
sudo yum groupinstall development tools
sudo yum install rrdtool rrdtool-devel
sudo yum install apache php perl-MailTools rrdtool-perl perl-Socket6 perl-Sys-Syslog.x86_64
yum install policycoreutils-python
echo "date.timezone = Europe/Amsterdam" > /etc/php.d/timezone.ini
useradd netflow
sudo usermod -G apache netflow
cd nfdump-1.6.13 ./configure --prefix=/opt/nfdump --enable-nfprofile autoreconf make sudo make install
cd nfsen-1.3.7 cd etc cp nfsen-dist.conf nfsen.conf vi nfsen.conf $BASEDIR = "/opt/nfsen"; $HTMLDIR = "/opt/nfsen/www/"; $PREFIX = '/opt/nfdump/bin'; $WWWUSER = "apache"; $WWWGROUP = "apache"; $MAIL_FROM = 'nfsen@yourdomain.tld'; $SMTP_SERVER = 'fqdn.mail.server'; %sources = ( 'source1' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' }, 'source2' => { 'port' => '9996', 'col' => '#cc3333', 'type' => 'netflow' }, 'source3' => { 'port' => '9997', 'col' => '#99ff33', 'type' => 'netflow' }, ); cd .. sudo ./install.pl etc/nfsen.conf
firewall-cmd --permanent --zone=trusted --add-service=http firewall-cmd --permanent --zone=trusted --add-source=1.2.3.1 firewall-cmd --permanent --zone=trusted --add-port=9995/udp firewall-cmd --reload firewall-cmd --zone=trusted --list-all
<Directory "/opt/nfsen/www"> AllowOverride None Require all granted </Directory> Alias /nfsen "/opt/nfsen/www"
sudo systemctl enable httpd sudo systemctl start httpd
semanage fcontext -a -t httpd_sys_content_t "/opt/nfsen/www(/.*)?" restorecon -Rv /opt/nfsen/
setenforce 0 /opt/nfsen/bin/nfsen start /opt/nfsen/bin/nfsen stop cp /var/log/audit/audit.log /var/tmp cd /var/tmp audit2allow -M mynfsen < audit.log semodule -i mynfsen.pp setenforce 1
sudo /opt/nfsen/bin/nfsen start
[Unit] Description=NfSen Service After=network.target [Service] Type=forking PIDFile=/opt/nfsen/var/run/nfsend.pid ExecStart=/opt/nfsen/bin/nfsen start ExecStop=/opt/nfsen/bin/nfsen stop Restart=on-abort [Install] WantedBy=multi-user.target
systemctl enable nfsen systemctl start nfsen