How to install IP-Audit-Web 1.0 on OpenBSD 4.5
IP audit web is an excellent tool to monitor traffic on a given interface, and create daily and monthly statistics. It is really made of 2 components: – IPAudit – IPAudit-web As of this writing the latest version is IPAudit-Web-1.0BETA9. It contains both packages bundled.
Here are the steps to follow:
wget http://umn.dl.sourceforge.net/sourceforge/ipaudit/ipaudit-web-1.0BETA9.tar.gztar xvzf ipaudit-web-1.0BETA9.tar.gzcd ipaudit-web-1.0BETA9/compile/srcvi ipaudit.c
Add anywhere near the top (this is needed because for some reason DLT_LINUX_SLL is not defined by the configure sript. Now you can continue as usual:
cd .../configuremakesudo useradd -m ipauditsudo make installsudo make install-cron
Because IPAudit needs to run perl cgi scripts, we need to make some changes to the way apache is started, as well as the apache configuration.
sudo vi /etc/rc.conf
Change the httpd parameter to . (You will need to kill apache, and restart it with manually for the jail to be suppressed immediately.
sudo vi /var/www/conf/httpd.conf
And add
# IP Audit settingsRedirect /~ipaudit/ http://athena.newpush.com/ipaudit/Alias /ipaudit /home/ipaudit/public_html<Directory /home/ipaudit/public_html> AllowOverride FileInfo AuthConfig Limit Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS PROPFIND> Order allow,deny Allow from all </Limit> <Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> Order deny,allow Deny from all </Limit></Directory>
Once that is done, restart apache:
sudo apachectl restart
Now we also need to adjust the cron, because openbsd is picky about who can see the interfaces in promiscous mode. Therefore we will run the cron with sudo. First, we adjust the sudoers file:
sudo visudo
And we add:
ipaudit ALL=(ALL) NOPASSWD:/home/ipaudit/cron/cron30min,/home/ipaudit/cron/cron30min,/home/ipaudit/cron/crondaily,/home/ipaudit/cron/cronclean,/home/ipaudit/cron/cronweekly,/home/ipaudit/cron/cronmonthly
Next we modify the crontab:
sudo crontab -e -u ipaudit
And we change it as follows:
0,30 * * * * sudo /home/ipaudit/cron/cron30min15 0 * * * sudo /home/ipaudit/cron/crondaily15 1 * * * sudo /home/ipaudit/cron/cronclean45 1 * * 0 sudo /home/ipaudit/cron/cronweekly45 2 1 * * sudo /home/ipaudit/cron/cronmonthly
Now we need to modify the config slightly:
sudo su - ipauditvi ipaudit-web.conf
And we adjust change and (we cant use here as it wouldn’t get expanded).
Finally, we need to fix the links in the generated html files:
cd public_htmlfor i in bin
config.js
docs
lib
node_modules
package.json
package-lock.json
README.md
results
results_category
results_categorywordprismic-import
resultswordprismic-import
tmp
tmp2
tmp3
tmp.zip
_wordprismic-import
wordprismic-import
wordprismic-import.zip; do perl -p -i~ -e 's/~ipaudit/cgi-bin/ipaudit-cgi/g' ""; donefor i in bin
config.js
docs
lib
node_modules
package.json
package-lock.json
README.md
results
results_category
results_categorywordprismic-import
resultswordprismic-import
tmp
tmp2
tmp3
tmp.zip
_wordprismic-import
wordprismic-import
wordprismic-import.zip; do perl -p -i~ -e 's/~ipaudit/ipaudit/g' ""; done