Import SQLgrey, a Postfix greylisting policy daemon

Some help from kili@

SQLgrey is a Postfix greylisting policy service with 
auto-white-listing with SQL database as storage backend.
It has many features including ipv6 support, activity
reports, fine log controls.

SQLgrey uses the Sqlite database by default, but it can also use
MySQL or Postgresql.
This commit is contained in:
giovanni 2009-11-16 10:43:55 +00:00
parent 51c279856e
commit 62dc7a520a
7 changed files with 202 additions and 0 deletions

32
mail/sqlgrey/Makefile Normal file
View File

@ -0,0 +1,32 @@
# $OpenBSD: Makefile,v 1.1.1.1 2009/11/16 10:43:55 giovanni Exp $
COMMENT = postfix greylist daemon
DISTNAME = sqlgrey-1.7.6
CATEGORIES = mail
HOMEPAGE = http://sqlgrey.sf.net/
MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=sqlgrey/}
MAINTAINER = Giovanni Bechis <giovanni@openbsd.org>
# GPLv2
PERMIT_PACKAGE_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_CDROM =Yes
PERMIT_DISTFILES_FTP = Yes
PKG_ARCH = *
EXTRACT_SUFX = .tar.bz2
NO_BUILD = Yes
NO_REGRESS = Yes
RUN_DEPENDS = ::devel/p5-Net-Server \
::devel/p5-IO-Multiplex \
::devel/p5-Date-Calc \
::net/wget \
:p5-DBD-SQLite-*|p5-DBD-mysql-*|p5-DBD-Pg-*:databases/p5-DBD-SQLite
.include <bsd.port.mk>

5
mail/sqlgrey/distinfo Normal file
View File

@ -0,0 +1,5 @@
MD5 (sqlgrey-1.7.6.tar.bz2) = Hn5ePtXwKyn3HvTibtwcNg==
RMD160 (sqlgrey-1.7.6.tar.bz2) = HppG5CqImflCZoTdvKAc+1zJuWo=
SHA1 (sqlgrey-1.7.6.tar.bz2) = 7PLSMbnx585ldu2VuH2TnacifSE=
SHA256 (sqlgrey-1.7.6.tar.bz2) = SPbIVeGNOsPRmgwuzSUDlKNV0BFqzWMRh7iAy4E2RtE=
SIZE (sqlgrey-1.7.6.tar.bz2) = 63738

View File

@ -0,0 +1,55 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2009/11/16 10:43:55 giovanni Exp $
--- Makefile.orig Sun Oct 22 17:05:57 2006
+++ Makefile Tue Nov 10 18:26:14 2009
@@ -1,10 +1,10 @@
INSTALL = install
-ETCDIR = $(ROOTDIR)/etc
-CONFDIR = $(ETCDIR)/sqlgrey
-SBINDIR = $(ROOTDIR)/usr/sbin
-BINDIR = $(ROOTDIR)/usr/bin
-INITDIR = $(ETCDIR)/init.d
-MANDIR = $(ROOTDIR)/usr/share/man/man1
+ETCDIR = ${PREFIX}/share/sqlgrey
+DOCDIR = ${PREFIX}/share/doc/sqlgrey
+CONFDIR = ${PREFIX}/share/examples/sqlgrey
+SBINDIR = ${PREFIX}/sbin
+BINDIR = ${PREFIX}/bin
+MANDIR = ${PREFIX}/man/man1
VERSION := $(shell cat VERSION)
TBZ2 = sqlgrey-$(VERSION).tar.bz2
@@ -38,6 +38,7 @@ use_dbi:
manpage:
perldoc -u sqlgrey | pod2man -n sqlgrey > sqlgrey.1
+ perldoc -u sqlgrey-logstats.pl | pod2man -n sqlgrey-logstats > sqlgrey-logstats.1
clean:
rm -f sqlgrey.1
@@ -45,22 +46,24 @@ clean:
install: all
$(INSTALL) -d -m 755 $(SBINDIR)
- $(INSTALL) -d -m 755 $(ETCDIR)
+ $(INSTALL) -d -m 755 $(DOCDIR)
$(INSTALL) -d -m 755 $(CONFDIR)
$(INSTALL) -d -m 755 $(INITDIR)
$(INSTALL) -d -m 755 $(MANDIR)
$(INSTALL) -d -m 755 $(BINDIR)
$(INSTALL) -m 755 sqlgrey $(SBINDIR)
$(INSTALL) -m 755 update_sqlgrey_config $(SBINDIR)
- $(INSTALL) -m 755 sqlgrey-logstats.pl $(BINDIR)
+ $(INSTALL) -m 755 sqlgrey-logstats.pl $(BINDIR)/sqlgrey-logstats
$(INSTALL) -m 644 etc/sqlgrey.conf $(CONFDIR)
$(INSTALL) -m 644 etc/clients_ip_whitelist $(CONFDIR)
$(INSTALL) -m 644 etc/clients_fqdn_whitelist $(CONFDIR)
$(INSTALL) -m 644 etc/discrimination.regexp $(CONFDIR)
$(INSTALL) -m 644 etc/dyn_fqdn.regexp $(CONFDIR)
$(INSTALL) -m 644 etc/smtp_server.regexp $(CONFDIR)
+ $(INSTALL) -m 644 HOWTO $(DOCDIR)
$(INSTALL) -m 644 etc/README $(CONFDIR)
$(INSTALL) -m 644 sqlgrey.1 $(MANDIR)
+ $(INSTALL) -m 644 sqlgrey-logstats.1 $(MANDIR)
rh-install: install
$(INSTALL) init/sqlgrey $(INITDIR)

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-etc_sqlgrey_conf,v 1.1.1.1 2009/11/16 10:43:55 giovanni Exp $
--- etc/sqlgrey.conf.orig Tue Jun 3 09:35:19 2008
+++ etc/sqlgrey.conf Tue Jun 3 09:35:32 2008
@@ -59,8 +59,8 @@
# log_ident =
## username and groupname the daemon runs as
-# user = sqlgrey
-# group = sqlgrey
+user = _sqlgrey
+group = _sqlgrey
## Socket
# On which socket do SQLgrey wait for queries

View File

@ -0,0 +1,63 @@
$OpenBSD: patch-update_sqlgrey_config,v 1.1.1.1 2009/11/16 10:43:55 giovanni Exp $
--- update_sqlgrey_config.orig Wed Mar 2 01:49:41 2005
+++ update_sqlgrey_config Thu Jun 5 19:03:17 2008
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
# We need md5sum, diff and wget
-MD5SUM=`which md5sum 2>/dev/null`
+MD5SUM=`which md5 2>/dev/null`
if [ $? -ne 0 ]
then
- echo "md5sum not found in PATH, can't continue"
+ echo "md5 not found in PATH, can't continue"
exit -1
fi
DIFF=`which diff 2>/dev/null`
@@ -33,11 +33,6 @@ if [ -z "$whitelists_host" ]
then
whitelists_host="sqlgrey.bouton.name"
fi
-pidfile=`grep "^[[:space:]]*pidfile" $CONF | cut -d= -f2 | awk '{print $1}'`
-if [ -z "$pidfile" ]
-then
- pidfile="/var/run/sqlgrey.pid"
-fi
# Go into a temp directory
MYTMP=`mktemp -d ${TMPDIR:-/tmp}/sqlgrey.XXXXXX`
@@ -48,7 +43,6 @@ MYTMP=`mktemp -d ${TMPDIR:-/tmp}/sqlgrey.XXXXXX`
# Setup a clean exit
clean_exit() {
- cd ~sqlgrey
[ -n "$MYTMP" -a -d "$MYTMP" ] && rm -rf $MYTMP
exit $1
}
@@ -59,7 +53,7 @@ $WGET -q http://$whitelists_host/MD5SUMS
# Check installed files
cd $MYDIR
-TOUPDATE=`md5sum -c $MYTMP/MD5SUMS 2>/dev/null | grep FAILED | cut -d: -f1`
+TOUPDATE=`md5 -c $MYTMP/MD5SUMS 2>/dev/null | grep FAILED | cut -d: -f1 | awk '{print $2;}'`
if [ -z "$TOUPDATE" ]
then
@@ -85,7 +79,7 @@ do
fi
done
-md5sum -c MD5SUMS >/dev/null 2>/dev/null
+md5 -c MD5SUMS >/dev/null 2>/dev/null
if [ $? -ne 0 ]
then
# Can only happen if remote site is borked or file got corrupt in transit
@@ -99,6 +93,6 @@ rm MD5SUMS
mv * $MYDIR
# Reload whitelists
-kill -USR1 `cat $pidfile`
+pkill -USR1 sqlgrey
clean_exit 0

7
mail/sqlgrey/pkg/DESCR Normal file
View File

@ -0,0 +1,7 @@
SQLgrey is a Postfix greylisting policy service with
auto-white-listing with SQL database as storage backend.
It has many features including ipv6 support, activity
reports, fine log controls.
SQLgrey uses the Sqlite database by default, but it can also use
MySQL or Postgresql.

26
mail/sqlgrey/pkg/PLIST Normal file
View File

@ -0,0 +1,26 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2009/11/16 10:43:55 giovanni Exp $
@newgroup _sqlgrey:647
@newuser _sqlgrey:647:_sqlgrey:daemon:SQLgrey Account:/nonexistent:/sbin/nologin
bin/sqlgrey-logstats
@man man/man1/sqlgrey-logstats.1
@man man/man1/sqlgrey.1
sbin/sqlgrey
sbin/update_sqlgrey_config
share/doc/sqlgrey/
share/doc/sqlgrey/HOWTO
share/examples/sqlgrey/
@sample ${SYSCONFDIR}/sqlgrey/
share/examples/sqlgrey/README
@sample ${SYSCONFDIR}/sqlgrey/README
share/examples/sqlgrey/clients_fqdn_whitelist
@sample ${SYSCONFDIR}/sqlgrey/clients_fqdn_whitelist
share/examples/sqlgrey/clients_ip_whitelist
@sample ${SYSCONFDIR}/sqlgrey/clients_ip_whitelist
share/examples/sqlgrey/discrimination.regexp
@sample ${SYSCONFDIR}/sqlgrey/discrimination.regexp
share/examples/sqlgrey/dyn_fqdn.regexp
@sample ${SYSCONFDIR}/sqlgrey/dyn_fqdn.regexp
share/examples/sqlgrey/smtp_server.regexp
@sample ${SYSCONFDIR}/sqlgrey/smtp_server.regexp
share/examples/sqlgrey/sqlgrey.conf
@sample ${SYSCONFDIR}/sqlgrey/sqlgrey.conf