Summary: An greylisting implementation for qmail Name: jgreylist Version: 0.8 Release: 1 License: BSD Group: Applications/System Source0: jgreylist.c URL: http://qmail.jms1.net/scripts/jgreylist.shtml BuildRoot: %{_tmppath}/%{name}-%{version}-root Requires: qmail %description qgreylist is a 'lite' version of greylisting. The puremagic.com page suggests using the source IP, the envelope from address and the envelope to address. %prep #%setup -q -n jgreylist gcc -o ../SOURCES/jgreylist ../SOURCES/jgreylist.c #%build %install rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT%{_localstatedir}/qmail/bin/ install -d $RPM_BUILD_ROOT%{_localstatedir}/qmail/jgreylist/ #install -d $RPM_BUILD_ROOT%{_localstatedir}/qmail/whitelist/ install ../SOURCES/jgreylist $RPM_BUILD_ROOT%{_localstatedir}/qmail/bin/ %clean rm -rf $RPM_BUILD_ROOT %pre #if [ -f /var/qmail/whitelist ]; then # mv /var/qmail/whitelist /var/qmail/whitelist.bak #fi %post %triggerin -- psa-qmail g=`grep -c "jgreylist /var/qmail/bin/qmail-smtpd" /etc/xinetd.d/smtp_psa || true` if [ $g -gt 0 ]; then # If already installed. true; # its installed else sed -e 's/relaylock \/var/relaylock \/var\/qmail\/bin\/jgreylist \/var/' \ /etc/xinetd.d/smtp_psa > /etc/xinetd.d/smtp_psa.$$ mv /etc/xinetd.d/smtp_psa.$$ /etc/xinetd.d/smtp_psa fi g=`grep -c "jgreylist /var/qmail/bin/qmail-smtpd" /etc/xinetd.d/smtps_psa || true` if [ $g -gt 0 ]; then # If already installed. true; # its installed else sed -e 's/relaylock \/var/relaylock \/var\/qmail\/bin\/jgreylist \/var/' \ /etc/xinetd.d/smtps_psa > /etc/xinetd.d/smtps_psa.$$ mv /etc/xinetd.d/smtps_psa.$$ /etc/xinetd.d/smtps_psa fi %triggerin -- project-gamera g=`grep -c "jgreylist qmail-smtpd" /service/smtpd/run || true` if [ $g -gt 0 ]; then # If already installed. true; # its installed echo "jgreylist exists in smtp/run" else echo "adding jgreylist to smtp/run" sed -e 's/^fixcrio $rbl qmail-smtpd/fixcrio $rbl \/var\/qmail\/bin\/jgreylist qmail-smtpd/' \ /service/smtpd/run > /service/smtpd/run.$$ mv /service/smtpd/run.$$ /service/smtpd/run chmod 0755 /service/smtpd/run fi g=`grep -c "JGREYLIST_DIR" /etc/tcpcontrol/smtp.rules || true` if [ $g -gt 0 ]; then # If already installed. true; # its installed echo "smtp.rules is already up2date\n" else echo "update smtp.rules\n" #sed -e 's/^\:allow,/\:allow,JGREYLIST_DIR="%{_localstatedir}\/qmail\/jgreylist\/,"/' \ sed -e 's/^\:allow,/\:allow,JGREYLIST_DIR="\/var\/qmail\/jgreylist\/",/' \ /etc/tcpcontrol/smtp.rules > /etc/tcpcontrol/smtp.rules.$$ cp -p /etc/tcpcontrol/smtp.rules /etc/tcpcontrol/smtp.rules_old.$$ mv /etc/tcpcontrol/smtp.rules.$$ /etc/tcpcontrol/smtp.rules chmod 0755 /etc/tcpcontrol/smtp.rules /usr/bin/tcprules /etc/tcpcontrol/smtp.cdb /etc/tcpcontrol/smtp.rules.tmp < /etc/tcpcontrol/smtp.rules fi %preun %postun %triggerun -- psa-qmail g=`grep -c "jgreylist /var/qmail/bin/qmail-smtpd" /etc/xinetd.d/smtp_psa || true` if [ $g -gt 0 ]; then # If already installed. sed -e 's/relaylock \/var\/qmail\/bin\/jgreylist \/var/relaylock \/var/' \ /etc/xinetd.d/smtp_psa > /etc/xinetd.d/smtp_psa.$$ mv /etc/xinetd.d/smtp_psa.$$ /etc/xinetd.d/smtp_psa fi g=`grep -c "jgreylist /var/qmail/bin/qmail-smtpd" /etc/xinetd.d/smtps_psa || true` if [ $g -gt 0 ]; then # If already installed. sed -e 's/relaylock \/var\/qmail\/bin\/jgreylist \/var/relaylock \/var/' \ /etc/xinetd.d/smtps_psa > /etc/xinetd.d/smtps_psa.$$ mv /etc/xinetd.d/smtps_psa.$$ /etc/xinetd.d/smtps_psa fi %triggerun -- project-gamera g=`grep -c "jgreylist qmail-smtpd" /service/smtpd/run || true` if [ $g -gt 0 ]; then # If already installed. sed -e 's/^fixcrio $rbl \/var\/qmail\/bin\/jgreylist qmail-smtpd/fixcrio $rbl qmail-smtpd/' \ /service/smtpd/run > /service/smtpd/run.$$ mv /service/smtpd/run.$$ /service/smtpd/run chmod 0755 /service/smtpd/run fi g=`grep -c "JGREYLIST_DIR" /etc/tcpcontrol/smtp.rules || true` if [ $g -gt 0 ]; then # If already installed. echo "updating smtp.rules" sed -e 's/JGREYLIST_DIR=".*",//' /etc/tcpcontrol/smtp.rules > /etc/tcpcontrol/smtp.rules.$$ cp -p /etc/tcpcontrol/smtp.rules /etc/tcpcontrol/smtp.rules_old.$$ mv /etc/tcpcontrol/smtp.rules.$$ /etc/tcpcontrol/smtp.rules chmod 0755 /etc/tcpcontrol/smtp.rules /usr/bin/tcprules /etc/tcpcontrol/smtp.cdb /etc/tcpcontrol/smtp.rules.tmp < /etc/tcpcontrol/smtp.rules fi %files %defattr(0644,root,root,0755) %attr(0755,qmaild,root) %dir %{_localstatedir}/qmail/jgreylist/ #%attr(0755,qmaild,root) %dir %{_localstatedir}/qmail/whitelist/ %attr(0755,root,root) %{_localstatedir}/qmail/bin/jgreylist %changelog * Thu Oct 21 2010 Scott R. Shinn 0.8-1 - initial release