Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jul 2004 02:13:09 +0300 (EEST)
From:      Mantas Kaulakys <stone@tainet.lt>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/68934: New port: security/amavis-stats A simple AMaViS statistics generator based on rrdtool
Message-ID:  <20040711231309.E29313EA@gigas.tainet.lt>
Resent-Message-ID: <200407112320.i6BNKGMD009920@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         68934
>Category:       ports
>Synopsis:       New port: security/amavis-stats A simple AMaViS statistics generator based on rrdtool
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 11 23:20:16 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Mantas Kaulakys
>Release:        FreeBSD 5.2.1-RELEASE-p7 i386
>Organization:
>Environment:
System: FreeBSD gigas.tainet.lt 5.2.1-RELEASE-p7 FreeBSD 5.2.1-RELEASE-p7 #14: Thu May 20 18:41:33 EEST 2004 stone@gigas.tainet.lt:/usr/obj/usr/src/sys/GIGAS i386


	
>Description:
	amavis-stats is a simple AMaViS statistics generator based on rrdtool.
	It produces graphs of clean emails, spam emails and infected emails
	broken down by virus, from amavis log entries. RRD files are created
	and updated by a perl script run from cron. Graphs are generated by
	a php script and viewed with a web browser.

	WWW: http://rekudos.net/amavis-stats/
>How-To-Repeat:
>Fix:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#       /usr/ports/security/amavis-stats
#       /usr/ports/security/amavis-stats/distinfo
#       /usr/ports/security/amavis-stats/Makefile
#       /usr/ports/security/amavis-stats/aa.sh
#       /usr/ports/security/amavis-stats/pkg-descr
#       /usr/ports/security/amavis-stats/pkg-plist
#       /usr/ports/security/amavis-stats/files
#       /usr/ports/security/amavis-stats/files/patch-amavis-stats
#       /usr/ports/security/amavis-stats/files/patch-amavis-stats.php
#       /usr/ports/security/amavis-stats/files/DEINSTALL.tmpl
#       /usr/ports/security/amavis-stats/files/INSTALL.tmpl
#       /usr/ports/security/amavis-stats/pkg-message
#
echo c - /usr/ports/security/amavis-stats
mkdir -p /usr/ports/security/amavis-stats > /dev/null 2>&1
echo x - /usr/ports/security/amavis-stats/distinfo
sed 's/^X//' >/usr/ports/security/amavis-stats/distinfo << 'END-of-/usr/ports/security/amavis-stats/distinfo'
XMD5 (amavis-stats-0.1.12.tar.gz) = b85063b3bb8ecdb03d1b7aebf0c0a6cd
XSIZE (amavis-stats-0.1.12.tar.gz) = 60626
END-of-/usr/ports/security/amavis-stats/distinfo
echo x - /usr/ports/security/amavis-stats/Makefile
sed 's/^X//' >/usr/ports/security/amavis-stats/Makefile << 'END-of-/usr/ports/security/amavis-stats/Makefile'
X# New ports collection makefile for: amavis-stats
X# Date created:        12 July 2004
X# Whom:                Mantas Kaulakys <stone@tainet.lt>
X#
X# $FreeBSD$
X#
X
XPORTNAME=      amavis-stats
XPORTVERSION=   0.1.12
XCATEGORIES=    security
XMASTER_SITES=  http://rekudos.net/download/
X
XMAINTAINER=    stone@tainet.lt
XCOMMENT=       A simple AMaViS statistics generator based on rrdtool
X
XRUN_DEPENDS=   ${SITE_PERL}/mach/RRDs.pm:${PORTSDIR}/net/rrdtool
X
XUSE_PERL5_RUN= yes
XUSE_PHP=       yes
XWANT_PHP_WEB=  yes
X
XMAN1=           amavis-stats.1
X
XNO_BUILD=      yes
X
XPORTDOCS=      README
X
XWEBOWN?=       www
XWEBGRP?=       www
X
XAMAVISUSER?=    amavis
XAMAVISGROUP?=   amavis
X
XPKGINSTALL=    ${WRKDIR}/INSTALL
XPKGDEINSTALL=  ${WRKDIR}/DEINSTALL
X
XSED_SCRIPT=     -e 's,%%AMAVISUSER%%,${AMAVISUSER},g' \
X               -e 's,%%AMAVISGROUP%%,${AMAVISGROUP},g'
X
X.include <bsd.port.pre.mk>
X
X.if ${PERL_LEVEL} < 500601
XIGNORE="Need at least perl 5.6.1 to build"
X.endif
X
Xpre-install:
X       for f in INSTALL; do \
X       ${SED} ${SED_SCRIPT} < ${FILESDIR}/$${f}.tmpl > ${WRKDIR}/$${f}; \
X       done
X       @${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL
X
Xdo-install:
X       $(INSTALL) -m 755 ${WRKSRC}/amavis-stats ${LOCALBASE}/sbin
X       ${INSTALL_MAN} ${WRKSRC}/amavis-stats.1 ${MAN1PREFIX}/man/man1
X       ${MKDIR} ${LOCALBASE}/www/amavis-stats
X       ${MKDIR} ${LOCALBASE}/www/amavis-stats/img
X       ${INSTALL} -m 644 ${WRKSRC}/amavis-stats.php ${LOCALBASE}/www/amavis-stats
X       cd ${LOCALBASE}/www/amavis-stats && ${LN} -s amavis-stats.php index.php
X       ${CHOWN} -R ${AMAVISUSER}:${AMAVISGROUP} ${LOCALBASE}/www/amavis-stats
X       ${CHOWN} ${WEBOWN}:${WEBGRP} ${LOCALBASE}/www/amavis-stats/img
X
X.if !defined(NOPORTDOCS)
X       ${MKDIR} ${DOCSDIR}
X       ${INSTALL_MAN} ${WRKSRC}/${PORTDOCS} ${DOCSDIR}
X.endif
X
Xpost-install:
X       @${CAT} ${PKGMESSAGE}
X
Xpost-deinstall:
X       for f in DEINSTALL; do \
X       ${SED} ${SED_SCRIPT} < ${FILESDIR}/$${f}.tmpl > ${WRKDIR}/$${f}; \
X       done
X       @${SH} ${PKGDEINSTALL} ${DISTNAME} POST-DEINSTALL
X
X.include <bsd.port.post.mk>
END-of-/usr/ports/security/amavis-stats/Makefile
echo x - /usr/ports/security/amavis-stats/aa.sh
sed 's/^X//' >/usr/ports/security/amavis-stats/aa.sh << 'END-of-/usr/ports/security/amavis-stats/aa.sh'
X# This is a shell archive.  Save it in a file, remove anything before
X# this line, and then unpack it by entering "sh file".  Note, it may
X# create directories; files and directories will be owned by you and
X# have default permissions.
X#
X# This archive contains:
X#
X#      /usr/ports/security/amavis-stats
X#      /usr/ports/security/amavis-stats/distinfo
X#      /usr/ports/security/amavis-stats/Makefile
X#      /usr/ports/security/amavis-stats/aa.sh
X#      /usr/ports/security/amavis-stats/pkg-descr
X#      /usr/ports/security/amavis-stats/pkg-plist
X#      /usr/ports/security/amavis-stats/files
X#      /usr/ports/security/amavis-stats/files/patch-amavis-stats
X#      /usr/ports/security/amavis-stats/files/patch-amavis-stats.php
X#      /usr/ports/security/amavis-stats/files/DEINSTALL.tmpl
X#      /usr/ports/security/amavis-stats/files/INSTALL.tmpl
X#      /usr/ports/security/amavis-stats/pkg-message
X#
Xecho c - /usr/ports/security/amavis-stats
Xmkdir -p /usr/ports/security/amavis-stats > /dev/null 2>&1
Xecho x - /usr/ports/security/amavis-stats/distinfo
Xsed 's/^X//' >/usr/ports/security/amavis-stats/distinfo << 'END-of-/usr/ports/security/amavis-stats/distinfo'
XXMD5 (amavis-stats-0.1.12.tar.gz) = b85063b3bb8ecdb03d1b7aebf0c0a6cd
XXSIZE (amavis-stats-0.1.12.tar.gz) = 60626
XEND-of-/usr/ports/security/amavis-stats/distinfo
Xecho x - /usr/ports/security/amavis-stats/Makefile
Xsed 's/^X//' >/usr/ports/security/amavis-stats/Makefile << 'END-of-/usr/ports/security/amavis-stats/Makefile'
XX# New ports collection makefile for: amavis-stats
XX# Date created:        12 July 2004
XX# Whom:                Mantas Kaulakys <stone@tainet.lt>
XX#
XX# $FreeBSD$
XX#
XX
XXPORTNAME=     amavis-stats
XXPORTVERSION=  0.1.12
XXCATEGORIES=   security
XXMASTER_SITES= http://rekudos.net/download/
XX
XXMAINTAINER=   stone@tainet.lt
XXCOMMENT=      A simple AMaViS statistics generator based on rrdtool
XX
XXRUN_DEPENDS=  ${SITE_PERL}/mach/RRDs.pm:${PORTSDIR}/net/rrdtool
XX
XXUSE_PERL5_RUN=        yes
XXUSE_PHP=      yes
XXWANT_PHP_WEB= yes
XX
XXMAN1=           amavis-stats.1
XX
XXNO_BUILD=     yes
XX
XXPORTDOCS=     README
XX
XXWEBOWN?=      www
XXWEBGRP?=      www
XX
XXAMAVISUSER?=    amavis
XXAMAVISGROUP?=   amavis
XX
XXPKGINSTALL=   ${WRKDIR}/INSTALL
XXPKGDEINSTALL= ${WRKDIR}/DEINSTALL
XX
XXSED_SCRIPT=     -e 's,%%AMAVISUSER%%,${AMAVISUSER},g' \
XX              -e 's,%%AMAVISGROUP%%,${AMAVISGROUP},g'
XX
XX.include <bsd.port.pre.mk>
XX
XX.if ${PERL_LEVEL} < 500601
XXIGNORE="Need at least perl 5.6.1 to build"
XX.endif
XX
XXpre-install:
XX      for f in INSTALL; do \
XX      ${SED} ${SED_SCRIPT} < ${FILESDIR}/$${f}.tmpl > ${WRKDIR}/$${f}; \
XX      done
XX      @${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL
XX
XXdo-install:
XX      $(INSTALL) -m 755 ${WRKSRC}/amavis-stats ${LOCALBASE}/sbin
XX      ${INSTALL_MAN} ${WRKSRC}/amavis-stats.1 ${MAN1PREFIX}/man/man1
XX      ${MKDIR} ${LOCALBASE}/www/amavis-stats
XX      ${MKDIR} ${LOCALBASE}/www/amavis-stats/img
XX      ${INSTALL} -m 644 ${WRKSRC}/amavis-stats.php ${LOCALBASE}/www/amavis-stats
XX      cd ${LOCALBASE}/www/amavis-stats && ${LN} -s amavis-stats.php index.php
XX      ${CHOWN} -R ${AMAVISUSER}:${AMAVISGROUP} ${LOCALBASE}/www/amavis-stats
XX      ${CHOWN} ${WEBOWN}:${WEBGRP} ${LOCALBASE}/www/amavis-stats/img
XX
XX.if !defined(NOPORTDOCS)
XX      ${MKDIR} ${DOCSDIR}
XX      ${INSTALL_MAN} ${WRKSRC}/${PORTDOCS} ${DOCSDIR}
XX.endif
XX
XXpost-install:
XX      @${CAT} ${PKGMESSAGE}
XX
XXpost-deinstall:
XX      for f in DEINSTALL; do \
XX      ${SED} ${SED_SCRIPT} < ${FILESDIR}/$${f}.tmpl > ${WRKDIR}/$${f}; \
XX      done
XX      @${SH} ${PKGDEINSTALL} ${DISTNAME} POST-DEINSTALL
XX
XX.include <bsd.port.post.mk>
XEND-of-/usr/ports/security/amavis-stats/Makefile
Xecho x - /usr/ports/security/amavis-stats/aa.sh
Xsed 's/^X//' >/usr/ports/security/amavis-stats/aa.sh << 'END-of-/usr/ports/security/amavis-stats/aa.sh'
END-of-/usr/ports/security/amavis-stats/aa.sh
echo x - /usr/ports/security/amavis-stats/pkg-descr
sed 's/^X//' >/usr/ports/security/amavis-stats/pkg-descr << 'END-of-/usr/ports/security/amavis-stats/pkg-descr'
Xamavis-stats is a simple AMaViS statistics generator based on rrdtool.
XIt produces graphs of clean emails, spam emails and infected emails
Xbroken down by virus, from amavis log entries. RRD files are created
Xand updated by a perl script run from cron. Graphs are generated by
Xa php script and viewed with a web browser.
X
XWWW: http://rekudos.net/amavis-stats/
X
X- Mantas Kaulakys
Xstone@tainet.lt
END-of-/usr/ports/security/amavis-stats/pkg-descr
echo x - /usr/ports/security/amavis-stats/pkg-plist
sed 's/^X//' >/usr/ports/security/amavis-stats/pkg-plist << 'END-of-/usr/ports/security/amavis-stats/pkg-plist'
Xsbin/amavis-stats
Xwww/amavis-stats/index.php
Xwww/amavis-stats/amavis-stats.php
X@dirrm www/amavis-stats/img
X@dirrm www/amavis-stats
END-of-/usr/ports/security/amavis-stats/pkg-plist
echo c - /usr/ports/security/amavis-stats/files
mkdir -p /usr/ports/security/amavis-stats/files > /dev/null 2>&1
echo x - /usr/ports/security/amavis-stats/files/patch-amavis-stats
sed 's/^X//' >/usr/ports/security/amavis-stats/files/patch-amavis-stats << 'END-of-/usr/ports/security/amavis-stats/files/patch-amavis-stats'
X--- amavis-stats.orig  Sat Mar 27 17:25:27 2004
X+++ amavis-stats       Sun Jun  6 01:15:27 2004
X@@ -83,8 +83,8 @@
X $version   = "0.1.12"; # this value is auto-updated by packing system
X $pkg       = "amavis-stats";
X $locale    = "C";
X-$lockfile  = "/var/lock/$pkg";
X-$statedir  = "/var/lib/$pkg";
X+$lockfile  = "/var/tmp/$pkg";
X+$statedir  = "/usr/local/www/$pkg";
X $statefile = "$statedir/$pkg.state"; # last read position of the logfile
X $namesfile = "$statedir/$pkg.names"; # stores the virus name to id mappings
X $countfile = "$statedir/$pkg.count"; # per virus totals
END-of-/usr/ports/security/amavis-stats/files/patch-amavis-stats
echo x - /usr/ports/security/amavis-stats/files/patch-amavis-stats.php
sed 's/^X//' >/usr/ports/security/amavis-stats/files/patch-amavis-stats.php << 'END-of-/usr/ports/security/amavis-stats/files/patch-amavis-stats.php'
X--- amavis-stats.php.orig      Sat Mar 27 17:25:27 2004
X+++ amavis-stats.php   Sun Jun  6 01:21:35 2004
X@@ -286,7 +286,7 @@
X function asLoadStats () {
X     global $as_libdir, $virus, $pid, $psid, $iid, $bid,$nid,$nsid, $lastupdate, $maxi;
X
X-    $as_libdir    = "/var/lib/amavis-stats";
X+    $as_libdir    = "/usr/local/www/amavis-stats";
X     $as_statefile = $as_libdir . "/amavis-stats.state";
X     $as_namefile  = $as_libdir . "/amavis-stats.names";
X     $as_seenfile  = $as_libdir . "/amavis-stats.seen";
END-of-/usr/ports/security/amavis-stats/files/patch-amavis-stats.php
echo x - /usr/ports/security/amavis-stats/files/DEINSTALL.tmpl
sed 's/^X//' >/usr/ports/security/amavis-stats/files/DEINSTALL.tmpl << 'END-of-/usr/ports/security/amavis-stats/files/DEINSTALL.tmpl'
X#!/bin/sh
X
XUSER=%%AMAVISUSER%%
XGROUP=%%AMAVISGROUP%%
X
Xif [ "$2" = "POST-DEINSTALL" ]; then
X
X    if /usr/sbin/pw group show "${GROUP}" 2>&1 >/dev/null; then
X       echo "You should manually remove the \"${GROUP}\" group."
X    fi
X
X    if /usr/sbin/pw user show "${USER}" 2>&1 >/dev/null; then
X       echo "You should manually remove the \"${USER}\" user."
X    fi
X
Xfi
END-of-/usr/ports/security/amavis-stats/files/DEINSTALL.tmpl
echo x - /usr/ports/security/amavis-stats/files/INSTALL.tmpl
sed 's/^X//' >/usr/ports/security/amavis-stats/files/INSTALL.tmpl << 'END-of-/usr/ports/security/amavis-stats/files/INSTALL.tmpl'
X#!/bin/sh
X
XUSER=%%AMAVISUSER%%
XGROUP=%%AMAVISGROUP%%
X
Xif [ "$2" = "PRE-INSTALL" ]; then
X
X    if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then
X       echo "You already have a group \"${GROUP}\", so I will use it."
X    else
X       if /usr/sbin/pw groupadd ${GROUP} -h -
X       then
X           echo "Added group \"${GROUP}\"."
X       else
X           echo "Adding group \"${GROUP}\" failed..."
X           echo "Please create it, and try again."
X           exit 1
X       fi
X    fi
X
X    if /usr/sbin/pw user show "${USER}" 2>/dev/null; then
X       echo "You already have a user \"${USER}\", so I will use it."
X    else
X       if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \
X          -d /nonexistent \
X          -s /sbin/nologin \
X          -c "Amavis-stats Account"
X       then
X           echo "Added user \"${USER}\"."
X       else
X           echo "Adding user \"${USER}\" failed..."
X           echo "Please create it, and try again."
X           exit 1
X       fi
X    fi
X
Xfi
END-of-/usr/ports/security/amavis-stats/files/INSTALL.tmpl
echo x - /usr/ports/security/amavis-stats/pkg-message
sed 's/^X//' >/usr/ports/security/amavis-stats/pkg-message << 'END-of-/usr/ports/security/amavis-stats/pkg-message'
X
X-----
X
XTo view the statistics via you browser you must:
Xcreate a symlink, like:
Xcd /usr/local/www/data ; ln -s amavis-stats ../amavis-stats
X
Xor modify your Apache httpd.conf including this line:
XAlias /amavis-stats /usr/local/www/amavis-stats
X
XTo update the statistics every 5 minutes, you also
Xcan setup cronjob for amavis-stats by putting this line to /etc/crontab
X*/5 * * * * amavis /usr/local/sbin/amavis-stats /var/log/maillog 2>&1 > /dev/null
X
X-----
X
END-of-/usr/ports/security/amavis-stats/pkg-message
exit
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040711231309.E29313EA>