From ad2b8c72fa480c0fc321a6fa06b4b6db046152cd Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 1 Apr 2014 21:14:39 +0000 Subject: [PATCH] Bring back from the dead; take ownership Distfile is hosted in my public_distfiles --- security/Makefile | 1 + security/amavis-stats/Makefile | 53 ++++++++++++ security/amavis-stats/distinfo | 2 + .../amavis-stats/files/patch-amavis-stats | 86 +++++++++++++++++++ .../amavis-stats/files/patch-amavis-stats.php | 11 +++ security/amavis-stats/files/pkg-message.in | 16 ++++ security/amavis-stats/pkg-descr | 7 ++ security/amavis-stats/pkg-plist | 9 ++ 8 files changed, 185 insertions(+) create mode 100644 security/amavis-stats/Makefile create mode 100644 security/amavis-stats/distinfo create mode 100644 security/amavis-stats/files/patch-amavis-stats create mode 100644 security/amavis-stats/files/patch-amavis-stats.php create mode 100644 security/amavis-stats/files/pkg-message.in create mode 100644 security/amavis-stats/pkg-descr create mode 100644 security/amavis-stats/pkg-plist diff --git a/security/Makefile b/security/Makefile index 2a28a03dcf9e..e7d8de801b1f 100644 --- a/security/Makefile +++ b/security/Makefile @@ -13,6 +13,7 @@ SUBDIR += aide SUBDIR += aimsniff SUBDIR += amap + SUBDIR += amavis-stats SUBDIR += amavisd-milter SUBDIR += amavisd-new SUBDIR += aolserver-nsencrypt diff --git a/security/amavis-stats/Makefile b/security/amavis-stats/Makefile new file mode 100644 index 000000000000..8671a33ba9cb --- /dev/null +++ b/security/amavis-stats/Makefile @@ -0,0 +1,53 @@ +# Created by: Mantas Kaulakys +# $FreeBSD$ + +PORTNAME= amavis-stats +PORTVERSION= 0.1.12 +PORTREVISION= 3 +CATEGORIES= security +MASTER_SITES= LOCAL +MASTER_SITE_SUBDIR= feld + +MAINTAINER= feld@FreeBSD.org +COMMENT= Simple AMaViS statistics generator based on rrdtool + +RUN_DEPENDS= rrdtool>=0:${PORTSDIR}/databases/rrdtool + +USES= perl5 +USE_PERL5= run +USE_PHP= pcre + +NO_BUILD= yes + +PORTDOCS= README + +AMAVISUSER?= amavis +AMAVISGROUP?= amavis +USERS= ${AMAVISUSER} +GROUPS= ${AMAVISGROUP} +PLIST_SUB+= WWWOWN=${WWWOWN} WWWGRP=${WWWGRP} USERS=${USERS} GROUPS=${GROUPS} + +PKGMESSAGE= ${WRKDIR}/pkg-message + +SUB_FILES= pkg-message + +.include + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/amavis-stats ${STAGEDIR}${PREFIX}/sbin + ${INSTALL_DATA} ${WRKSRC}/amavis-stats.1 ${STAGEDIR}${MAN1PREFIX}/man/man1 + ${MKDIR} ${STAGEDIR}${PREFIX}/www/amavis-stats + ${MKDIR} ${STAGEDIR}${PREFIX}/www/amavis-stats/img + ${TOUCH} ${STAGEDIR}${PREFIX}/www/amavis-stats/img/.keep + ${INSTALL_DATA} ${WRKSRC}/amavis-stats.php ${STAGEDIR}${PREFIX}/www/amavis-stats + cd ${STAGEDIR}${PREFIX}/www/amavis-stats && ${LN} -s amavis-stats.php index.php + +.if ${PORT_OPTIONS:MDOCS} + ${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/${PORTDOCS} ${STAGEDIR}${DOCSDIR} +.endif + +post-install: + @${CAT} ${PKGMESSAGE} + +.include diff --git a/security/amavis-stats/distinfo b/security/amavis-stats/distinfo new file mode 100644 index 000000000000..dadd9f459cc4 --- /dev/null +++ b/security/amavis-stats/distinfo @@ -0,0 +1,2 @@ +SHA256 (amavis-stats-0.1.12.tar.gz) = 0c802f43a0107cd094c422c9771133bef6d4a2b36e5676ed7d02f2e91787be1b +SIZE (amavis-stats-0.1.12.tar.gz) = 60626 diff --git a/security/amavis-stats/files/patch-amavis-stats b/security/amavis-stats/files/patch-amavis-stats new file mode 100644 index 000000000000..486550ad55ff --- /dev/null +++ b/security/amavis-stats/files/patch-amavis-stats @@ -0,0 +1,86 @@ +--- amavis-stats.orig Sat Mar 27 23:25:27 2004 ++++ amavis-stats Mon Jul 10 22:55:19 2006 +@@ -1,4 +1,4 @@ +-#! /usr/bin/perl ++#!/usr/bin/perl -w + # + # amavis-stats -- generate rrds from amavis log output + # +@@ -28,6 +28,7 @@ + # ######################################################################## + use strict; + use warnings; ++use diagnostics; + use Getopt::Std; + use Time::localtime; + use Time::Local; +@@ -83,8 +84,8 @@ + $version = "0.1.12"; # this value is auto-updated by packing system + $pkg = "amavis-stats"; + $locale = "C"; +-$lockfile = "/var/lock/$pkg"; +-$statedir = "/var/lib/$pkg"; ++$lockfile = "/var/tmp/$pkg"; ++$statedir = "/usr/local/www/$pkg"; + $statefile = "$statedir/$pkg.state"; # last read position of the logfile + $namesfile = "$statedir/$pkg.names"; # stores the virus name to id mappings + $countfile = "$statedir/$pkg.count"; # per virus totals +@@ -212,7 +213,7 @@ + sub semlock { + open (LOCKF, ">$lockfile") or do_exit(1, "Could not open $lockfile: $!"); + unless (flock(LOCKF, LOCK_EX | LOCK_NB)) { +- err("warning: Could not lock $lockfile: $!"); ++ print_err("warning: Could not lock $lockfile: $!"); + sleep 2; + unless (flock(LOCKF, LOCK_EX | LOCK_NB)) { + do_exit(1, "Could not lock $lockfile: $!"); +@@ -680,8 +681,8 @@ + if (defined($rotlogfile)) { + parseFile ($rotlogfile, $spos, (stat $rotlogfile)[7]); + } else { +- err("Could not open rotated logfile."); +- err(" Tried extentions .0, .1, .01, -$today, -$yesterday"); ++ print_err("Could not open rotated logfile."); ++ print_err(" Tried extentions .0, .1, .01, -$today, -$yesterday"); + do_exit(1); + } + } +@@ -707,7 +708,7 @@ + + my $err = RRDs::error; + if ($err) { +- err("createRRD: $err"); ++ print_err("createRRD: $err"); + return -1; + } + +@@ -736,7 +737,7 @@ + $last = RRDs::last($rrdfile); + $err = RRDs::error; + if ($err) { +- err("updateRRD: $err"); ++ print_err("updateRRD: $err"); + return -1; + } + +@@ -750,8 +751,8 @@ + + $err = RRDs::error; + if ($err) { +- err("updateRRD: $err"); +- err("Attempted to update $rrdfile at $epoch count $count"); ++ print_err("updateRRD: $err"); ++ print_err("Attempted to update $rrdfile at $epoch count $count"); + return -1; + } + } +@@ -769,7 +770,8 @@ + print "$me: @_\n" if ($verbose); + } + +-sub err { ++sub print_err ++{ + print STDERR "$me: error: @_\n"; + } + diff --git a/security/amavis-stats/files/patch-amavis-stats.php b/security/amavis-stats/files/patch-amavis-stats.php new file mode 100644 index 000000000000..52386d7b543f --- /dev/null +++ b/security/amavis-stats/files/patch-amavis-stats.php @@ -0,0 +1,11 @@ +--- amavis-stats.php.orig Sat Mar 27 17:25:27 2004 ++++ amavis-stats.php Sun Jun 6 01:21:35 2004 +@@ -286,7 +286,7 @@ + function asLoadStats () { + global $as_libdir, $virus, $pid, $psid, $iid, $bid,$nid,$nsid, $lastupdate, $maxi; + +- $as_libdir = "/var/lib/amavis-stats"; ++ $as_libdir = "/usr/local/www/amavis-stats"; + $as_statefile = $as_libdir . "/amavis-stats.state"; + $as_namefile = $as_libdir . "/amavis-stats.names"; + $as_seenfile = $as_libdir . "/amavis-stats.seen"; diff --git a/security/amavis-stats/files/pkg-message.in b/security/amavis-stats/files/pkg-message.in new file mode 100644 index 000000000000..f1872470d97b --- /dev/null +++ b/security/amavis-stats/files/pkg-message.in @@ -0,0 +1,16 @@ +----- + +To view the statistics via you browser you must: +create a symlink, like: +cd /usr/local/www/data ; ln -s ../amavis-stats amavis-stats + +or modify your Apache httpd.conf including this line: +Alias /amavis-stats %%PREFIX%%/www/amavis-stats + +You can view then the statistics in http://your-site/amavis-stats + +To update the statistics every 5 minutes, you also +can setup cronjob for amavis-stats by putting this line to /etc/crontab +*/5 * * * * amavis %%PREFIX%%/sbin/amavis-stats /var/log/maillog 2>&1 > /dev/null + +----- diff --git a/security/amavis-stats/pkg-descr b/security/amavis-stats/pkg-descr new file mode 100644 index 000000000000..a314d6498cd4 --- /dev/null +++ b/security/amavis-stats/pkg-descr @@ -0,0 +1,7 @@ +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/ diff --git a/security/amavis-stats/pkg-plist b/security/amavis-stats/pkg-plist new file mode 100644 index 000000000000..64fa82681403 --- /dev/null +++ b/security/amavis-stats/pkg-plist @@ -0,0 +1,9 @@ +man/man1/amavis-stats.1.gz +sbin/amavis-stats +www/amavis-stats/index.php +www/amavis-stats/amavis-stats.php +www/amavis-stats/img/.keep +@dirrm www/amavis-stats/img +@dirrm www/amavis-stats +@exec /usr/sbin/chown -R %%USERS%%:%%GROUPS%% %D/www/amavis-stats +@exec /usr/sbin/chown %%WWWOWN%%:%%WWWGRP%% %D/www/amavis-stats/img