Kaynağa Gözat

new package: postgrey 1.2 (Postfix Greylisting Daemon)

Ralf S. Engelschall 21 yıl önce
ebeveyn
işleme
1547621ebc
3 değiştirilmiş dosya ile 222 ekleme ve 0 silme
  1. 34 0
      postgrey/postgrey.patch
  2. 123 0
      postgrey/postgrey.spec
  3. 65 0
      postgrey/rc.postgrey

+ 34 - 0
postgrey/postgrey.patch

@@ -0,0 +1,34 @@
+Index: postgrey
+--- postgrey.orig	2004-05-21 18:14:04.000000000 +0200
++++ postgrey	2004-05-21 21:16:29.000000000 +0200
+@@ -105,7 +105,7 @@
+     # parse options
+     my %opt = ();
+     GetOptions(\%opt, 'help|h', 'man', 'version', 'noaction|no-action|n',
+-        'verbose|v', 'daemonize|d', 'unix|u=s', 'inet|i=s', 'user=s', 'dbdir=s',
++        'verbose|v', 'daemonize|d', 'unix|u=s', 'inet|i=s', 'user=s', 'dbdir=s', 'pidfile=s',
+         'delay=i', 'max-age=i') or exit(1);
+     if($opt{help})     { pod2usage(1) }
+     if($opt{man})      { pod2usage(-exitstatus => 0, -verbose => 2) }
+@@ -125,11 +125,12 @@
+         server => {
+             commandline     => [ $0, @ARGV_saved ],
+             delay           => $opt{delay} || 600,
+-            port            => [ $opt{inet} ? $opt{inet} : $opt{unix} ],
++            port            => [ $opt{inet} ? $opt{inet} : $opt{unix}."|unix" ],
+             proto           => $opt{inet} ? 'tcp' : 'unix',
+             user            => $opt{user} || 'postgrey',
+             dbdir           => $opt{dbdir} || '/var/spool/postfix/postgrey',
+             setsid          => $opt{daemonize} ? 1 : undef,
++            pid_file        => $opt{daemonize} ? $opt{pidfile} : undef,
+             log_level       => $opt{verbose} ? 4 : 2,
+             log_file        => $opt{daemonize} ? 'Sys::Syslog' : undef,
+             syslog_facility => 'mail',
+@@ -245,6 +246,7 @@
+  -u, --unix=PATH        listen on unix socket PATH
+  -i, --inet=[HOST:]PORT listen on PORT, localhost if HOST is not specified
+  -d, --daemonize        run in the background
++     --pidfile=PATH     put daemon pid into this file
+      --user=USER        run as USER (default: postgrey)
+      --dbdir=PATH       put db files in PATH (default: /var/spool/postfix/postgrey)
+      --delay=N          greylist for N seconds (default: 600)

+ 123 - 0
postgrey/postgrey.spec

@@ -0,0 +1,123 @@
+##
+##  postgrey.spec -- OpenPKG RPM Specification
+##  Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
+##  Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
+##
+##  Permission to use, copy, modify, and distribute this software for
+##  any purpose with or without fee is hereby granted, provided that
+##  the above copyright notice and this permission notice appear in all
+##  copies.
+##
+##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+##  SUCH DAMAGE.
+##
+
+#   package information
+Name:         postgrey
+Summary:      Postfix Greylisting Daemon
+URL:          http://isg.ee.ethz.ch/tools/postgrey/
+Vendor:       David Schweikert
+Packager:     The OpenPKG Project
+Distribution: OpenPKG
+Class:        EVAL
+Group:        Mail
+License:      GPL
+Version:      1.2
+Release:      20040521
+
+#   list of sources
+Source0:      http://isg.ee.ethz.ch/tools/postgrey/pub/postgrey-%{version}.tar.gz
+Source1:      rc.postgrey
+Patch0:       postgrey.patch
+
+#   build information
+Prefix:       %{l_prefix}
+BuildRoot:    %{l_buildroot}
+BuildPreReq:  OpenPKG, openpkg >= 20040130
+PreReq:       OpenPKG, openpkg >= 20040130
+BuildPreReq:  perl
+PreReq:       perl, perl-sys, perl-net, perl-db
+AutoReq:      no
+AutoReqProv:  no
+
+%description
+    Postgrey is a Postfix MTA policy server implementing Greylisting.
+    Greylisting is related to Whitelisting and Blacklisting. What
+    happen is that each time a given mailbox receives an email from
+    an unknown contact (ip), that mail is rejected with a "try again
+    later"-message. This, in the short run, means that all mail gets
+    delayed atleast until the sender tries again - but this is where
+    spam looses out! Most spam is not sent out using RFC compliant MTAs;
+    the spamming software will not try again later.
+
+%track
+    prog postgrey = {
+        version   = %{version}
+        url       = http://isg.ee.ethz.ch/tools/postgrey/pub/
+        regex     = postgrey-(__VER__)\.tar\.gz
+    }
+
+%prep
+    %setup -q
+    %patch -p0
+
+%build
+    #   build manual page
+    pod2man postgrey >postgrey.8
+
+    #   build empty recipient list
+    echo "" >postgrey_recipient_access
+
+%install
+    #   create installation hierarchy
+    rm -rf $RPM_BUILD_ROOT
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin \
+        $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/postgrey \
+        $RPM_BUILD_ROOT%{l_prefix}/var/postgrey
+
+    #   install program and manual page
+    %{l_shtool} install -c -m 755 \
+        -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
+        postgrey $RPM_BUILD_ROOT%{l_prefix}/sbin/
+    %{l_shtool} install -c -m 644 \
+        postgrey.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
+
+    #   install configuration files
+    %{l_shtool} install -c -m 644 \
+        postgrey_client_access \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/postgrey/
+    %{l_shtool} install -c -m 644 \
+        postgrey_recipient_access \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/postgrey/
+
+    #   install run-command script
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE rc.postgrey} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+    #   determine installation files
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
+        %{l_files_std} \
+        '%config %{l_prefix}/etc/postgrey/*' \
+        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/postgrey'
+
+%files -f files
+
+%clean
+    rm -rf $RPM_BUILD_ROOT
+

+ 65 - 0
postgrey/rc.postgrey

@@ -0,0 +1,65 @@
+#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+##  rc.postgrey -- Run-Commands
+##
+
+%config
+    postgrey_enable="$openpkg_rc_def"
+    postgrey_delay="600"
+    postgrey_maxage="14"
+    postgrey_log_prolog="true"
+    postgrey_log_epilog="true"
+    postgrey_log_numfiles="10"
+    postgrey_log_minsize="1M"
+    postgrey_log_complevel="9"
+
+%common
+    postgrey_logfile="@l_prefix@/var/postgrey/postgrey.pid"
+    postgrey_pidfile="@l_prefix@/var/postgrey/postgrey.pid"
+    postgrey_socket="@l_prefix@/var/postgrey/postgrey.socket"
+    postgrey_dbdir="@l_prefix@/var/postgrey"
+    postgrey_signal () {
+        [ -f $postgrey_pidfile ] && kill -$1 `cat $postgrey_pidfile`
+    }
+
+%status -u @l_rusr@ -o
+    postgrey_usable="unknown"
+    postgrey_active="no"
+    echo "postgrey_enable=\"$postgrey_enable\""
+    echo "postgrey_usable=\"$postgrey_usable\""
+    echo "postgrey_active=\"$postgrey_active\""
+
+%start -u @l_susr@
+    rcService postgrey enable yes || exit 0
+    rcService postgrey active yes && exit 0
+    @l_prefix@/sbin/postgrey \
+        --daemonize \
+        --user=@l_rusr@ \
+        --pidfile=$postgrey_pidfile \
+        --unix=$postgrey_socket \
+        --dbdir=$postgrey_dbdir \
+        --delay=$postgrey_delay \
+        --max-age=$postgrey_maxage
+
+%stop -u @l_susr@
+    rcService postgrey enable yes || exit 0
+    rcService postgrey active no && exit 0
+    postgrey_signal TERM
+    rm -f $postgrey_pidfile 2>/dev/null || true
+
+%restart -u @l_susr@
+    rcService postgrey enable yes || exit 0
+    rcService postgrey active no && exit 0
+    rc postgrey stop
+    sleep 2
+    rc postgrey start
+
+%daily -u @l_susr@
+    rcService postgrey enable yes || exit 0
+    shtool rotate -f \
+        -n ${postgrey_log_numfiles} -s ${postgrey_log_minsize} -d \
+        -z ${postgrey_log_complevel} -o @l_rusr@ -g @l_mgrp@ -m 644 \
+        -P "${postgrey_log_prolog}" \
+        -E "${postgrey_log_epilog} && rc postgrey restart" \
+        $postgrey_logfile
+