|
From: <abe...@us...> - 2013-11-13 15:49:26
|
Revision: 6269
http://sourceforge.net/p/astlinux/code/6269
Author: abelbeck
Date: 2013-11-13 15:49:23 +0000 (Wed, 13 Nov 2013)
Log Message:
-----------
darkstat, new package, very small (75 KB) daemon that logs network statistics via PCAP to a database in memory. Uses lighttpd to proxy it's HTTP server as /admin/netstat/
http://unix4lyfe.org/darkstat/
Modified Paths:
--------------
branches/1.0/astlinux-ast11.config
branches/1.0/astlinux.config
branches/1.0/astlinux18.config
branches/1.0/initrd.config
branches/1.0/package/Config.in
branches/1.0/package/lighttpd/lighttpd.conf
branches/1.0/package/lighttpd/lighttpd.init
branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf
branches/1.0/runnix-uclibc.config
branches/1.0/runnix.config
Added Paths:
-----------
branches/1.0/package/darkstat/
branches/1.0/package/darkstat/Config.in
branches/1.0/package/darkstat/darkstat-homepage-link.patch
branches/1.0/package/darkstat/darkstat-proxy-base.patch
branches/1.0/package/darkstat/darkstat.init
branches/1.0/package/darkstat/darkstat.mk
Modified: branches/1.0/astlinux-ast11.config
===================================================================
--- branches/1.0/astlinux-ast11.config 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/astlinux-ast11.config 2013-11-13 15:49:23 UTC (rev 6269)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Buildroot 2011.08-svn6211-dirty Configuration
-# Mon Sep 30 15:22:34 2013
+# Buildroot 2011.08-svn6268-dirty Configuration
+# Wed Nov 13 09:15:13 2013
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -670,6 +670,7 @@
# BR2_PACKAGE_CAN_UTILS is not set
# BR2_PACKAGE_CTORRENT is not set
# BR2_PACKAGE_CUPS is not set
+BR2_PACKAGE_DARKSTAT=y
BR2_PACKAGE_DHCPDUMP=y
BR2_PACKAGE_DNSMASQ=y
BR2_PACKAGE_DNSMASQ_TFTP=y
Modified: branches/1.0/astlinux.config
===================================================================
--- branches/1.0/astlinux.config 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/astlinux.config 2013-11-13 15:49:23 UTC (rev 6269)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Buildroot 2011.08-svn6211-dirty Configuration
-# Mon Sep 30 15:22:26 2013
+# Buildroot 2011.08-svn6268-dirty Configuration
+# Wed Nov 13 09:15:08 2013
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -672,6 +672,7 @@
# BR2_PACKAGE_CAN_UTILS is not set
# BR2_PACKAGE_CTORRENT is not set
# BR2_PACKAGE_CUPS is not set
+BR2_PACKAGE_DARKSTAT=y
BR2_PACKAGE_DHCPDUMP=y
BR2_PACKAGE_DNSMASQ=y
BR2_PACKAGE_DNSMASQ_TFTP=y
Modified: branches/1.0/astlinux18.config
===================================================================
--- branches/1.0/astlinux18.config 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/astlinux18.config 2013-11-13 15:49:23 UTC (rev 6269)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Buildroot 2011.08-svn6211-dirty Configuration
-# Mon Sep 30 15:22:28 2013
+# Buildroot 2011.08-svn6268-dirty Configuration
+# Wed Nov 13 09:15:10 2013
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -670,6 +670,7 @@
# BR2_PACKAGE_CAN_UTILS is not set
# BR2_PACKAGE_CTORRENT is not set
# BR2_PACKAGE_CUPS is not set
+BR2_PACKAGE_DARKSTAT=y
BR2_PACKAGE_DHCPDUMP=y
BR2_PACKAGE_DNSMASQ=y
BR2_PACKAGE_DNSMASQ_TFTP=y
Modified: branches/1.0/initrd.config
===================================================================
--- branches/1.0/initrd.config 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/initrd.config 2013-11-13 15:49:23 UTC (rev 6269)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Buildroot 2011.08-svn6091-dirty Configuration
-# Sat May 18 14:47:43 2013
+# Buildroot 2011.08-svn6268-dirty Configuration
+# Wed Nov 13 09:15:27 2013
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -549,6 +549,7 @@
# BR2_PACKAGE_CAN_UTILS is not set
# BR2_PACKAGE_CTORRENT is not set
# BR2_PACKAGE_CUPS is not set
+# BR2_PACKAGE_DARKSTAT is not set
# BR2_PACKAGE_DHCPDUMP is not set
# BR2_PACKAGE_DNSMASQ is not set
# BR2_PACKAGE_DROPBEAR is not set
Modified: branches/1.0/package/Config.in
===================================================================
--- branches/1.0/package/Config.in 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/package/Config.in 2013-11-13 15:49:23 UTC (rev 6269)
@@ -444,6 +444,7 @@
source "package/can-utils/Config.in"
source "package/ctorrent/Config.in"
source "package/cups/Config.in"
+source "package/darkstat/Config.in"
if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
source "package/dhcp/Config.in"
endif
Added: branches/1.0/package/darkstat/Config.in
===================================================================
--- branches/1.0/package/darkstat/Config.in (rev 0)
+++ branches/1.0/package/darkstat/Config.in 2013-11-13 15:49:23 UTC (rev 6269)
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_DARKSTAT
+ bool "darkstat"
+ default n
+ select BR2_PACKAGE_LIBPCAP
+ help
+ Darkstat:
+ Captures network traffic, calculates statistics about usage,
+ and serves reports over HTTP.
+
+ http://unix4lyfe.org/darkstat/
+
Added: branches/1.0/package/darkstat/darkstat-homepage-link.patch
===================================================================
--- branches/1.0/package/darkstat/darkstat-homepage-link.patch (rev 0)
+++ branches/1.0/package/darkstat/darkstat-homepage-link.patch 2013-11-13 15:49:23 UTC (rev 6269)
@@ -0,0 +1,11 @@
+--- darkstat-3.0.717/html.c.orig 2013-11-12 12:08:13.000000000 -0600
++++ darkstat-3.0.717/html.c 2013-11-12 12:12:41.000000000 -0600
+@@ -51,7 +51,7 @@
+ "<li class=\"label\">" PACKAGE_STRING "</li>"
+ "<li><a href=\"%s/\">graphs</a></li>"
+ "<li><a href=\"%s/hosts/\">hosts</a></li>"
+- "<li><a href=\"" PACKAGE_URL "\">homepage</a></li>"
++ "<li class=\"label\">" PACKAGE_URL "</li>"
+ "</ul>\n"
+ "</div>\n"
+ "<div class=\"content\">\n"
Added: branches/1.0/package/darkstat/darkstat-proxy-base.patch
===================================================================
--- branches/1.0/package/darkstat/darkstat-proxy-base.patch (rev 0)
+++ branches/1.0/package/darkstat/darkstat-proxy-base.patch 2013-11-13 15:49:23 UTC (rev 6269)
@@ -0,0 +1,16 @@
+--- darkstat-3.0.717/http.c.orig 2013-11-12 12:15:44.000000000 -0600
++++ darkstat-3.0.717/http.c 2013-11-12 12:41:24.000000000 -0600
+@@ -250,6 +250,13 @@
+ assert(pos <= urilen);
+ out[pos] = '\0';
+
++ char *proxy_base = "/admin/netstat/"; /* str must begin and end with '/' */
++ if ((i = strlen(proxy_base)) > 1) {
++ if (str_starts_with(out, proxy_base)) {
++ memmove(out, out+i-1, strlen(out)-i+2);
++ }
++ }
++
+ #if 0
+ /* don't really need to do this and it's probably a performance hit: */
+ /* shorten buffer if necessary */
Added: branches/1.0/package/darkstat/darkstat.init
===================================================================
--- branches/1.0/package/darkstat/darkstat.init (rev 0)
+++ branches/1.0/package/darkstat/darkstat.init 2013-11-13 15:49:23 UTC (rev 6269)
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+. /etc/rc.conf
+
+PIDFILE="/var/run/darkstat.pid"
+
+CHROOT_DIR="/var/lib/darkstat"
+
+init () {
+ :
+}
+
+start () {
+ local filter="" promisc=""
+
+ if [ "$NETSTAT_SERVER" = "darkstat" ]; then
+ echo "Starting darkstat..."
+
+ mkdir -p $CHROOT_DIR
+ if [ -f $PIDFILE ]; then
+ rm $PIDFILE
+ fi
+
+ if [ -n "$NETSTAT_FILTER" ]; then
+ filter="$NETSTAT_FILTER"
+ fi
+ if [ "$NETSTAT_PROMISCUOUS" != "yes" ]; then
+ promisc="--no-promisc"
+ fi
+
+ darkstat -i $EXTIF --chroot $CHROOT_DIR --pidfile $PIDFILE --syslog ${promisc} ${filter:+-f "$filter"} \
+ -b 127.0.0.1 -p 667
+ fi
+}
+
+stop () {
+
+ if [ -f $PIDFILE ]; then
+ echo "Stopping darkstat..."
+
+ kill $(cat $PIDFILE) >/dev/null 2>&1
+ rm -f $PIDFILE
+ fi
+}
+
+case $1 in
+
+start)
+ start
+ ;;
+
+stop)
+ stop
+ ;;
+
+init)
+ init
+ start
+ ;;
+
+restart)
+ stop
+ sleep 2
+ start
+ ;;
+
+*)
+ echo "Usage: start|stop|restart"
+ ;;
+
+esac
+
Added: branches/1.0/package/darkstat/darkstat.mk
===================================================================
--- branches/1.0/package/darkstat/darkstat.mk (rev 0)
+++ branches/1.0/package/darkstat/darkstat.mk 2013-11-13 15:49:23 UTC (rev 6269)
@@ -0,0 +1,32 @@
+#############################################################
+#
+# darkstat
+#
+#############################################################
+DARKSTAT_VERSION = 3.0.717
+DARKSTAT_SITE = http://unix4lyfe.org/darkstat
+DARKSTAT_SOURCE = darkstat-$(DARKSTAT_VERSION).tar.bz2
+
+DARKSTAT_DEPENDENCIES = zlib libpcap
+
+DARKSTAT_UNINSTALL_STAGING_OPT = --version
+
+DARKSTAT_CONF_OPT = \
+ --disable-debug \
+ --with-chroot-dir=/var/empty
+
+define DARKSTAT_INSTALL_TARGET_CMDS
+ $(INSTALL) -D -m 0755 $(@D)/darkstat $(TARGET_DIR)/usr/sbin/
+ $(INSTALL) -D -m 0755 package/darkstat/darkstat.init $(TARGET_DIR)/etc/init.d/darkstat
+ ln -sf ../../init.d/darkstat $(TARGET_DIR)/etc/runlevels/default/S75darkstat
+ ln -sf ../../init.d/darkstat $(TARGET_DIR)/etc/runlevels/default/K15darkstat
+endef
+
+define DARKSTAT_UNINSTALL_TARGET_CMDS
+ rm -f $(TARGET_DIR)/usr/sbin/darkstat
+ rm -f $(TARGET_DIR)/etc/init.d/darkstat
+ rm -f $(TARGET_DIR)/etc/runlevels/default/S75darkstat
+ rm -f $(TARGET_DIR)/etc/runlevels/default/K15darkstat
+endef
+
+$(eval $(call AUTOTARGETS,package,darkstat))
Modified: branches/1.0/package/lighttpd/lighttpd.conf
===================================================================
--- branches/1.0/package/lighttpd/lighttpd.conf 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/package/lighttpd/lighttpd.conf 2013-11-13 15:49:23 UTC (rev 6269)
@@ -131,16 +131,27 @@
)
@CLI_PROXY_SERVER@$HTTP["scheme"] == "https" {
-@CLI_PROXY_SERVER@ proxy.server = ( "/admin/cli/" =>
-@CLI_PROXY_SERVER@ ( "localhost" =>
-@CLI_PROXY_SERVER@ (
-@CLI_PROXY_SERVER@ "host" => "127.0.0.1",
-@CLI_PROXY_SERVER@ "port" => "4200"
-@CLI_PROXY_SERVER@ )
-@CLI_PROXY_SERVER@ )
-@CLI_PROXY_SERVER@ )
+@CLI_PROXY_SERVER@ proxy.server += ( "/admin/cli/" =>
+@CLI_PROXY_SERVER@ ( "localhost" =>
+@CLI_PROXY_SERVER@ (
+@CLI_PROXY_SERVER@ "host" => "127.0.0.1",
+@CLI_PROXY_SERVER@ "port" => "4200"
+@CLI_PROXY_SERVER@ )
+@CLI_PROXY_SERVER@ )
+@CLI_PROXY_SERVER@ )
@CLI_PROXY_SERVER@}
+@NETSTAT_SERVER@$HTTP["scheme"] == "https" {
+@NETSTAT_SERVER@ proxy.server += ( "/admin/netstat/" =>
+@NETSTAT_SERVER@ ( "localhost" =>
+@NETSTAT_SERVER@ (
+@NETSTAT_SERVER@ "host" => "127.0.0.1",
+@NETSTAT_SERVER@ "port" => "667"
+@NETSTAT_SERVER@ )
+@NETSTAT_SERVER@ )
+@NETSTAT_SERVER@ )
+@NETSTAT_SERVER@}
+
@PHO...@al... += ( "/phoneprov/" => "/mnt/kd/phoneprov/" )
@PHONEPROV@
@PHONEPROV@$HTTP["url"] =~ "^/phoneprov/" {
Modified: branches/1.0/package/lighttpd/lighttpd.init
===================================================================
--- branches/1.0/package/lighttpd/lighttpd.init 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/package/lighttpd/lighttpd.init 2013-11-13 15:49:23 UTC (rev 6269)
@@ -71,6 +71,11 @@
else
cli_proxy_server="#"
fi
+ if [ "$NETSTAT_SERVER" = "darkstat" ]; then
+ netstat_server=""
+ else
+ netstat_server="#"
+ fi
if [ -d /mnt/kd/phoneprov ]; then
phoneprov=""
else
@@ -107,6 +112,7 @@
-e "s|@HTTPSCGI@|${httpscgi}|g" \
-e "s|@IPV6@|${ipv6}|g" \
-e "s|@CLI_PROXY_SERVER@|${cli_proxy_server}|g" \
+ -e "s|@NETSTAT_SERVER@|${netstat_server}|g" \
-e "s|@PHONEPROV@|${phoneprov}|g" \
-e "s!@PHONEPROV_ALLOW@!${phoneprov_allow}!g" \
-e "s|@FOP2@|${fop2}|g" \
Modified: branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf
===================================================================
--- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2013-11-13 15:49:23 UTC (rev 6269)
@@ -300,6 +300,14 @@
## To start shellinaboxd, set to 'shellinaboxd'. Disabled by default.
CLI_PROXY_SERVER=""
+## Network Statistics Server (darkstat)
+## Captures network traffic, calculates statistics about usage, and serves reports over HTTP.
+## HTTP only reachable on 127.0.0.1:667 via the web interface NetStat tab, proxied via lighttpd.
+## To start darkstat, set to 'darkstat'. Disabled by default.
+NETSTAT_SERVER=""
+#NETSTAT_FILTER="port 5060 or 5061 or 22" # Specify PCAP filter rule, defaults to all. See tcpdump(1) documentation.
+#NETSTAT_PROMISCUOUS="yes" # If "yes" set interface to promiscuous mode, defaults to "no"
+
## HTTPS Server
HTTPSDIR="/stat/var/www" # Define the location to serve HTTPS from
HTTPS_LISTING="yes" # Allow directory listing if no index.* file exists
Modified: branches/1.0/runnix-uclibc.config
===================================================================
--- branches/1.0/runnix-uclibc.config 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/runnix-uclibc.config 2013-11-13 15:49:23 UTC (rev 6269)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Buildroot 2011.08-svn6091-dirty Configuration
-# Sat May 18 14:47:41 2013
+# Buildroot 2011.08-svn6268-dirty Configuration
+# Wed Nov 13 09:15:22 2013
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -839,6 +839,7 @@
# ctorrent requires a toolchain with C++ support enabled
#
# BR2_PACKAGE_CUPS is not set
+# BR2_PACKAGE_DARKSTAT is not set
# BR2_PACKAGE_DHCP is not set
# BR2_PACKAGE_DHCPDUMP is not set
# BR2_PACKAGE_DNSMASQ is not set
Modified: branches/1.0/runnix.config
===================================================================
--- branches/1.0/runnix.config 2013-11-11 21:40:37 UTC (rev 6268)
+++ branches/1.0/runnix.config 2013-11-13 15:49:23 UTC (rev 6269)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Buildroot 2011.08-svn6091-dirty Configuration
-# Sat May 18 14:47:40 2013
+# Buildroot 2011.08-svn6268-dirty Configuration
+# Wed Nov 13 09:15:17 2013
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -578,6 +578,7 @@
# BR2_PACKAGE_CAN_UTILS is not set
# BR2_PACKAGE_CTORRENT is not set
# BR2_PACKAGE_CUPS is not set
+# BR2_PACKAGE_DARKSTAT is not set
# BR2_PACKAGE_DHCP is not set
# BR2_PACKAGE_DHCPDUMP is not set
# BR2_PACKAGE_DNSMASQ is not set
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|