[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Review Needed: spamass-milter



Warren Togami wrote:
http://people.redhat.com/wtogami/temp/spamass-milter-0.3.0-2.src.rpm
http://people.redhat.com/wtogami/temp/spamass-milter.spec

I don't particularly care about this package because I dislike sendmail and use postfix, but one of my friends wants to use it, so I want to add it to Extras. If someone actually cares about this package and wants to be the Extras maintainer instead of me please say so. Otherwise I'll "maintain" it with minimal effort.

The original packager had made no attempt to request an Extras CVS account, but he is certainly welcome to maintain it here if he is willing to follow project guidelines.

I'll volunteer if nobody else particularly wants it. I'm not a current spamass-milter user but I intend to start using it soon, as my home-brewed spam filtering scheme using procmail is too much like hard work to maintain.


I've had a look at the package and made a few changes (see attached spec file):

- Use Extras standard buildroot
- Unpack tarball quietly
- Create account sa-milt and run the milter using that instead of root
- Fix socket name in README
- Initscript not %%config

By far the most significant is not running the milter as root.

Further comments welcomed.

Paul.
Summary:        Sendmail milter for spamassassin
Name:           spamass-milter
Version:        0.3.0
Release:        3%{?dist}
License:        GPL
Group:          System Environment/Daemons
URL:            http://savannah.nongnu.org/projects/spamass-milt/

Source:         http://savannah.nongnu.org/download/spamass-milt/spamass-milter-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  spamassassin, sendmail-devel
Requires:       spamassassin, sendmail

Requires(pre):  %{_sbindir}/useradd
Requires(post): /sbin/chkconfig
Requires(post): /sbin/service
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service

%description
A Sendmail milter (Mail Filter) library that pipes all incoming mail
(including things received by rmail/UUCP) through the SpamAssassin,
a highly customizable spam filter.

%prep
%setup -q
%{__sed} -i -e 's local:/var/run/sendmail/spamass sock unix:/var/run/spamass-milter/spamass-milter.sock@' README

%{__cat} <<EOF >spamass-milter.sysconfig
### Override for your different local config
#SOCKET=%{_localstatedir}/run/spamass-milter/spamass-milter.sock

### Default parameters for spamass-milter are:
### -f (work in the background)
### -P %{_localstatedir}/run/spamass-milter.pid (PID file)
### you may add another parameters here, see spamass-milter(1)
#EXTRA_FLAGS="-m -r 15"
EOF

%{__cat} <<'EOF' >spamass-milter.sysv
#!/bin/bash
#
# Init file for Spamassassin sendmail milter.
#
# chkconfig: - 80 20
# description: spamass-milter is a daemon which hooks into sendmail and \
#              routes email messages to spamassassin
#
# processname: spamass-milter
# config: %{_sysconfdir}/sysconfig/spamass-milter
# pidfile: %{_localstatedir}/run/spamass-milter.pid

source %{_initrddir}/functions
source %{_sysconfdir}/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x %{_sbindir}/spamass-milter ] || exit 1

### Default variables
SOCKET="%{_localstatedir}/run/spamass-milter/spamass-milter.sock"
EXTRA_FLAGS="-m -r 15"
SYSCONFIG="%{_sysconfdir}/sysconfig/spamass-milter"

### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"

RETVAL=0
prog="spamass-milter"
desc="SpamAssassin milter"
pidfile=%{_localstatedir}/run/spamass-milter.pid

start() {
	echo -n $"Starting $desc ($prog): "
	touch $pidfile
	chown sa-milt:sa-milt $pidfile
	daemon --user sa-milt %{_sbindir}/$prog -p $SOCKET -P $pidfile -f $EXTRA_FLAGS
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch %{_localstatedir}/lock/subsys/spamass-milter
	return $RETVAL
}

stop() {
	echo -n $"Shutting down $desc ($prog): "
	killproc $prog
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f $pidfile
	[ $RETVAL -eq 0 ] && rm -f %{_localstatedir}/lock/subsys/spamass-milter
	return $RETVAL
}

restart() {
	stop
	start
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	restart
	;;
  condrestart)
	[ -e %{_localstatedir}/lock/subsys/spamass-milter ] && restart
	RETVAL=$?
	;;
  status)
	status $prog
	RETVAL=$?
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|condrestart|status}"
	RETVAL=1
esac

exit $RETVAL
EOF

%build
%configure
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf %{buildroot}
%makeinstall

%{__install} -D -m0755 spamass-milter.sysv %{buildroot}%{_initrddir}/spamass-milter
%{__install} -D -m0644 spamass-milter.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/spamass-milter
%{__install} -d -m0700 %{buildroot}%{_localstatedir}/run/spamass-milter

%pre
%{_sbindir}/useradd -r -s /sbin/nologin -d %{_localstatedir}/run/spamass-milter \
	-c "SpamAssassin Milter" sa-milt &>/dev/null || :

%post
/sbin/chkconfig --add spamass-milter || :

%preun
if [ $1 -eq 0 ]; then
    /sbin/service spamass-milter stop &>/dev/null || :
    /sbin/chkconfig --del spamass-milter || :
fi

%postun
/sbin/service spamass-milter condrestart &>/dev/null || :

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-, root, root, 0755)
%doc AUTHORS ChangeLog NEWS README
%doc %{_mandir}/man1/spamass-milter.1*
%config(noreplace) %{_sysconfdir}/sysconfig/spamass-milter
%{_initrddir}/spamass-milter
%{_sbindir}/spamass-milter
%dir %attr(-,sa-milt,sa-milt) %{_localstatedir}/run/spamass-milter

%changelog
* Mon Jun 06 2005 Paul Howarth <paul city-fan org> - 0.3.0-3%{?dist}
- Use Extras standard buildroot
- Unpack tarball quietly
- Create account sa-milt and run the milter using that instead of root
- Fix socket name in README
- Initscript not %%config

* Sun Jun 05 2005 Warren Togami <wtogami redhat com> - 0.3.0-2
- Extras

* Tue Feb 08 2005 Dag Wieers <dag wieers com> - 0.3.0-1
- Updated to release 0.3.0.

* Wed Sep 01 2004 Dag Wieers <dag wieers com> - 0.2.0-1
- Fixed variables in sysconfig file. (mator)

* Tue Feb 17 2004 Dag Wieers <dag wieers com> - 0.2.0-0
- Initial package. (using DAR)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]