From fe8c11c1954834f77fb17887c939b2866cde74a9 Mon Sep 17 00:00:00 2001 From: Leonardo Arena Date: Mon, 27 Jul 2015 07:39:39 +0000 Subject: testing/ntopng: new aport High-speed web-based traffic analysis and flow collection. It's Ntop next-generation software --- testing/ntopng/APKBUILD | 78 ++++++++++++++++++++++++++++++++ testing/ntopng/include-sys-types.h.patch | 11 +++++ testing/ntopng/ntopng-update-geoip-db | 25 ++++++++++ testing/ntopng/ntopng.confd | 1 + testing/ntopng/ntopng.initd | 25 ++++++++++ testing/ntopng/ntopng.pre-install | 4 ++ 6 files changed, 144 insertions(+) create mode 100644 testing/ntopng/APKBUILD create mode 100644 testing/ntopng/include-sys-types.h.patch create mode 100644 testing/ntopng/ntopng-update-geoip-db create mode 100644 testing/ntopng/ntopng.confd create mode 100644 testing/ntopng/ntopng.initd create mode 100755 testing/ntopng/ntopng.pre-install (limited to 'testing') diff --git a/testing/ntopng/APKBUILD b/testing/ntopng/APKBUILD new file mode 100644 index 0000000000..b024ce8ea1 --- /dev/null +++ b/testing/ntopng/APKBUILD @@ -0,0 +1,78 @@ +# Maintainer: Leonardo Arena +pkgname=ntopng +pkgver=2.0 +pkgrel=0 +pkgdesc="ntop next-generation" +url="http://www.ntop.org" +arch="all" +license="GPL" +depends="redis" +pkgusers="ntop" +pkggroups="ntop" +makedepends="autoconf automake curl-dev geoip-dev glib-dev hiredis-dev + libpcap-dev libtool libxml2-dev lua-dev luajit-dev lua-redis openssl-dev + paxmark rrdtool-dev sqlite-dev wget zeromq-dev zlib-dev + linux-headers" +install="$pkgname.pre-install" +subpackages="$pkgname-doc" +source="http://downloads.sourceforge.net/project/ntop/$pkgname/$pkgname-$pkgver.tar.gz + $pkgname.initd + $pkgname.confd + ntopng-update-geoip-db + + include-sys-types.h.patch + " + +_builddir="$srcdir"/$pkgname-$pkgver + +prepare() { + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done +} + +build() { + cd "$_builddir" + ./autogen.sh + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var/lib \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info + make all || return 1 +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" MAN_DIR="$pkgdir/usr/share" install || return 1 + rm "$pkgdir"/usr/lib/*.la + + install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname + install -m755 -D "$srcdir"/ntopng-update-geoip-db \ + "$pkgdir"/usr/bin/ntopng-update-geoip-db + # ntop internal db dir + install -d -o ntop -g ntop -m755 "$pkgdir"/var/lib/ntopng/geoip || return 1 + install -d -o ntop -g ntop -m755 "$pkgdir"/var/run/ntopng || return 1 + # need to disable PAX mprotect protection for luajit + paxmark -m "$pkgdir"/usr/bin/$pkgname || return 1 +} + +md5sums="f8a20b91372d5daf17ecc6225759010e ntopng-2.0.tar.gz +c2c94e8b3cfa92a2aff8254e43b5da21 ntopng.initd +5600e5f77df5545ba62c46423d8a7848 ntopng.confd +a222808fb21e06dbd7e226f137686c3f ntopng-update-geoip-db +86dd28e89f09c5d9675d016cb3f880bd include-sys-types.h.patch" +sha256sums="3cbfd6de1bc44d65f7c7f0de282d122d11f493f1261ba137c3b5b202e08e0251 ntopng-2.0.tar.gz +f99b57815e226a998a6f6a6a8ef02a5a780ff0fe476686b3dae56a666f6e719d ntopng.initd +c467920b052d031a4e00bfc4a3f384be42bd25dde2a7e7f78b8d1acba25181fa ntopng.confd +904c7bb855e19b40d2caee076cbd855f96226b9ef681ac440c442094e25acfeb ntopng-update-geoip-db +fdb8e063a6596b7d851b429d1d25e3f994882a9233b73e8044836d9b9110bf7f include-sys-types.h.patch" +sha512sums="2208623cdc843b8e4ec285930d1ea74ac50c576888fce20f6fc4363e747e0dbef7f1808e7b77ae9b7f5316bca55a3e003a9926785c847bbea2c321d7f7e56d13 ntopng-2.0.tar.gz +41844e9718c04895f30c8aa5a1776b72311ba3e73b667c21284ed0b9099ae08144722e6aa3ed60364e371755bd82558d1eaa70eb7b781d3afb4c5a07e55345f1 ntopng.initd +62133e40f62d0df9dd03639d00341c5f5abe6b693f76b56e0e839bf26ec496c61974f29d01367e046345cbb86b6d9d94639f8be2f2d4c50dadd0414a2626158e ntopng.confd +de509706c36e895159b4e57b5fe53f1fa8f32167416aad5fa391ac107f0e7e1a06fa5ce6d92816ef7cb13bf98bb74cb99fa482d03f77a6beb38eafe1d53d2deb ntopng-update-geoip-db +1f7c7001adafc6bb2e4bfa5e39421fba0da6df57872af1041616dc58b3cdae817a6f2cf7648d009e47a302c981ab1407987a5f2e37527dc23623343bab34275a include-sys-types.h.patch" diff --git a/testing/ntopng/include-sys-types.h.patch b/testing/ntopng/include-sys-types.h.patch new file mode 100644 index 0000000000..25a37736d8 --- /dev/null +++ b/testing/ntopng/include-sys-types.h.patch @@ -0,0 +1,11 @@ +--- a/nDPI/src/include/linux_compat.h ++++ b/nDPI/src/include/linux_compat.h +@@ -42,6 +42,8 @@ + #endif + #endif + ++#include ++ + #pragma pack(push, 1) /* push current alignment to stack */ + #pragma pack(1) /* set alignment to 1 byte boundary */ + diff --git a/testing/ntopng/ntopng-update-geoip-db b/testing/ntopng/ntopng-update-geoip-db new file mode 100644 index 0000000000..1ac05bc0e0 --- /dev/null +++ b/testing/ntopng/ntopng-update-geoip-db @@ -0,0 +1,25 @@ +#!/bin/sh + +BASE_URL=http://geolite.maxmind.com/download/geoip/database + +echo "Updating NTOP GeoIP databases..." + +cd /usr/share/ntopng/geoip || exit + +for u in \ + asnum/GeoIPASNum.dat.gz \ + asnum/GeoIPASNumv6.dat.gz \ + GeoLiteCity.dat.gz \ + GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz; do + FILE_GZ=${u#*/} + FILE=${FILE_GZ%.gz} + wget -O ${FILE_GZ} ${BASE_URL}/${u} && + gunzip < ${FILE_GZ} > .${FILE} && + mv -f .${FILE} ${FILE} && + rm -f ${FILE_GZ} || + exit +done + +rc-service ntopng status && rc-service ntopng restart + +echo "NTOP GeoIP databases were successfully updated" diff --git a/testing/ntopng/ntopng.confd b/testing/ntopng/ntopng.confd new file mode 100644 index 0000000000..1d38dfeca4 --- /dev/null +++ b/testing/ntopng/ntopng.confd @@ -0,0 +1 @@ +NTOPNG_OPTS="" diff --git a/testing/ntopng/ntopng.initd b/testing/ntopng/ntopng.initd new file mode 100644 index 0000000000..c111d2bf00 --- /dev/null +++ b/testing/ntopng/ntopng.initd @@ -0,0 +1,25 @@ +#!/sbin/openrc-run + +depend() { + need net redis +} + +command="/usr/bin/ntopng" +pidfile="/var/run/ntopng/ntopng.pid" +: ${exec_user:=ntop} +: ${command_args:="--daemon --data-dir /var/lib/ntopng --httpdocs-dir /usr/share/ntopng/httpdocs --pid $pidfile -U $exec_user"} + +checkconfig() { + if [ ! -e /usr/share/ntopng/httpdocs/geoip/GeoIPASNum.dat ] || \ + [ ! -e /usr/share/ntopng/httpdocs/geoip/GeoLiteCity.dat ]; then + eerror "You need download the GeoIP database" + eerror "ntopng-update-geoip-db" + return 1 + fi +} + +prestart() { + checkconfig || return 1 + eend $? +} + diff --git a/testing/ntopng/ntopng.pre-install b/testing/ntopng/ntopng.pre-install new file mode 100755 index 0000000000..1ace75c61b --- /dev/null +++ b/testing/ntopng/ntopng.pre-install @@ -0,0 +1,4 @@ +#!/bin/sh +addgroup -S ntop 2>/dev/null +adduser -h /var/lib/ntop -s /sbin/nologin -S -G ntop -H -D ntop 2>/dev/null +exit 0 -- cgit v1.2.3