Hello community, here is the log from the commit of package postgrey for openSUSE:Factory checked in at 2016-01-07 00:24:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/postgrey (Old) and /work/SRC/openSUSE:Factory/.postgrey.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "postgrey" Changes: -------- --- /work/SRC/openSUSE:Factory/postgrey/postgrey.changes 2015-06-23 12:00:51.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.postgrey.new/postgrey.changes 2016-01-07 00:24:48.000000000 +0100 @@ -1,0 +2,13 @@ +Mon Dec 14 15:24:07 UTC 2016 - benedikt.schindler@gsx.de + +- update to 1.36: + - improved support for IPv6 addresses: new --ipv4cidr and --ipv6cidr options + for proper subnetting of IPv6 (Håvard Moen, BenediktS) + - updated whitelist + - user-settable unix socket permission: --socketmode (Teubel György) + - init script fixes (Sacha Ott) +- Replace postgrey-1.35-config.patch with postgrey-1.36-config.patch + which was updated to correctly apply to current release +- Added missing perl-NetAddr-IP to the requirements + +------------------------------------------------------------------- Old: ---- postgrey-1.35-config.patch postgrey-1.35.tar.gz New: ---- postgrey-1.36-config.patch postgrey-1.36.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ postgrey.spec ++++++ --- /var/tmp/diff_new_pack.u0DHbp/_old 2016-01-07 00:24:50.000000000 +0100 +++ /var/tmp/diff_new_pack.u0DHbp/_new 2016-01-07 00:24:50.000000000 +0100 @@ -17,7 +17,7 @@ Name: postgrey -Version: 1.35 +Version: 1.36 Release: 0 Summary: Postfix greylisting policy server License: GPL-2.0+ @@ -34,7 +34,7 @@ # PATCH-FIX-OPENSUSE -- Adapt default config and documentation to pathnames for openSUSE # /etc/postfix => /etc/postgrey # /var/spool/postfix/postgrey => /var/lib/postgrey -Patch0: %{name}-1.35-config.patch +Patch0: %{name}-1.36-config.patch # PATCH-FIX-OPENSUSE -- run postgrey under the same groupid as postfix: postfix Patch1: %{name}-groupid.patch # PATCH-FIX-OPENSUSE -- patch SOURCE5 to run under openSUSE @@ -45,6 +45,7 @@ Requires: perl-IO-Multiplex Requires: perl-Net-DNS Requires: perl-Net-Server +Requires: perl-NetAddr-IP BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch Suggests: cron ++++++ postgrey-1.35-config.patch -> postgrey-1.36-config.patch ++++++ --- /work/SRC/openSUSE:Factory/postgrey/postgrey-1.35-config.patch 2015-01-29 09:56:15.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.postgrey.new/postgrey-1.36-config.patch 2016-01-07 00:24:48.000000000 +0100 @@ -2,7 +2,7 @@ =================================================================== --- README.orig +++ README -@@ -20,7 +20,7 @@ Documentation +@@ -21,7 +21,7 @@ Documentation See POD documentation in postgrey. Execute: @@ -37,10 +37,10 @@ =================================================================== --- postgrey.orig +++ postgrey -@@ -23,8 +23,8 @@ use vars qw(@ISA); +@@ -24,8 +24,8 @@ use vars qw(@ISA); @ISA = qw(Net::Server::Multiplex); - my $VERSION = '1.35'; + my $VERSION = '1.36'; -my $DEFAULT_DBDIR = '/var/spool/postfix/postgrey'; -my $CONFIG_DIR = '/etc/postfix'; +my $DEFAULT_DBDIR = '/var/lib/postgrey'; @@ -48,7 +48,7 @@ sub cidr_parse($) { -@@ -610,10 +610,10 @@ sub main() +@@ -644,10 +644,10 @@ sub main() greylist_action => $opt{'greylist-action'} || 'DEFER_IF_PERMIT', greylist_text => $opt{'greylist-text'} || 'Greylisted, see http://postgrey.schweikert.ch/help/%r.html', whitelist_clients_files => $opt{'whitelist-clients'} || @@ -62,7 +62,7 @@ privacy => defined $opt{'privacy'}, hostname => defined $opt{hostname} ? $opt{hostname} : hostname, exim => defined $opt{'exim'}, -@@ -796,7 +796,7 @@ B<postgrey> [I<options>...] +@@ -831,7 +831,7 @@ B<postgrey> [I<options>...] --pidfile=PATH put daemon pid into this file --user=USER run as USER (default: postgrey) --group=GROUP run as group GROUP (default: nogroup) @@ -71,18 +71,18 @@ --delay=N greylist for N seconds (default: 300) --max-age=N delete entries older than N days since the last time that they have been seen (default: 35) -@@ -810,8 +810,8 @@ B<postgrey> [I<options>...] +@@ -847,8 +847,8 @@ B<postgrey> [I<options>...] --privacy store data using one-way hash functions --hostname=NAME set the hostname (default: `hostname`) --exim don't reuse a socket for more than one query (exim compatible) - --whitelist-clients=FILE default: /etc/postfix/postgrey_whitelist_clients - --whitelist-recipients=FILE default: /etc/postfix/postgrey_whitelist_recipients -+ --whitelist-clients=FILE default: /etc/posgrey/whitelist_clients ++ --whitelist-clients=FILE default: /etc/postgrey/whitelist_clients + --whitelist-recipients=FILE default: /etc/postgrey/whitelist_recipients --auto-whitelist-clients=N whitelist host after first successful delivery N is the minimal count of mails before a client is whitelisted (turned on by default with value 5) -@@ -821,7 +821,7 @@ B<postgrey> [I<options>...] +@@ -858,7 +858,7 @@ B<postgrey> [I<options>...] default: X-Greylist: delayed <seconds> seconds by postgrey-<version> at <server>; <date> Note that the --whitelist-x options can be specified multiple times, @@ -91,7 +91,7 @@ also read, so that you can put there local entries. =head1 DESCRIPTION -@@ -848,7 +848,7 @@ doing lookups in the database. +@@ -885,7 +885,7 @@ doing lookups in the database. =item * Create a C<postgrey> user and the directory where to put the database I<dbdir> @@ -100,14 +100,14 @@ =item * -@@ -871,12 +871,12 @@ Put something like this in /etc/main.cf: +@@ -908,12 +908,12 @@ Put something like this in /etc/main.cf: =item * -Install the provided postgrey_whitelist_clients and -postgrey_whitelist_recipients in /etc/postfix. +Install the provided whitelist_clients and -+postgrey_whitelist_recipients in /etc/postgrey. ++whitelist_recipients in /etc/postgrey. =item * @@ -116,7 +116,7 @@ greylisting. =back -@@ -887,9 +887,9 @@ Whitelists allow you to specify client a +@@ -924,9 +924,9 @@ Whitelists allow you to specify client addresses or recipient address, for which no greylisting should be done. Per default postgrey will read the following files: @@ -133,14 +133,11 @@ =================================================================== --- postgrey_whitelist_clients.orig +++ postgrey_whitelist_clients -@@ -1,6 +1,6 @@ - # postgrey whitelist for mail client hostnames +@@ -2,3 +2,3 @@ # -------------------------------------------- -# put this file in /etc/postfix or specify its path +# put this file in /etc/postgrey or specify its path # with --whitelist-clients=xxx - # - # postgrey version: 1.35, build date: 2014-06-11 @@ -19,8 +19,6 @@ vger.kernel.org karger.ch # 2004-06-02: lilys.ch, (slow: 4 hours) ++++++ postgrey-1.35.tar.gz -> postgrey-1.36.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgrey-1.35/Changes new/postgrey-1.36/Changes --- old/postgrey-1.35/Changes 2014-06-11 15:12:26.000000000 +0200 +++ new/postgrey-1.36/Changes 2015-09-01 21:43:05.000000000 +0200 @@ -1,6 +1,14 @@ +* 2015-09-01: version 1.36 + - improved support for IPv6 addresses: new --ipv4cidr and --ipv6cidr options + for proper subnetting of IPv6 (Håvard Moen, BenediktS) + - updated whitelist + - user-settable unix socket permission: --socketmode (Teubel György) + - init script fixes (Sacha Ott) + * 2014-06-11: version 1.35 - use just 'postgrey' as process name, instead of '/usr/sbin/postgrey', because Linux tools are limited to 15 characters (#5) + - Make postgrey work with Perl 5.18 (Yasuhiro KIMURA, #4) - updated whitelist * 2011-05-04: version 1.34 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgrey-1.35/README new/postgrey-1.36/README --- old/postgrey-1.35/README 2013-12-12 11:33:10.000000000 +0100 +++ new/postgrey-1.36/README 2015-07-23 23:04:07.000000000 +0200 @@ -13,6 +13,7 @@ - BerkeleyDB (Perl Module) - Berkeley DB >= 4.1 (Library) - Digest::SHA (Perl Module, only for --privacy option) +- NetAddr::IP Documentation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgrey-1.35/contrib/postgrey.init new/postgrey-1.36/contrib/postgrey.init --- old/postgrey-1.35/contrib/postgrey.init 2013-12-12 11:32:41.000000000 +0100 +++ new/postgrey-1.36/contrib/postgrey.init 2015-07-23 22:46:57.000000000 +0200 @@ -22,11 +22,12 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/postgrey -NAME=postgrey +DAEMON_NAME=postgrey DESC="postfix greylisting daemon" +DAEMON_USER=postgrey -PIDFILE=/var/run/$NAME.pid -SCRIPTNAME=/etc/init.d/$NAME +PIDFILE=/var/run/$DAEMON_NAME.pid +SCRIPTNAME=/etc/init.d/$DAEMON_NAME # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 @@ -34,9 +35,9 @@ . /lib/lsb/init-functions # Read config file if it is present. -if [ -r /etc/default/$NAME ] +if [ -r /etc/default/$DAEMON_NAME ] then - . /etc/default/$NAME + . /etc/default/$DAEMON_NAME fi POSTGREY_OPTS="--pidfile=$PIDFILE --daemonize $POSTGREY_OPTS" @@ -47,49 +48,87 @@ fi ret=0 + +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $POSTGREY_OPTS "$POSTGREY_TEXT_OPT" \ + || return 2 +} + +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --user $DAEMON_USER --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --user $DAEMON_USER --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" + +} + +do_reload() +{ + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE + return 0 +} + case "$1" in start) - log_daemon_msg "Starting $DESC" "$NAME" - if start-stop-daemon --start --oknodo --quiet \ - --pidfile $PIDFILE --name $NAME \ - --startas $DAEMON -- $POSTGREY_OPTS "$POSTGREY_TEXT_OPT" - then - log_end_msg 0 - else - ret=$? - log_end_msg 1 - fi + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$DAEMON_NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac ;; stop) - log_daemon_msg "Stopping $DESC" "$NAME" - if start-stop-daemon --stop --oknodo --quiet \ - --pidfile $PIDFILE --name $NAME - then - log_end_msg 0 - else - ret=$? - log_end_msg 1 - fi - rm -f $PIDFILE + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$DAEMON_NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac ;; reload|force-reload) - log_action_begin_msg "Reloading $DESC configuration..." - if start-stop-daemon --stop --signal 1 --quiet \ - --pidfile $PIDFILE --name $NAME - then - log_action_end_msg 0 - else - ret=$? - log_action_end_msg 1 - fi - ;; + [ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC" "$DAEMON_NAME" + do_reload + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; restart) - $0 stop - $0 start - ret=$? + do_stop + do_start ;; status) - status_of_proc -p $PIDFILE $DAEMON "$NAME" 2>/dev/null + status_of_proc -p $PIDFILE $DAEMON "$DAEMON_NAME" 2>/dev/null ret=$? ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgrey-1.35/postgrey new/postgrey-1.36/postgrey --- old/postgrey-1.35/postgrey 2014-06-11 15:13:50.000000000 +0200 +++ new/postgrey-1.36/postgrey 2015-09-01 21:44:46.000000000 +0200 @@ -11,6 +11,7 @@ use strict; use Pod::Usage; use Getopt::Long 2.25 qw(:config posix_default no_ignore_case); +use NetAddr::IP; use Net::Server; # used only to find out which version we use use Net::Server::Multiplex; use BerkeleyDB; @@ -22,7 +23,7 @@ use vars qw(@ISA); @ISA = qw(Net::Server::Multiplex); -my $VERSION = '1.35'; +my $VERSION = '1.36'; my $DEFAULT_DBDIR = '/var/spool/postfix/postgrey'; my $CONFIG_DIR = '/etc/postfix'; @@ -181,12 +182,26 @@ return ($ip, undef); } - my @ip=split(/\./, $ip); - return ($ip, undef) unless defined $ip[3]; - # skip if it contains the last two IP numbers in the hostname - # (we assume it is a pool of dialup addresses of a provider) - return ($ip, undef) if $revdns =~ /$ip[2]/ and $revdns =~ /$ip[3]/; - return (join('.', @ip[0..2], '0'), $ip[3]); + my $ipaddr; + if($ip =~ /\./) { + # IPv4 + my @ip=split(/\./, $ip); + return ($ip, undef) unless defined $ip[3]; + # skip if it contains the last two IP numbers in the hostname + # (we assume it is a pool of dialup addresses of a provider) + return ($ip, undef) if $revdns =~ /$ip[2]/ and $revdns =~ /$ip[3]/; + + $ipaddr = NetAddr::IP->new($ip, $self->{postgrey}{ipv4cidr}); + } + elsif($ip =~ /:/) { + # IPv6 + $ipaddr = NetAddr::IP->new($ip, $self->{postgrey}{ipv6cidr}); + } + else { + warn "doesn't look like an IP address: $ipaddr\n"; + return ($ip, undef); + } + return ($ipaddr->network, undef); } sub mylog($$$) @@ -510,9 +525,10 @@ # parse options my %opt = (); GetOptions(\%opt, 'help|h', 'man', 'version', 'noaction|no-action|n', - 'verbose|v', 'quiet|q', 'daemonize|d', 'unix|u=s', 'inet|i=s', + 'verbose|v', 'quiet|q', 'daemonize|d', + 'unix|u=s', 'inet|i=s', 'socketmode=s', 'user=s', 'group=s', 'dbdir=s', 'pidfile=s', 'delay=i', 'max-age=i', - 'lookup-by-subnet', 'lookup-by-host', 'auto-whitelist-clients:s', + 'lookup-by-subnet', 'lookup-by-host', 'ipv4cidr=i', 'ipv6cidr=i', 'auto-whitelist-clients:s', 'whitelist-clients=s@', 'whitelist-recipients=s@', 'syslogfacility|syslog-facility|facility=s', 'retry-window=s', 'greylist-action=s', 'greylist-text=s', 'privacy', @@ -567,6 +583,11 @@ if($opt{inet}) { $opt{inet} =~ /^(.*)$/; $opt{inet} = $1; } + # untaint what is given on --socketmode. It is not security sensitive since + # it is provided by the admin + if($opt{socketmode}) { + $opt{socketmode} =~ /^(.*)$/; $opt{socketmode} = $1; + } # determine proper "logsock" for Sys::Syslog my $syslog_logsock; @@ -595,6 +616,7 @@ commandline => [ 'postgrey', @ARGV_saved ], port => [ $opt{inet} ? $opt{inet} : $opt{unix}."|unix" ], proto => $opt{inet} ? 'tcp' : 'unix', + socketmode => $opt{socketmode} || '0666', user => $opt{user} || 'postgrey', group => $opt{group} || 'nogroup', dbdir => $opt{dbdir} || $DEFAULT_DBDIR, @@ -613,6 +635,8 @@ last_maint => time, last_maint_keys => 0, # do it on the first night lookup_by_host => $opt{'lookup-by-host'}, + ipv4cidr => $opt{'ipv4cidr'} || 24, + ipv6cidr => $opt{'ipv6cidr'} || 64, awl_clients => defined $opt{'auto-whitelist-clients'} ? ($opt{'auto-whitelist-clients'} ne '' ? $opt{'auto-whitelist-clients'} : 5) : 5, @@ -665,9 +689,9 @@ { my ($self) = @_; - # unix socket permissions should be 666 + # set unix socket permissions if($self->{server}{port}[0] =~ /^(.*)\|unix$/) { - chmod 0666, $1; + chmod oct($self->{server}{socketmode}), $1; } } @@ -801,6 +825,7 @@ --syslog-facility Syslog facility to use (default mail) -q, --quiet decrease verbosity level -u, --unix=PATH listen on unix socket PATH + --socketmode=MODE unix socket permission (default 0666) -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 @@ -815,7 +840,9 @@ --greylist-action=A if greylisted, return A to Postfix (default: DEFER_IF_PERMIT) --greylist-text=TXT response when a mail is greylisted (default: Greylisted + help url, see below) - --lookup-by-subnet strip the last 8 bits from IP addresses (default) + --lookup-by-subnet strip the last N bits from IP addresses, determined by ipv4cidr and ipv6cidr (default) + --ipv4cidr=N What cidr to use for the subnet on IPv4 addresses when using lookup-by-subnet (default: 24) + --ipv6cidr=N What cidr to use for the subnet on IPv6 addresses when using lookup-by-subnet (default: 64) --lookup-by-host do not strip the last 8 bits from IP addresses --privacy store data using one-way hash functions --hostname=NAME set the hostname (default: `hostname`) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/postgrey-1.35/postgrey_whitelist_clients new/postgrey-1.36/postgrey_whitelist_clients --- old/postgrey-1.35/postgrey_whitelist_clients 2014-06-11 15:13:50.000000000 +0200 +++ new/postgrey-1.36/postgrey_whitelist_clients 2015-09-01 21:44:54.000000000 +0200 @@ -3,7 +3,7 @@ # put this file in /etc/postfix or specify its path # with --whitelist-clients=xxx # -# postgrey version: 1.35, build date: 2014-06-11 +# postgrey version: 1.36, build date: 2015-09-01 # greylisting.org: Southwest Airlines (unique sender, no retry) southwest.com @@ -144,14 +144,14 @@ # ibm.com (big pool, reported by Casey Peel) ibm.com # messagelabs.com (big pool, reported by John Tobin) -/^mail\d+\.messagelabs\.com$/ +messagelabs.com # ptb.de (slow, reported by Joachim Schoenberg) berlin.ptb.de # registrarmail.net (unique sender names, reported by Simon Waters) registrarmail.net # google.com (big pool, reported by Matthias Dyer, Martin Toft) google.com -# orange.fr (big pool, reported by Lo�c Le Loarer) +# orange.fr (big pool, reported by Loïc Le Loarer) /^smtp\d+\.orange\.fr$/ # citigroup.com (slow retry, reported by Michael Monnerie) /^smtp\d+.citigroup.com$/ @@ -227,3 +227,13 @@ mout-xforward.perfora.net # 2014-02-01: startcom.org (long retry, reported by jweiher) gateway.startcom.org +# 2014-12-18: mail.ru (retries from fallback*.mail.ru, reported by Andriy Yurchuk) +/^fallback\d+\.mail\.ru$/ +# French tax authority, no retry +dgfip.finances.gouv.fr +# 2015-06-10: magisto.com (requested by postmaster) +/^o\d+\.ntdc\.magisto\.com$/ +# 2015-07-23: outlook.com (github #20) +outlook.com +# 2015-08-19 (the retrying is failing) +mail.alibaba.com ++++++ postgrey-groupid.patch ++++++ --- /var/tmp/diff_new_pack.u0DHbp/_old 2016-01-07 00:24:50.000000000 +0100 +++ /var/tmp/diff_new_pack.u0DHbp/_new 2016-01-07 00:24:50.000000000 +0100 @@ -2,16 +2,16 @@ =================================================================== --- postgrey.orig +++ postgrey -@@ -586,7 +586,7 @@ sub main() - port => [ $opt{inet} ? $opt{inet} : $opt{unix}."|unix" ], +@@ -618,7 +618,7 @@ sub main() proto => $opt{inet} ? 'tcp' : 'unix', + socketmode => $opt{socketmode} || '0666', user => $opt{user} || 'postgrey', - group => $opt{group} || 'nogroup', + group => $opt{group} || 'postfix', dbdir => $opt{dbdir} || $DEFAULT_DBDIR, setsid => $opt{daemonize} ? 1 : undef, pid_file => $opt{daemonize} ? $opt{pidfile} : undef, -@@ -795,7 +795,7 @@ B<postgrey> [I<options>...] +@@ -830,7 +830,7 @@ B<postgrey> [I<options>...] -d, --daemonize run in the background --pidfile=PATH put daemon pid into this file --user=USER run as USER (default: postgrey) ++++++ postgrey_daily_greylist.crontab ++++++ --- /var/tmp/diff_new_pack.u0DHbp/_old 2016-01-07 00:24:50.000000000 +0100 +++ /var/tmp/diff_new_pack.u0DHbp/_new 2016-01-07 00:24:50.000000000 +0100 @@ -13,17 +13,31 @@ # logfiles got rotate (exceptions to this rule possible) # variables to modify to personal settings -reciepient=klaus +reciepient=postmaster logfile=/var/log/mail + report_flags="--check_sender=mx,a" # report_flags='--separate_by_subnet=":==================\n" --nosingle_line --check_sender=mx,a' # better, not to modify these variables TEMPFILE=$(mktemp "/tmp/greylist.XXXXXX") || exit 1 -date=`date -d yesterday +"%b %2e"` # for compressed logfiles... today=`date +"%Y%m%d"` yesterday=`date -d yesterday +"%Y%m%d"` +## +## Attention! This script has changed to work with +## rsyslog on an openSUSE >= 12.3 called +## MINIMAL SERVER SELECTION +## +# Set date format to search value as your need's +# RSYSLOG: +# a RFC5424 logline start with yyyy-mm-dd +# (e.g. 2015-08-15 ) comment out the next line +# searchValue=`date -d yesterday +"%F"` +# SYSLOG-NG: +# a RFC3164 logline start with locale's abbreviated month +# (e.g. Jan 1 ) comment out the next line +searchValue=`date -d yesterday +"%b %2e"` if [ ! -r "$logfile" ]; then echo "no logfile $logfile" | \ @@ -39,18 +53,18 @@ exit 1 fi -if [ -r "$logfile"-"$today".bz2 ]; then - ( cat "$logfile"; bzcat "$logfile"-"$today".bz2; ) |\ - grep postgrey | \ - grep "$date" > $TEMPFILE -elif [ -r "$logfile"-"$yesterday".bz2 ]; then - ( cat "$logfile"; bzcat "$logfile"-"$yesterday".bz2; ) |\ - grep postgrey | \ - grep "$date" > $TEMPFILE +if [ -r "$logfile"-"$today".xz ]; then + ( cat "$logfile"; xzcat "$logfile"-"$today".xz; ) |\ + grep "postgrey\|[gG]reylist" | \ + grep "$searchValue" > $TEMPFILE +elif [ -r "$logfile"-"$yesterday".xz ]; then + ( cat "$logfile"; xzcat "$logfile"-"$yesterday".xz; ) |\ + grep "postgrey\|[gG]reylist" | \ + grep "$searchValue" > $TEMPFILE else cat "$logfile" | \ - grep postgrey | \ - grep "$date" > $TEMPFILE + grep "postgrey\|[gG]reylist" | \ + grep "$searchValue" > $TEMPFILE fi if [ `wc -l < $TEMPFILE` -gt 1 ]; then @@ -69,4 +83,3 @@ fi rm $TEMPFILE -