diff --git a/TODO b/TODO index 20cfaa7922ea9fdbb001a8265747345f3915fa27..3e76e00ce0bebbf07d5e90a0756195b3621a4c7a 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,6 @@ -Don't match dynamic ptr in bestguess. +Convert DSN to REJECT unless sender gets SPF pass or best guess pass. Make +configurable by SPF result with NOTSPAM policy (reject or deliver without DSN). +Maybe policy should be NODSN - still verify sender with CBV. When content filtering is not installed, reject BLACKLISTed MFROM immediately. There is no use waiting until EOM. @@ -224,3 +226,4 @@ data structure as autowhitelist.log. DONE Backup copies for outgoing/incoming mail. +DONE Don't match dynamic ptr in bestguess. diff --git a/milter.rc b/milter.rc index 0840e431e90d34125570895d0ae8db287a8d9c51..3fad6c5b4c3093ceed122a6d7b2b34ed811a7951 100755 --- a/milter.rc +++ b/milter.rc @@ -23,7 +23,7 @@ pidof() { # Source function library. . /etc/rc.d/init.d/functions -[ -x /var/log/milter/start.sh ] || exit 0 +[ -x /usr/lib/pymilter/start.sh ] || exit 0 RETVAL=0 prog="milter" @@ -36,7 +36,7 @@ start() { mkdir -p /var/run/milter chown mail:mail /var/run/milter fi - daemon --check milter --user mail /var/log/milter/start.sh milter bms + daemon --check milter --user mail /usr/lib/pymilter/start.sh milter bms RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/milter diff --git a/milter.spec b/pymilter.spec similarity index 93% rename from milter.spec rename to pymilter.spec index a3eae8579d8b5092a3e0347224e56be17498f9eb..7783871fccd7d1523b064e9c272db61c636c47ff 100644 --- a/milter.spec +++ b/pymilter.spec @@ -1,8 +1,7 @@ -%define name pymilter -%define version 0.8.8 +%define version 0.8.9 %define release 1 # what version of RH are we building for? -%define redhat7 0 +%define redhat7 1 # Options for Redhat version 6.x: # rpm -ba|--rebuild --define "rh7 1" @@ -19,7 +18,7 @@ %endif # RH9, other systems (single ps line per process) %ifos Linux -%define python python +%define python python2.4 %else %define python python %endif @@ -29,11 +28,17 @@ %define libdir /usr/lib/pymilter %endif -Summary: Python interface to sendmail milter API -Name: %{name} +# This spec file contains 2 noarch packages in addition to the pymilter +# module. To compile all three, use: +# rpmbuild -ba --target=i386,noarch pymilter.spec + +%ifarch noarch +Name: milter +Group: Applications/System +Summary: BMS spam and reputation milter Version: %{version} Release: %{release} -Source: %{name}-%{version}.tar.gz +Source: pymilter-%{version}.tar.gz #Patch: %{name}-%{version}.patch License: GPL Group: Development/Libraries @@ -42,22 +47,10 @@ Prefix: %{_prefix} Vendor: Stuart D. Gathman <stuart@bmsi.com> Packager: Stuart D. Gathman <stuart@bmsi.com> Url: http://www.bmsi.com/python/milter.html -Requires: %{python} >= 2.4, sendmail >= 8.13 +Requires: %{python} >= 2.4, pyspf >= 2.0.4, pymilter %ifos Linux Requires: chkconfig %endif -BuildRequires: %{python}-devel >= 2.4, sendmail-devel >= 8.13 - -%description -This is a python extension module to enable python scripts to -attach to sendmail's libmilter functionality. Additional python -modules provide for navigating and modifying MIME parts, sending -DSNs, and doing CBV. - -%package -n milter -Group: Applications/System -Summary: BMS spam and reputation milter -Requires: pyspf >= 2.0.4 %description -n milter A complex but effective spam filtering, SPF checking, and reputation tracking @@ -66,28 +59,18 @@ mail application. It uses pydspam if installed for bayesian filtering. %package spf Group: Applications/System Summary: BMS spam and reputation milter -Requires: pyspf >= 2.0.4 +Requires: pyspf >= 2.0.4, pymilter %description spf A simple mail filter to add Received-SPF headers and reject forged mail. Rejection policy is configured via sendmail access file. %prep -%setup +%setup -n pymilter-%{version} #patch -p0 -b .bms -%build -%if %{redhat7} - LDFLAGS="-s" -%else # Redhat builds debug packages after 7.3 - LDFLAGS="-g" -%endif -env CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$LDFLAGS" %{python} setup.py build - %install rm -rf $RPM_BUILD_ROOT -%{python} setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES -grep '.pyc$' INSTALLED_FILES | sed -e 's/c$/o/' >>INSTALLED_FILES mkdir -p $RPM_BUILD_ROOT/var/log/milter mkdir -p $RPM_BUILD_ROOT/etc/mail mkdir $RPM_BUILD_ROOT/var/log/milter/save @@ -198,16 +181,9 @@ if [ $1 = 0 ]; then fi %endif -%clean -rm -rf $RPM_BUILD_ROOT - -%files -f INSTALLED_FILES +%files %defattr(-,root,root) -%doc README HOWTO ChangeLog NEWS TODO CREDITS sample.py milter-template.py %config %{libdir}/start.sh - -%files -n milter -%defattr(-,root,root) /etc/logrotate.d/milter /etc/cron.daily/milter %ifos aix4.1 @@ -219,7 +195,9 @@ rm -rf $RPM_BUILD_ROOT %dir /var/log/milter %dir /var/log/milter/save %config %{libdir}/bms.py +%if !%{redhat7} %{libdir}/bms.py? +%endif %config(noreplace) /var/log/milter/strike3.txt %config(noreplace) /var/log/milter/softfail.txt %config(noreplace) /var/log/milter/fail.txt @@ -236,7 +214,62 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) /etc/mail/spfmilter.cfg /etc/rc.d/init.d/spfmilter +%else # not noarch + +%define name pymilter +Summary: Python interface to sendmail milter API +Name: %{name} +Version: %{version} +Release: %{release} +Source: %{name}-%{version}.tar.gz +#Patch: %{name}-%{version}.patch +License: GPL +Group: Development/Libraries +BuildRoot: %{_tmppath}/%{name}-buildroot +Prefix: %{_prefix} +Vendor: Stuart D. Gathman <stuart@bmsi.com> +Packager: Stuart D. Gathman <stuart@bmsi.com> +Url: http://www.bmsi.com/python/milter.html +Requires: %{python} >= 2.4, sendmail >= 8.13 +BuildRequires: %{python}-devel >= 2.4, sendmail-devel >= 8.13 + +%description +This is a python extension module to enable python scripts to +attach to sendmail's libmilter functionality. Additional python +modules provide for navigating and modifying MIME parts, sending +DSNs, and doing CBV. + +%prep +%setup +#patch -p0 -b .bms + +%build +%if %{redhat7} + LDFLAGS="-s" +%else # Redhat builds debug packages after 7.3 + LDFLAGS="-g" +%endif +env CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$LDFLAGS" %{python} setup.py build + +%install +rm -rf $RPM_BUILD_ROOT +%{python} setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES +%if !%{redhat7} +grep '.pyc$' INSTALLED_FILES | sed -e 's/c$/o/' >>INSTALLED_FILES +%endif + +%files -f INSTALLED_FILES +%defattr(-,root,root) +%doc README HOWTO ChangeLog NEWS TODO CREDITS sample.py milter-template.py + +%endif # noarch + +%clean +rm -rf $RPM_BUILD_ROOT + %changelog +* Mon Sep 24 2007 Stuart Gathman <stuart@bmsi.com> 0.8.9-1 +- Use %ifarch hack to build milter and milter-spf packages as noarch * Fri Jan 05 2007 Stuart Gathman <stuart@bmsi.com> 0.8.8-1 - move AddrCache, parse_addr, iniplist to Milter package - move parse_header to Milter.utils diff --git a/start.sh b/start.sh index 49458408eb1917fc864ddab83597f99706ee30c6..0fd23ba5c5c309264a1180d19c239226525b2471 100755 --- a/start.sh +++ b/start.sh @@ -12,5 +12,5 @@ fi cd /var/log/milter exec >>${appname}.log 2>&1 -${python} ${appname}.py & +${python} ${script}.py & echo $! >/var/run/milter/${appname}.pid