From df7d5c3f58192c333c107b97f744a991f0b74795 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Wed, 20 Mar 2013 14:25:23 +0400 Subject: [PATCH] ntop-5.0.1 added. --- net-analyzer/ntop/Manifest | 7 + .../ntop/files/ntop-5.0.1-gentoo.patch | 185 ++++++++++++++++++ .../ntop/files/ntop-5.0.1-system-ndpi.patch | 42 ++++ net-analyzer/ntop/files/ntop-confd | 9 + net-analyzer/ntop/files/ntop-initd | 30 +++ net-analyzer/ntop/files/ntop-update-geoip-db | 21 ++ net-analyzer/ntop/ntop-5.0.1.ebuild | 116 +++++++++++ 7 files changed, 410 insertions(+) create mode 100644 net-analyzer/ntop/Manifest create mode 100644 net-analyzer/ntop/files/ntop-5.0.1-gentoo.patch create mode 100644 net-analyzer/ntop/files/ntop-5.0.1-system-ndpi.patch create mode 100644 net-analyzer/ntop/files/ntop-confd create mode 100644 net-analyzer/ntop/files/ntop-initd create mode 100644 net-analyzer/ntop/files/ntop-update-geoip-db create mode 100644 net-analyzer/ntop/ntop-5.0.1.ebuild diff --git a/net-analyzer/ntop/Manifest b/net-analyzer/ntop/Manifest new file mode 100644 index 00000000..be6dc529 --- /dev/null +++ b/net-analyzer/ntop/Manifest @@ -0,0 +1,7 @@ +AUX ntop-5.0.1-gentoo.patch 5470 SHA256 9c2814f16adf95507fe180b60b12bcfa28e03fa1f2a08ec9d36535c77d14eb55 SHA512 3825d3f5ec61b6395b4f3250285734a3fee37908f40e46c59bb7d849dae62059fcb585840c4446b0e8a5f7ec217abf626ba2569bd1ed8950849b99b25b7799b3 WHIRLPOOL 33b57ca787e74cfe5897f5b7db956ada90eb74e8612a073599ce243aba9c4043f928f03f4fe5a511a9dfbdf39217a783e665fd24e742f41114586ebb8c286fe7 +AUX ntop-5.0.1-system-ndpi.patch 949 SHA256 518d3a192d66b14e636029aa3aeb257b29733e754404956d513dbbcd00701bd7 SHA512 c492d6a9afcbf72074df43e3fb87f16f36d62497e990a7268749c22adcc34a1538081b79ce106f1617d95fa9bca67456212e0cc03ff705f1bcd3f836abc89b8f WHIRLPOOL ceb037c3431e997a739e15daea49146261b7aba258c31cff38433615a997b14d15f2fe1984e6f3b771bd5ed410860d024f8e8eb2cc1883ad03b7974fd5e92b46 +AUX ntop-confd 341 SHA256 b582253490df4cde55dda97585d45d16b2968296da7e9bc996dde932cf42584d SHA512 8693050cab03eeb29b59e0a7b173c7791625e8cd6bc33eaa5d74a50ab3ecf435577d7918626cfe3963a0d23d4522a737737b2b9fd8335df29784858a6191813d WHIRLPOOL b467f3baf1065ca7a2434fce23561b270adf1507d36269f1adec04ac41d08866885b043673d2908c44dc6fecb4db1768bc1a01ce590d65e4a629bf5b75b21d67 +AUX ntop-initd 747 SHA256 f583d6625690ee60744d407d149845db178f618f1239d962bfac14f39076dc7d SHA512 294cf1c0c274f1fbb29804965306be1aee97d98e83a2fd25925ac92398ce9d1f8f617968888842fa6d6d19b0b28f2f29bb9f8fd861067a18cc53ea89c91b0c67 WHIRLPOOL 3f57ec8e287e99d9d4854974d0d3d2566995ebb3b2889a8baed66457c45ac2d645af1dfa3d2e991a740d64465d70a91a5f93ca953ed2971f33d008c61dd45b36 +AUX ntop-update-geoip-db 492 SHA256 3604d0a728b203211fab05eca829a7e93bc05c04f252937ffbf630813420eef6 SHA512 7b5ae8dbd7d5d084c7278af1deb64a903b106663c3195df70acead3e8d7e14fbd996e69d5132c0ddac9147b3e70892c91695d834ab7b22fec2569efcd52df5f6 WHIRLPOOL d96c2fa39287ed6e0ac8b76a5c09ff4485305328bfd61fd738ff82a09cde0a8f0be76474d0c5bc95f0a55aa212b092f2e7b7a3bf3d8e6ee2ec1e88f246653e78 +DIST ntop-5.0.1.tar.gz 40133867 SHA256 7e8e84cb14d2173beaca4d4cb991a14d84a4bef84ec37b2276bc363f45c52ef8 SHA512 f52c40e6c00c8d2f46b68078c5f9aef8ed78670f92a0a81f66f2f44c71d41bc4c001b4550f19b71c546f7c07cbbed15e0aa1ee13873ac63a11678bf2b8483f2a WHIRLPOOL aa20b6529f343f6f57fc1d880c8cf07cd11720c6fe8c968359ff1e16b77fe3f4c6df1ed83a184e580d6ef7f5eff6d245b2971c17a7dd674c12325f21029f64ee +EBUILD ntop-5.0.1.ebuild 2860 SHA256 355165b51e9d1881aad77b0876736bc9f46c3d01f1cbf9f9066a59c37c8b3e46 SHA512 18e8583c6e234674cd29f5580e63af04fcf9159fcb028f37f032eafc404cddd237c54fb877e0a143f408a6e54c417e35a698f8db90419a26f6670e693d9ec71c WHIRLPOOL e4b41389df436295b97da9452fec45b1d293da26818773c06c1589f36de6dd3b69196193d08e66db2ed9a9271de9db456e493cb0ea9aaf15876d5c4884c4e8ca diff --git a/net-analyzer/ntop/files/ntop-5.0.1-gentoo.patch b/net-analyzer/ntop/files/ntop-5.0.1-gentoo.patch new file mode 100644 index 00000000..b86568b5 --- /dev/null +++ b/net-analyzer/ntop/files/ntop-5.0.1-gentoo.patch @@ -0,0 +1,185 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -36,7 +36,6 @@ + + #AM_CFLAGS = + #AM_LDFLAGS= +-ACLOCAL_AMFLAGS=-I m4 + + DISTCLEANFILES = trivialcompilemessage *.db #* *~ *.log + CLEANFILES = $(DISTCLEANFILES) stamp-h1 +@@ -67,9 +66,7 @@ + NTOPDATA = ntop-cert.pem \ + $(ETTER_PASSIVE) \ + oui.txt.gz \ +- specialMAC.txt.gz \ +- GeoIPASNum.dat \ +- GeoLiteCity.dat ++ specialMAC.txt.gz + + NTOPHTML = html html/*.js html/*.html html/*.gif html/*.jpg html/*.ico html/*.png \ + html/*.css html/*.dtd \ +@@ -133,7 +130,7 @@ + + libntop_la_DEPENDENCIES = config.h + libntop_la_LIBADD = $(BASE_LIBS) +-libntop_la_LDFLAGS = $(AM_LDFLAGS) -release $(VERSION) -export-dynamic @DYN_FLAGS@ ++libntop_la_LDFLAGS = $(AM_LDFLAGS) -release $(VERSION) -export-dynamic -shared @DYN_FLAGS@ + + # Archive for http representation, or the 'viewer' + libntopreport_la_SOURCES = emitter.c globals-report.c graph.c \ +@@ -145,7 +142,7 @@ + + libntopreport_la_DEPENDENCIES = libntop.la + libntopreport_la_LIBADD = libntop.la $(BASE_LIBS) +-libntopreport_la_LDFLAGS = $(AM_LDFLAGS) -release $(VERSION) -export-dynamic @DYN_FLAGS@ ++libntopreport_la_LDFLAGS = $(AM_LDFLAGS) -release $(VERSION) -export-dynamic -shared @DYN_FLAGS@ + + man_MANS = ntop.8 + +@@ -367,30 +364,7 @@ + + # download the vendor information table + dnvt: +- @echo "" +- @echo "" +- @echo -n "Preparing " +- @if test -f oui.txt; then \ +- rm -rf oui.txt; \ +- fi +- @if test -f oui.txt.gz.old; then \ +- rm -rf oui.txt.gz.old; \ +- fi; +- @mv oui.txt.gz oui.txt.gz.old +- @echo "(old oui.txt.gz file is now oui.txt.gz.old)" +- @echo "" +- @wget -c http://standards.ieee.org/regauth/oui/oui.txt +- @gzip oui.txt +- @echo "" +- @echo "" +- @echo -n "Old file lines were: " +- @gunzip -c oui.txt.gz.old | wc -l +- @echo -n "New file lines are: " +- @gunzip -c oui.txt.gz | wc -l +- @echo "" +- @echo "" +- @echo "New file is:" +- @ls -l oui.txt.gz ++ @echo "Use included oui.txt.gz" + + # download the Novell SAP Protocol information table + #dnsapt: +@@ -398,45 +372,7 @@ + + # download the passive ethernet fingerprint database + dnetter: +- @echo "" +- @echo "" +- @echo "Preparing " +- @echo "" +- +- @if test -f $(ETTER_PASSIVE).old; then \ +- echo "...Deleting prior file, $(ETTER_PASSIVE).old..."; \ +- rm -rf $(ETTER_PASSIVE).old; \ +- fi; +- @if test -f $(ETTER_PASSIVE); then \ +- echo "...Moving current $(ETTER_PASSIVE) to $(ETTER_PASSIVE).old"; \ +- mv $(ETTER_PASSIVE) $(ETTER_PASSIVE).old; \ +- fi; +- @for file in $(ETTER_PASSIVE) $(ETTER_PASSIVE).gz \ +- $(ETTER_PASSIVE_FILE) $(ETTER_PASSIVE_FILE).gz; do \ +- if test -f $$file; then \ +- echo "...Deleting prior file, $$file..."; \ +- rm -rf $$file; \ +- fi; \ +- done +- @echo "" +- @echo "...Downloading new file..." +- @wget -O $(ETTER_PASSIVE_FILE) \ +- $(ETTER_PASSIVE_DOWNLOAD_FROM)/$(ETTER_PASSIVE_FILE)?$(ETTER_PASSIVE_DOWNLOAD_PARMS) +- @echo "" +- @echo "gziping downloaded file..." +- @gzip $(ETTER_PASSIVE_FILE) +- @echo "" +- @echo "" +- @if test -f $(ETTER_PASSIVE).old; then \ +- echo -n "Old file lines were: "; \ +- gunzip -c $(ETTER_PASSIVE).old | wc -l; \ +- fi; +- @echo -n "New file lines are: " +- @gunzip -c $(ETTER_PASSIVE) | wc -l +- @echo "" +- @echo "" +- @echo "New file is:" +- @ls -l $(ETTER_PASSIVE) ++ @echo "Use included $(ETTER_PASSIVE)" + + # ntop census + census-fail: +--- a/globals-core.c ++++ b/globals-core.c +@@ -369,7 +369,7 @@ + _mtuSize[DLT_ATM_RFC1483] = 9180 /* LLC/SNAP encapsulated atm */; + _headerSize[DLT_ATM_RFC1483] = 0; + +- /* _mtuSize[DLT_RAW] = ? raw IP */ ++ _mtuSize[DLT_RAW] = 1500; /* raw IP */ + _headerSize[DLT_RAW] = 0; + + /* Others defined in bpf.h at tcpdump.org as of the resync - it would be NICE +@@ -470,19 +470,18 @@ + struct stat statbuf; + + /* Initialize GeoIP databases */ +- for(i=0; myGlobals.configFileDirs[i] != NULL; i++) { ++ { + char path[256]; + + safe_snprintf(__FILE__, __LINE__, path, sizeof(path), + "%s%c%s", +- myGlobals.configFileDirs[i], ++ myGlobals.dbPath, + CONST_PATH_SEP, GEO_IP_FILE); + revertSlashIfWIN32(path, 0); + + if(stat(path, &statbuf) == 0) { + if((myGlobals.geo_ip_db = GeoIP_open(path, GEOIP_CHECK_CACHE)) != NULL) { + traceEvent(CONST_TRACE_INFO, "GeoIP: loaded config file %s", path); +- break; + } + } + } +@@ -491,20 +490,18 @@ + traceEvent(CONST_TRACE_ERROR, "GeoIP: unable to load file %s", GEO_IP_FILE); + + /* *************************** */ +- +- for(i=0; myGlobals.configFileDirs[i] != NULL; i++) { ++ { + char path[256]; + + safe_snprintf(__FILE__, __LINE__, path, sizeof(path), + "%s%c%s", +- myGlobals.configFileDirs[i], ++ myGlobals.dbPath, + CONST_PATH_SEP, GEO_IP_ASN_FILE); + revertSlashIfWIN32(path, 0); + + if(stat(path, &statbuf) == 0) { + if((myGlobals.geo_ip_asn_db = GeoIP_open(path, GEOIP_CHECK_CACHE)) != NULL) { + traceEvent(CONST_TRACE_INFO, "GeoIP: loaded ASN config file %s", path); +- break; + } + } + } +--- a/report.c ++++ b/report.c +@@ -2299,7 +2299,7 @@ + if(fetchPrefsValue("dot.path", buf, sizeof(buf)) != -1) { + snprintf(dotPath, sizeof(dotPath), "%s", buf); + } else { +- snprintf(dotPath, sizeof(dotPath), "/usr/local/bin/dot"); ++ snprintf(dotPath, sizeof(dotPath), "/usr/bin/dot"); + storePrefsValue("dot.path", dotPath); /* Set the default */ + } + diff --git a/net-analyzer/ntop/files/ntop-5.0.1-system-ndpi.patch b/net-analyzer/ntop/files/ntop-5.0.1-system-ndpi.patch new file mode 100644 index 00000000..68a1170e --- /dev/null +++ b/net-analyzer/ntop/files/ntop-5.0.1-system-ndpi.patch @@ -0,0 +1,42 @@ +--- configure.in.orig 2012-08-13 15:35:26.000000000 +0800 ++++ configure.in 2012-11-08 07:55:51.000000000 +0800 +@@ -688,8 +688,8 @@ + fi + + dnl> nDPI based on OpenDPI (https://code.google.com/p/opendpi/) +-NDPI_LIB=./nDPI/src/lib/.libs/libndpi.a +-NDPI_INC=./nDPI/src/include/ ++NDPI_LIB=-lndpi ++NDPI_INC=/usr/include/libndpi + + + dnl> Define the arguments we accept... +--- autogen.sh.orig 2012-02-20 18:35:43.000000000 +0800 ++++ autogen.sh 2012-11-08 07:54:32.000000000 +0800 +@@ -434,26 +434,6 @@ + rm -f autoha* + rm -f confdefs.h + +-# Get nDPI +- +-echo "9. Downloading nDPI..." +- +-NDPI_URL=https://svn.ntop.org/svn/ntop/trunk/nDPI/ +-if test -d nDPI; then +- echo "nDPI already available" +-else +- svn co $NDPI_URL +-fi +- +-dnl> nDPI compilation +-if test -f NDPI_LIB; then +- echo "nDPI already compiled" +-else +- echo "10. Compiling nDPI..." +- cd nDPI; ./configure --with-pic; make; cd .. +-fi +- +- + echo + echo "Now we're ready to compile ntop" + diff --git a/net-analyzer/ntop/files/ntop-confd b/net-analyzer/ntop/files/ntop-confd new file mode 100644 index 00000000..352a26fa --- /dev/null +++ b/net-analyzer/ntop/files/ntop-confd @@ -0,0 +1,9 @@ +# Config file for /etc/init.d/ntop + +# Set preferred options here +#NTOP_OPTS="--http-server 3000 --https-server 0 --interface eth0" + +# suggestions from bug #136983 (use it in case you experience ntop hangs) +#NTOP_OPTS="u ntop -P /var/lib/ntop --disable-schedyield --http-server 3000 --https-server 3001" + +NTOP_OPTS="-u ntop -P /var/lib/ntop" diff --git a/net-analyzer/ntop/files/ntop-initd b/net-analyzer/ntop/files/ntop-initd new file mode 100644 index 00000000..ffc29237 --- /dev/null +++ b/net-analyzer/ntop/files/ntop-initd @@ -0,0 +1,30 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need net +} + +checkconfig() { + if [ ! -e /var/lib/ntop/ntop_pw.db ]; then + eerror "You need to set a password first by running" + eerror "ntop --set-admin-password" + return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting ntop" + export LC_ALL=C # apparently doesn't work with some locales (#191576 and #205382) + export GDFONTPATH=/usr/share/fonts/corefonts # apparently the only font that works (#231705) + start-stop-daemon --start --exec /usr/bin/ntop -- -d -L ${NTOP_OPTS} + eend $? +} + +stop() { + ebegin "Stopping ntop" + start-stop-daemon --stop --retry 30 --pidfile /var/run/ntop.pid + eend $? +} diff --git a/net-analyzer/ntop/files/ntop-update-geoip-db b/net-analyzer/ntop/files/ntop-update-geoip-db new file mode 100644 index 00000000..2bf3faaf --- /dev/null +++ b/net-analyzer/ntop/files/ntop-update-geoip-db @@ -0,0 +1,21 @@ +#!/bin/sh + +BASE_URL=http://geolite.maxmind.com/download/geoip/database + +echo "Updating NTOP GeoIP databases..." + +cd /var/lib/ntop || exit + +for u in asnum/GeoIPASNum.dat.gz GeoLiteCity.dat.gz ; do + FILE_GZ=${u#*/} + FILE=${FILE_GZ%.gz} + wget -nv -O ${FILE_GZ} ${BASE_URL}/${u} && + gunzip < ${FILE_GZ} > .${FILE} && + mv -f .${FILE} ${FILE} && + rm -f ${FILE_GZ} || + exit +done + +/etc/init.d/ntop --quiet status && /etc/init.d/ntop restart + +echo "NTOP GeoIP databases were successfully updated" diff --git a/net-analyzer/ntop/ntop-5.0.1.ebuild b/net-analyzer/ntop/ntop-5.0.1.ebuild new file mode 100644 index 00000000..3c0e901b --- /dev/null +++ b/net-analyzer/ntop/ntop-5.0.1.ebuild @@ -0,0 +1,116 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="4" + +PYTHON_DEPEND="2" + +inherit autotools eutils user python + +DESCRIPTION="Network traffic analyzer with web interface" +HOMEPAGE="http://www.ntop.org/products/ntop/" +SRC_URI="mirror://sourceforge/ntop/ntop/Stable/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="snmp ssl" + +COMMON_DEPEND=" + sys-apps/gawk + dev-lang/perl + sys-libs/gdbm + dev-libs/libevent + net-libs/libpcap + media-libs/gd + media-libs/libpng + net-analyzer/rrdtool + ssl? ( dev-libs/openssl ) + sys-libs/zlib + dev-libs/geoip + dev-lang/lua + snmp? ( net-analyzer/net-snmp[ipv6] )" +DEPEND="${COMMON_DEPEND} + >=sys-devel/libtool-1.5.26" +RDEPEND="${COMMON_DEPEND} + media-fonts/corefonts + media-gfx/graphviz + net-misc/wget + app-arch/gzip + !arm? ( dev-libs/gdome2 ) + dev-libs/glib:2" + +pkg_setup() { + python_set_active_version 2 + python_pkg_setup + enewgroup ntop + enewuser ntop -1 -1 /var/lib/ntop ntop +} + +src_prepare() { + python_convert_shebangs -q -r 2 "${S}" + epatch "${FILESDIR}"/${P}-gentoo.patch +#Waiting for the fix, see https://www.ntop.org/bugzilla3/show_bug.cgi?id=273 +# epatch "${FILESDIR}"/${P}-system-ndpi.patch +# rm -r ./nDPI + cp /usr/share/aclocal/libtool.m4 libtool.m4.in + cat acinclude.m4.in libtool.m4.in acinclude.m4.ntop > acinclude.m4 + eautoreconf +} + +src_configure() { + export \ + ac_cv_header_glib_h=no \ + ac_cv_header_glibconfig_h=no \ + ac_cv_header_gdome_h=no \ + ac_cv_lib_glib_g_date_julian=no \ + ac_cv_lib_xml2_xmlCheckVersion=no \ + ac_cv_lib_gdome_gdome_di_saveDocToFile=no + + cd ./nDPI + econf + emake + cd .. + + econf \ + $(use_enable snmp) \ + $(use_with ssl) \ + --with-rrd-home=/usr/lib \ + || die "configure problem" +} + +src_install() { + LC_ALL=C # apparently doesn't work with some locales (#191576 and #205382) + emake DESTDIR="${D}" install || die "install problem" + + keepdir /var/lib/ntop && + fowners ntop:ntop /var/lib/ntop && + fperms 750 /var/lib/ntop || + die "failed to prepare /var/lib/ntop dir" + insinto /var/lib/ntop + gunzip 3rd_party/GeoIPASNum.dat.gz + gunzip 3rd_party/GeoLiteCity.dat.gz + local f + for f in GeoIPASNum.dat GeoLiteCity.dat; do + # Don't install included GeoIP files if newer versions are available + [ -f "${ROOT}/var/lib/ntop/${f}" ] || + doins "3rd_party/${f}" || + die "failed to install ${f}" + done + + dodoc AUTHORS CONTENTS ChangeLog MANIFESTO NEWS + dodoc PORTING README SUPPORT_NTOP.txt THANKS $(find docs -type f) + + newinitd "${FILESDIR}"/ntop-initd ntop + newconfd "${FILESDIR}"/ntop-confd ntop + + exeinto /etc/cron.monthly + doexe "${FILESDIR}"/ntop-update-geoip-db +} + +pkg_postinst() { + elog "If this is the first time you install ntop, you need to run" + elog "following command before starting ntop service:" + elog " ntop --set-admin-password" +}