]> TLD Linux GIT Repositories - packages/postgrey.git/blob - postgrey.spec
- from PLD, migrated configuration to /etc/postfix
[packages/postgrey.git] / postgrey.spec
1 %include        /usr/lib/rpm/macros.perl
2 Summary:        Postfix Greylisting Policy Server
3 Summary(pl.UTF-8):      Serwer do polityki "szarych list" dla Postfiksa
4 Name:           postgrey
5 Version:        1.37
6 Release:        5
7 License:        GPL v2
8 Group:          Networking/Daemons
9 Source0:        http://postgrey.schweikert.ch/pub/%{name}-%{version}.tar.gz
10 # Source0-md5:  2ef30f42ad84f00caf41c49b593b8e2a
11 Source1:        %{name}.init
12 Source2:        %{name}.sysconfig
13 Source3:        http://www.lipek.pl/postgrey_clients_dump
14 # Source3-md5:  155b88f2781b03535bfa2797cda28e52
15 Patch0:         %{name}-group.patch
16 Patch1:         disable-transaction-logic
17 URL:            http://postgrey.schweikert.ch/
18 BuildRequires:  rpm-perlprov
19 BuildRequires:  rpmbuild(macros) >= 1.268
20 Requires:       perl-IO-Multiplex
21 Requires:       postfix
22 BuildArch:      noarch
23 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
25 %define         _sysconfdir /etc/postfix
26
27 %description
28 Postgrey is a Postfix policy server implementing greylisting. When a
29 request for delivery of a mail is received by Postfix via SMTP, the
30 triplet CLIENT_IP / SENDER / RECIPIENT is built. If it is the first
31 time that this triplet is seen, or if the triplet was first seen less
32 than 5 minutes, then the mail gets rejected with a temporary error.
33 Hopefully spammers or viruses will not try again later, as it is
34 however required per RFC.
35
36 Edit your configuration files:
37 %{_sysconfdir}/main.cf:
38   smtpd_recipient_restrictions = ...
39     check_policy_service unix:postgrey/socket, ...
40 or if you like to use inet sockets (modify the IP if needed):
41 /etc/sysconfig/postgrey:
42   OPTIONS="--inet=127.0.0.1:10023"
43 %{_sysconfdir}/main.cf:
44   smtpd_recipient_restrictions = ...
45     check_policy_service inet:127.0.0.1:10023, ...
46
47 %description -l pl.UTF-8
48 Postgrey to serwer polityki dla Postfiksa implementujący "szare
49 listy". Kiedy Postfix otrzymuje po SMTP żądanie dostarczenia poczty,
50 tworzony jest triplet IP_KLIENTA / NADAWCA / ADRESAT. Jeśli dany
51 triplet jest widziany po raz pierwszy lub był widziany po raz pierwszy
52 mniej niż 5 minut temu, poczta jest odrzucana z tymczasowym błędem.
53 Można mieć nadzieję, że spamerzy i wirusy nie będą próbować ponownie,
54 co jest jednak wymagane przez RFC.
55
56 Aby użyć tego programu należy zmodyfikować pliki konfiguracyjne:
57 %{_sysconfdir}/main.cf:
58   smtpd_recipient_restrictions = ...
59     check_policy_service unix:postgrey/socket, ...
60 lub jeśli chcemy używać gniazd inet (w razie potrzeby zmienić IP):
61 /etc/sysconfig/postgrey:
62   OPTIONS="--inet=127.0.0.1:10023"
63 %{_sysconfdir}/main.cf:
64   smtpd_recipient_restrictions = ...
65     check_policy_service inet:127.0.0.1:10023, ...
66
67 %prep
68 %setup -q
69 %patch0 -p1
70 %patch1 -p1
71
72 %install
73 rm -rf $RPM_BUILD_ROOT
74 install -d $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},%{_sysconfdir},%{_sbindir}} \
75         $RPM_BUILD_ROOT%{_var}/spool/postfix/%{name}
76
77 # init script:
78 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
79 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
80
81 install postgrey_whitelist_clients $RPM_BUILD_ROOT%{_sysconfdir}
82 install postgrey_whitelist_recipients $RPM_BUILD_ROOT%{_sysconfdir}
83 touch $RPM_BUILD_ROOT%{_sysconfdir}/postgrey_whitelist_clients.local
84
85 install postgrey %{SOURCE3} contrib/postgreyreport $RPM_BUILD_ROOT%{_sbindir}
86
87 %clean
88 rm -rf $RPM_BUILD_ROOT
89
90 %pre
91 %groupadd -g 155 postgrey
92 %useradd -u 155 -d %{_var}/spool/postfix/%{name} -s /sbin/false -c "Postfix Greylisting Policy" -g postgrey postgrey
93
94 %post
95 /sbin/chkconfig --add %{name}
96 %service %{name} restart
97
98 %preun
99 if [ "$1" = 0 ]; then
100         %service %{name} stop
101         /sbin/chkconfig --del %{name}
102 fi
103
104 %postun
105 if [ "$1" = 0 ]; then
106         %userremove postgrey
107         %groupremove postgrey
108         # should be done?:
109         rm -rf %{_var}/spool/postfix/%{name}
110 fi
111
112 %triggerun -- %{name} < 1.37-5
113 if [ $1 -le 1 ]; then
114         exit 0
115 fi
116 for f in /etc/mail/postgres_whitelist_{clients,clients.local,recipients}; do
117         f=${f##*/}
118         [ -f "/etc/mail/$f" ] && mv "/etc/mail/$f" "/etc/postfix/$f" 2>/dev/null || :
119 done
120 [ -n "$(find /etc/mail -type d -empty 2>/dev/null)" ] && rmdir /etc/mail 2>/dev/null || :
121
122 %triggerpostun -- %{name} < 1.37-5
123 echo
124 echo "Warning! Configuration has been migrated to /etc/postfix."
125 echo
126
127 %files
128 %defattr(644,root,root,755)
129 %doc README Changes
130 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postgrey_whitelist_clients
131 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postgrey_whitelist_recipients
132 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/postgrey_whitelist_clients.local
133 %attr(640,root,postgrey) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
134 %attr(754,root,root) /etc/rc.d/init.d/%{name}
135 %attr(755,root,root) %{_sbindir}/postgrey*
136 %dir %attr(711,postgrey,postgrey) %{_var}/spool/postfix/%{name}