diff --git a/.gitignore b/.gitignore index 96709de..ec15fa9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ postgrey-1.32.tar.gz /postgrey-1.34.tar.gz -/postgrey-1.36.tar.gz -/postgrey-1.37.tar.gz diff --git a/README-rpm b/README-rpm index 7e3f3cb..a06f52c 100644 --- a/README-rpm +++ b/README-rpm @@ -1,34 +1,21 @@ -1. To make use of postgrey in postfix, edit postfix configuration file: +To make use of postgrey, edit your configuration files: /etc/postfix/main.cf: smtpd_recipient_restrictions = ... check_policy_service unix:postgrey/socket, ... -Or if TCP sockets (modify IP / port if needed) is preferred, first change -POSTGREY_TYPE: + +Or if you like to use inet sockets (modify the IP if needed): /etc/sysconfig/postgrey: - POSTGREY_TYPE="--inet=127.0.0.1:10023" - -then modify postfix configuration file: + options="--inet=127.0.0.1:10023" /etc/postfix/main.cf: smtpd_recipient_restrictions = ... check_policy_service inet:127.0.0.1:10023, ... -After above steps, please restart the postfix service to make sure postfix has -loaded the changes. And don't forget to activate the service on startup! +And don't forget to activate the service on startup! -2. If --privacy option is passed to postgrey in /etc/sysconfig/postgrey, make -sure perl(Digest::SHA) is installed, using dnf to install if not available: - - dnf install perl\(Digest::SHA\) - -Don't forget to escape the parentheses if other perl modules are absent. - -3. Postgrey could be used with exim if you want, but need to modify the -systemd service file like removing the dependency of postfix.service. More -details in README.exim underneath /usr/share/doc/postgrey. diff --git a/postgrey-1.28-group.patch b/postgrey-1.28-group.patch new file mode 100644 index 0000000..d97947f --- /dev/null +++ b/postgrey-1.28-group.patch @@ -0,0 +1,21 @@ +diff -Naupr postgrey-1.28.orig/postgrey postgrey-1.28/postgrey +--- postgrey-1.28.orig/postgrey 2007-06-21 15:44:54.000000000 +0200 ++++ postgrey-1.28/postgrey 2007-06-22 16:17:31.000000000 +0200 +@@ -486,7 +486,7 @@ sub main() + port => [ $opt{inet} ? $opt{inet} : $opt{unix}."|unix" ], + proto => $opt{inet} ? 'tcp' : 'unix', + user => $opt{user} || 'postgrey', +- group => $opt{group} || 'nogroup', ++ group => $opt{group} || 'postgrey', + dbdir => $opt{dbdir} || $DEFAULT_DBDIR, + setsid => $opt{daemonize} ? 1 : undef, + pid_file => $opt{daemonize} ? $opt{pidfile} : undef, +@@ -663,7 +663,7 @@ B [I...] + -d, --daemonize run in the background + --pidfile=PATH put daemon pid into this file + --user=USER run as USER (default: postgrey) +- --group=GROUP run as group GROUP (default: nogroup) ++ --group=GROUP run as group GROUP (default: postgrey) + --dbdir=PATH put db files in PATH (default: /var/spool/postfix/postgrey) + --delay=N greylist for N seconds (default: 300) + --max-age=N delete entries older than N days since the last time diff --git a/postgrey-1.34-perl-5.18.patch b/postgrey-1.34-perl-5.18.patch new file mode 100644 index 0000000..13ec89c --- /dev/null +++ b/postgrey-1.34-perl-5.18.patch @@ -0,0 +1,33 @@ +From 9673b54064691a5b9c295ffea340d8a1f9ee1cb8 Mon Sep 17 00:00:00 2001 +From: Yasuhiro KIMURA +Date: Sat, 17 Aug 2013 22:05:27 +0900 +Subject: [PATCH] Make postgrey work with Perl 5.18 + +--- + postgrey | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/postgrey b/postgrey +index 7cb0352..37f69bd 100755 +--- a/postgrey ++++ b/postgrey +@@ -557,6 +557,16 @@ sub main() + if($opt{dbdir}) { + $opt{dbdir} =~ /^(.*)$/; $opt{dbdir} = $1; + } ++ # untaint what is given on --pidfile. It is not security sensitive since ++ # it is provided by the admin ++ if($opt{pidfile}) { ++ $opt{pidfile} =~ /^(.*)$/; $opt{pidfile} = $1; ++ } ++ # untaint what is given on --inet. It is not security sensitive since ++ # it is provided by the admin ++ if($opt{inet}) { ++ $opt{inet} =~ /^(.*)$/; $opt{inet} = $1; ++ } + + # determine proper "logsock" for Sys::Syslog + my $syslog_logsock; +-- +1.8.4.2 + diff --git a/postgrey.service b/postgrey.service index 9da9c13..01df702 100644 --- a/postgrey.service +++ b/postgrey.service @@ -5,17 +5,18 @@ Before=postfix.service [Service] Type=forking + EnvironmentFile=-/etc/sysconfig/postgrey ExecStartPre=-/bin/rm -f /var/run/postgrey.pid PIDFile=/var/run/postgrey.pid + ExecStart=/usr/sbin/postgrey \ - $POSTGREY_TYPE \ - $POSTGREY_PID \ - $POSTGREY_GROUP \ - $POSTGREY_USER \ + --unix=/var/spool/postfix/postgrey/socket \ + --pidfile=/var/run/postgrey.pid \ + --group=postgrey \ + --user=postgrey \ '--greylist-text=Greylisted for %%s seconds' \ --daemonize \ - $POSTGREY_DELAY \ $POSTGREY_OPTS Restart=always diff --git a/postgrey.spec b/postgrey.spec index d1a1e2d..a4986cd 100644 --- a/postgrey.spec +++ b/postgrey.spec @@ -1,23 +1,22 @@ %global confdir %{_sysconfdir}/postfix Name: postgrey -Version: 1.37 -Release: 27%{?dist} -Summary: Postfix Greylisting Policy Server +Version: 1.34 +Release: 12%{?dist} # File headers only state "GNU GPL", but the LICENSE sections state v2 and "any # later version" -# Automatically converted from old format: GPLv2+ - review is highly recommended. -License: GPL-2.0-or-later +Summary: Postfix Greylisting Policy Server +License: GPLv2+ URL: http://postgrey.schweikert.ch/ Source0: http://postgrey.schweikert.ch/pub/postgrey-%{version}.tar.gz Source1: postgrey.service Source2: README-rpm Source3: postgrey.sysconfig +Patch0: postgrey-1.28-group.patch +Patch1: postgrey-1.34-perl-5.18.patch BuildArch: noarch -BuildRequires: perl-generators -BuildRequires: perl-podlators BuildRequires: systemd -## Note: If --privacy specified, perl(Digest::SHA) will be needed. +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) #Requires: perl(BerkeleyDB) #Requires: perl(Fcntl) #Requires: perl(Getopt::Long) @@ -29,8 +28,9 @@ BuildRequires: systemd #Requires: perl(strict) #Requires: perl(Sys::Hostname) #Requires: perl(Sys::Syslog) -# Requiring postfix for its directories and GID. -Recommends: postfix +# We require postfix for its directories and gid +Requires: postfix +Requires(pre): shadow-utils Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -45,58 +45,54 @@ again later, as it is however required per RFC. %prep %setup -q -# Set default group tp postgrey. -sed -i 's|nogroup|postgrey|g' postgrey -# No perldoc, man is enough. -sed -i 's|POD ||g;s|perldoc|man|g' README -install -pm0644 %{SOURCE2} README.Fedora - -# Create a sysusers.d config file -cat >postgrey.sysusers.conf < postgrey.8 %install -# Configuration files. +# Configuration files mkdir -p %{buildroot}%{confdir} install -pm0644 postgrey_whitelist_{clients,recipients} \ %{buildroot}%{confdir}/ -# Local whitelist file. +# Local whitelist file echo "# Clients that should not be greylisted. See postgrey(8)." \ > %{buildroot}%{confdir}/postgrey_whitelist_clients.local -# Main script. +# Main script install -pDm0755 postgrey %{buildroot}%{_sbindir}/postgrey -# Spool directory. +# Spool directory mkdir -p %{buildroot}%{_localstatedir}/spool/postfix/postgrey -# Systemd service. +# Init script install -pDm0644 %{SOURCE1} \ %{buildroot}%{_unitdir}/postgrey.service -# Sysconfig file. +# Sysconfig install -pDm0644 %{SOURCE3} \ %{buildroot}%{_sysconfdir}/sysconfig/postgrey -# Manpage. +# Man page install -pDm0644 postgrey.8 \ %{buildroot}%{_mandir}/man8/postgrey.8 -# Optional report script. +# Optional report script install -pDm0755 contrib/postgreyreport \ %{buildroot}%{_sbindir}/postgreyreport -install -m0644 -D postgrey.sysusers.conf %{buildroot}%{_sysusersdir}/postgrey.conf - +%pre +getent group postgrey >/dev/null || groupadd -r postgrey +getent passwd postgrey >/dev/null || \ + useradd -r -g postgrey -d %{_localstatedir}/spool/postfix/postgrey -s /sbin/nologin \ + -c "Postfix Greylisting Service" postgrey +exit 0 %post %systemd_post postgrey.service @@ -118,8 +114,7 @@ install -m0644 -D postgrey.sysusers.conf %{buildroot}%{_sysusersdir}/postgrey.co /bin/systemctl try-restart postgrey.service >/dev/null 2>&1 || : %files -%doc Changes README README.exim README.Fedora -%license COPYING +%doc Changes COPYING README README-rpm %{_unitdir}/postgrey.service %{_sysconfdir}/sysconfig/postgrey %config(noreplace) %{confdir}/postgrey_whitelist_clients @@ -129,123 +124,8 @@ install -m0644 -D postgrey.sysusers.conf %{buildroot}%{_sysusersdir}/postgrey.co %{_sbindir}/postgreyreport %{_mandir}/man8/postgrey.8* %dir %attr(0751,postgrey,postfix) %{_localstatedir}/spool/postfix/postgrey/ -%{_sysusersdir}/postgrey.conf %changelog -* Fri Jul 25 2025 Fedora Release Engineering - 1.37-27 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Tue Feb 11 2025 Zbigniew Jędrzejewski-Szmek - 1.37-26 -- Add sysusers.d config file to allow rpm to create users/groups automatically - -* Sat Jan 18 2025 Fedora Release Engineering - 1.37-25 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Fri Jul 26 2024 Miroslav Suchý - 1.37-24 -- convert license to SPDX - -* Fri Jul 19 2024 Fedora Release Engineering - 1.37-23 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Fri Jan 26 2024 Fedora Release Engineering - 1.37-22 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sun Jan 21 2024 Fedora Release Engineering - 1.37-21 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Fri Jul 21 2023 Fedora Release Engineering - 1.37-20 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Fri Jan 20 2023 Fedora Release Engineering - 1.37-19 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Fri Jul 22 2022 Fedora Release Engineering - 1.37-18 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Mon May 30 2022 Jitka Plesnikova - 1.37-17 -- Perl 5.36 rebuild - -* Fri Jan 21 2022 Fedora Release Engineering - 1.37-16 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Fri Jul 23 2021 Fedora Release Engineering - 1.37-15 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Fri May 21 2021 Jitka Plesnikova - 1.37-14 -- Perl 5.34 rebuild - -* Wed Jan 27 2021 Fedora Release Engineering - 1.37-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Tue Jul 28 2020 Fedora Release Engineering - 1.37-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Mon Jun 22 2020 Jitka Plesnikova - 1.37-11 -- Perl 5.32 rebuild - -* Thu Jan 30 2020 Fedora Release Engineering - 1.37-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Fri Jul 26 2019 Fedora Release Engineering - 1.37-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Thu May 30 2019 Jitka Plesnikova - 1.37-8 -- Perl 5.30 rebuild - -* Sat Feb 02 2019 Fedora Release Engineering - 1.37-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Fri Jul 13 2018 Fedora Release Engineering - 1.37-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Thu Jun 28 2018 Jitka Plesnikova - 1.37-5 -- Perl 5.28 rebuild - -* Fri Feb 09 2018 Fedora Release Engineering - 1.37-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Thu Jul 27 2017 Fedora Release Engineering - 1.37-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Sun Jun 04 2017 Jitka Plesnikova - 1.37-2 -- Perl 5.26 rebuild - -* Sat Mar 11 2017 Nils Philippsen - 1.37-1 -- version 1.37 -- fix syntax error in sysconfig file (#1292066) - -* Sat Feb 11 2017 Fedora Release Engineering - 1.36-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Sun May 15 2016 Jitka Plesnikova - 1.36-4 -- Perl 5.24 rebuild - -* Thu Feb 04 2016 Fedora Release Engineering - 1.36-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Thu Nov 26 2015 Petr Pisar - 1.36-2 -- Rebuild against fixed "file" tool that broke Perl dependencies (bug #1279401) - -* Fri Sep 04 2015 Christopher Meng - 1.36-1 -- Update to 1.36 (1.35 skipped) -- Refine release section of postgrey manpage. -- Refine configuration instructions. - -* Thu Jun 18 2015 Fedora Release Engineering - 1.34-17 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Wed Jun 03 2015 Jitka Plesnikova - 1.34-16 -- Perl 5.22 rebuild - -* Fri Nov 07 2014 Petr Pisar - 1.34-15 -- Build-require perl-podlators for pod2man (bug #1161477) - -* Wed Aug 27 2014 Jitka Plesnikova - 1.34-14 -- Perl 5.20 rebuild - -* Sat Jun 07 2014 Fedora Release Engineering - 1.34-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - * Thu Feb 06 2014 Christopher Meng - 1.34-12 - Correct the syntax of systemd unit to support option with space-separated content. diff --git a/postgrey.sysconfig b/postgrey.sysconfig index b2aa724..f735afd 100644 --- a/postgrey.sysconfig +++ b/postgrey.sysconfig @@ -1,25 +1 @@ -# Postgrey offers 2 listening types, --inet and --unix. As default, Fedora -# postgrey works under UNIX socket, but, changing to TCP socket on user's own -# is also available, for instance, let it work at 10023 port of localhost: -# --inet=10023 -# To be more detailed, there is another way if you still run it at localhost: -# --inet=127.0.0.1:10023 -POSTGREY_TYPE="--unix=/var/spool/postfix/postgrey/socket" - -# If postgrey works under UNIX socket way, PID file can be specified to -# custom location, note that no need to set this if postgrey is working -# under TCP socket way. -POSTGREY_PID="--pidfile=/var/run/postgrey.pid" - -# Name of group which postgrey belongs, default is postgrey -POSTGREY_GROUP="--group=postgrey" - -# Name of user which postgrey belongs, default is postgrey -POSTGREY_USER="--user=postgrey" - -# DELAY -POSTGREY_DELAY="--delay=60" - -# For more options can be used, please read manpage or execute `postgrey -h`. -# Custom options. -POSTGREY_OPTS="" +POSTGREY_OPTS="--delay=60" diff --git a/sources b/sources index eaf5fbc..257cc49 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (postgrey-1.37.tar.gz) = 369968212ea60539efc0d4a7ae84f7c3ce13f5622e6ee070a0089423ef81ca8f7541ebd20289291d0e6a3aec2ca30dbc9c0d9c0a6f0a686adfadb5d0dd7830ca +f736a7be1094593f1a66cd13f32b39ef postgrey-1.34.tar.gz