diff --git a/.cvsignore b/.cvsignore index e69de29..48b729a 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +sqlgrey-1.7.4.tar.bz2 diff --git a/sources b/sources index e69de29..acdc407 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +b84931d638c3527e2dabc26ad6754bc0 sqlgrey-1.7.4.tar.bz2 diff --git a/sqlgrey-1.7.4-sqlite.patch b/sqlgrey-1.7.4-sqlite.patch new file mode 100644 index 0000000..1799f10 --- /dev/null +++ b/sqlgrey-1.7.4-sqlite.patch @@ -0,0 +1,12 @@ +--- sqlgrey-1.7.4/etc/sqlgrey.conf.orig 2006-05-28 09:32:59.000000000 -0500 ++++ sqlgrey-1.7.4/etc/sqlgrey.conf 2006-12-12 14:58:38.000000000 -0600 +@@ -119,7 +119,9 @@ + # instead of Pg below use "mysql" for MySQL, "SQLite" for SQLite + # any DBD driver is allowed, but only the previous 3 have been tested + # db_type = Pg ++db_type = SQLite + # db_name = sqlgrey ++db_name = sqlgrey.db + # Note: the following are not used with SQLite + # db_host = localhost + # db_port = default diff --git a/sqlgrey-1.7.4-warnings.patch b/sqlgrey-1.7.4-warnings.patch new file mode 100644 index 0000000..2cab869 --- /dev/null +++ b/sqlgrey-1.7.4-warnings.patch @@ -0,0 +1,18 @@ +--- sqlgrey-1.7.4/sqlgrey.orig 2006-08-02 21:33:43.000000000 -0500 ++++ sqlgrey-1.7.4/sqlgrey 2006-12-12 15:13:07.000000000 -0600 +@@ -815,6 +815,7 @@ + $self->mylog('dbaccess', 3, "Read_hosts: ".join(', ', @read_hosts)); + + #Setting up cluster db's ++ no warnings 'once'; + $DBIx::DBCluster::CLUSTERS = { + "$self->{sqlgrey}{db_host}" => { + 'WRITE_HOSTS' => [$self->{sqlgrey}{db_host}], +@@ -2410,6 +2411,7 @@ + no warnings 'uninitialized'; #Perl will spew warn's if running DBI only + if ($dflt{db_cluster} eq 'on') { + #if loglevel >= 4, enable debugging for DBCluster ++ no warnings 'once'; + $DBIx::DBCluster::DEBUG = ($dflt{'loglevel'}>3)?1:0; + + if ((defined $HOSTNAME) && (defined $dflt{db_cleanup_hostname})) { diff --git a/sqlgrey.init b/sqlgrey.init new file mode 100644 index 0000000..1703cc0 --- /dev/null +++ b/sqlgrey.init @@ -0,0 +1,70 @@ +#!/bin/sh +# +# sqlgrey: Init script for sqlgrey postfix policy service +# +# chkconfig: - 79 31 +# description: SQLgrey is a postfix grey-listing policy service. +# pidfile: /var/run/sqlgrey.pid + +# Source function library. +. /etc/init.d/functions + +RETVAL=0 + +start() { + echo -n $"Starting SQLgrey: " + # SQLite put files in the working directory + cd ~sqlgrey || RETVAL=1 + [ $RETVAL -eq 0 ] && { daemon sqlgrey -d; RETVAL=$?; }; + [ $RETVAL -eq 0 ] && { touch /var/lock/subsys/sqlgrey; RETVAL=$?; }; + [ $RETVAL -eq 0 ] && echo_success || echo_failure + echo +} + +stop() { + echo -n $"Shutting down SQLgrey: " + sqlgrey -k || RETVAL=1 + [ $RETVAL -eq 0 ] && { rm -f /var/lock/subsys/sqlgrey; RETVAL=$?; }; + [ $RETVAL -eq 0 ] && echo_success || echo_failure + echo +} + +restart() { + stop + sleep 1 # hack: missing REUSEADDR from Net::Server? + start +} + +# See how we were called. +case "$1" in + start) + start + ;; + + stop) + stop + ;; + + status) + status sqlgrey + ;; + + reload) + restart + ;; + + restart) + restart + ;; + + condrestart) + [ -f /var/lock/subsys/sqlgrey ] && restart || : + ;; + + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart}" + exit 1 +esac + +exit $RETVAL + diff --git a/sqlgrey.spec b/sqlgrey.spec new file mode 100644 index 0000000..e32d2a4 --- /dev/null +++ b/sqlgrey.spec @@ -0,0 +1,335 @@ +Name: sqlgrey +Version: 1.7.4 +Release: 5%{?dist} +Summary: Postfix grey-listing policy service +Group: System Environment/Daemons +License: GPL +URL: http://sqlgrey.sourceforge.net/ +Source0: http://dl.sourceforge.net/sqlgrey/sqlgrey-%{version}.tar.bz2 +Source1: sqlgrey.init +Patch0: sqlgrey-1.7.4-sqlite.patch +Patch1: sqlgrey-1.7.4-warnings.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch + +Requires: postfix +Requires: perl(DBD::SQLite) +Requires(post): /sbin/chkconfig +Requires(post): /sbin/service +Requires(preun): /sbin/chkconfig +Requires(preun): /sbin/service +Requires(postun): /sbin/service +Requires(postun): fedora-usermgmt +Requires(pre): fedora-usermgmt + +%description +SQLgrey is a Postfix grey-listing policy service with auto-white-listing +written in Perl with SQL database as storage backend. Greylisting stops 50 +to 90% of junk mails (spam and virus) before they reach your Postfix server +(saves BW, user time and CPU time). + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 + +%build +make + +%install +rm -rf $RPM_BUILD_ROOT +make rh-install ROOTDIR=$RPM_BUILD_ROOT +install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/sqlgrey +mkdir -p -m 755 $RPM_BUILD_ROOT%{_var}/lib +mkdir -m 750 $RPM_BUILD_ROOT%{_var}/lib/sqlgrey +touch $RPM_BUILD_ROOT%{_var}/lib/sqlgrey/sqlgrey.db + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc Changelog CONTRIB COPYING FAQ HOWTO README* TODO +%{_sysconfdir}/init.d/sqlgrey +%{_sbindir}/sqlgrey +%{_sbindir}/update_sqlgrey_config +%{_bindir}/sqlgrey-logstats.pl +%{_mandir}/man1/sqlgrey.1* +%attr(-,sqlgrey,sqlgrey) %dir %{_var}/lib/sqlgrey +%attr(-,sqlgrey,sqlgrey) %ghost %{_var}/lib/sqlgrey/sqlgrey.db +%dir %{_sysconfdir}/sqlgrey +%config(noreplace) %{_sysconfdir}/sqlgrey/sqlgrey.conf +# Content of these files are changed by sqlgrey itself +%config(noreplace) %{_sysconfdir}/sqlgrey/clients_ip_whitelist +%config(noreplace) %{_sysconfdir}/sqlgrey/clients_fqdn_whitelist +%config(noreplace) %{_sysconfdir}/sqlgrey/*.regexp +# Warning admins to not touch the above files +%attr(644,root,root) %config %{_sysconfdir}/sqlgrey/README + +%pre +/usr/sbin/fedora-groupadd 26 -r sqlgrey &>/dev/null || : +/usr/sbin/fedora-useradd 26 -r -s /sbin/nologin -d /var/lib/sqlgrey -M \ + -c 'SQLgrey Server' -g sqlgrey sqlgrey &>/dev/null || : + +%post +/sbin/chkconfig --add sqlgrey || : +/sbin/service sqlgrey condrestart || : + +%preun +if [ "$1" -eq 0 ]; then + /sbin/service sqlgrey stop || : + /sbin/chkconfig --del sqlgrey || : +fi + +%postun +if [ "$1" -eq 0 ]; then + /usr/sbin/fedora-userdel sqlgrey &>/dev/null || : + /usr/sbin/fedora-groupdel sqlgrey &>/dev/null || : +fi + +%changelog +* Thu Dec 14 2006 Steven Pritchard 1.7.4-5 +- Add missing echos to init script + +* Wed Dec 13 2006 Steven Pritchard 1.7.4-4 +- Add more docs + +* Tue Dec 12 2006 Steven Pritchard 1.7.4-3 +- Change default database to SQLite +- Require DBD::SQLite +- Own (ghost) SQLite db file +- Clean up post/postun scripts a bit +- Quiet bogus variable used once warnings + +* Tue Aug 29 2006 Steven Pritchard 1.7.4-2 +- Change home directory to /var/lib/sqlgrey and create it +- Include our own init script +- Explicitly require postfix +- Drop inconsistent name macro usage + +* Tue Aug 29 2006 Steven Pritchard 1.7.4-1 +- Update to 1.7.4 +- Own _sysconfdir/sqlgrey and all .regexp files in it +- Handle the service in post/preun/postun scripts +- Random spec cleanup + +* Mon Apr 17 2006 Warren Togami 1.7.3-2 +- Convert to fedora-usermgmt +- Spec cleanup to Fedora guidelines + +* Wed Nov 16 2005 Lionel Bouton +- 1.7.3 release +- fixes for a crash with '*' in email adresses + +* Tue Oct 25 2005 Lionel Bouton +- 1.7.2 release +- fixes for several errors in logging +- clean_method ported from 1.6.x + +* Thu Sep 15 2005 Lionel Bouton +- 1.7.1 release +- fix for race condition in multiple instances configurations +- fix for weekly stats + +* Tue Jun 21 2005 Lionel Bouton +- 1.7.0 release +- now continue if the DB isn't available at startup time +- based on 1.6.0 with Michel Bouissou's work: + . better connect cleanup when creating AWL entries + . source IP throttling + +* Thu Jun 16 2005 Lionel Bouton +- 1.6.0 release +- fix for alternate conf_dir +- fix for timestamp handling in log parser +- log parser cleanup +- added README.PERF and documentation cleanup + +* Tue Jun 07 2005 Lionel Bouton +- 1.5.9 release +- fix for MySQL's mishandling of timestamps +- better log parser + +* Thu Jun 02 2005 Lionel Bouton +- 1.5.8 release +- fix for Makefile: rpmbuild didn't work + +* Wed Jun 01 2005 Lionel Bouton +- 1.5.7 release +- fix for a memory leak +- config directory now user-configurable +- preliminary log analyser + +* Mon May 02 2005 Lionel Bouton +- 1.5.6 release +- fix for MySQL disconnection crash +- IPv6 support +- Optin/optout support + +* Tue Apr 25 2005 Lionel Bouton +- 1.5.5 release +- small fix for SRS (again!) +- small fix for deverp code +- log types + +* Tue Mar 15 2005 Lionel Bouton +- 1.5.4 release +- fix for regexp compilation (regexp in fqdn_whitelists didn't work) + +* Sat Mar 05 2005 Lionel Bouton +- 1.5.3 release +- the cleanup is now done in a separate process to avoid stalling the service + +* Thu Mar 03 2005 Lionel Bouton +- 1.5.2 release +- optimize SQL queries by avoiding some now() function calls + +* Wed Mar 02 2005 Lionel Bouton +- 1.5.1 release +- replaced smart algorithm with Michel Bouissou's one + +* Wed Feb 23 2005 Lionel Bouton +- 1.5.0 release +- drop support for obsolete command-line parameters +- migrate databases to a new layout : + . first_seen added to the AWLs + . optimize AWL Primary Keys + . add indexes + +* Mon Feb 21 2005 Lionel Bouton +- 1.4.8 release +- AWL performance bugfix +- bad handling of database init errors fixed + +* Fri Feb 18 2005 Lionel Bouton +- 1.4.7 release +- MAIL FROM: <> bugfix + +* Fri Feb 18 2005 Lionel Bouton +- 1.4.6 release +- update_sqlgrey_whitelists fix +- removed superfluous regexp in deVERP code + +* Thu Feb 17 2005 Lionel Bouton +- 1.4.5 release +- update_sqlgrey_whitelists temporary directory fixes from Michel Bouissou +- return code configurable patch from Michel Bouissou +- VERP and SRS tuning, with input from Michel Bouissou +- VERP and SRS normalisation is used only in the AWLs + +* Mon Feb 14 2005 Lionel Bouton +- 1.4.4 release +- Autowhitelists understand SRS +- more VERP support for autowhitelists +- SQLgrey can warn by mail when the database is unavailable +- update_sqlgrey_whitelists doesn't rely on mktemp's '-t' parameter anymore. + +* Sun Feb 06 2005 Lionel Bouton +- 1.4.3 release +- log to stdout when not in daemon mode +- added update_sqlgrey_whitelists script + whitelists can now be fetched from repositories + +* Thu Jan 13 2005 Lionel Bouton +- 1.4.2 release +- Better cleanup logging from Rene Joergensen +- Fix for Syslog.pm error messages at init time +- Fix doc packaging in RPM + +* Tue Jan 11 2005 Lionel Bouton +- 1.4.1 release +- fix for invalid group id messages from Øystein Viggen +- allow reloading whitelists with SIGUSR1 +- db_maintdelay user-configurable +- don't log pid anymore + +* Fri Dec 10 2004 Lionel Bouton +- 1.4.0 release +- windows for SQL injection fix (reported by Øystein Viggen) +- spec file tuning inspired by Derek Battams + +* Tue Nov 30 2004 Lionel Bouton +- 1.3.6 release +- whitelist for FQDN as well as IP +- 3 different greylisting algorithms + (RFE from Derek Battams) + +* Mon Nov 22 2004 Lionel Bouton +- 1.3.4 release +- ip whitelisting + +* Mon Nov 22 2004 Lionel Bouton +- 1.3.3 release +- preliminary whitelist support + +* Wed Nov 17 2004 Lionel Bouton +- 1.3.2 release +- RPM packaging fixed +- DB connection pbs don't crash SQLgrey anymore + +* Thu Nov 11 2004 Lionel Bouton +- 1.3.0 release +- Database schema slightly changed, +- Automatic database schema upgrade framework + +* Sun Nov 07 2004 Lionel Bouton +- 1.2.0 release +- SQL code injection protection +- better DBI error reporting +- better VERP support +- small log related typo fix +- code cleanups + +* Mon Oct 11 2004 Lionel Bouton +- 1.1.2 release +- pidfile handling code bugfix + +* Mon Sep 27 2004 Lionel Bouton +- 1.1.1 release +- MySQL-related SQL syntax bugfix + +* Tue Sep 21 2004 Lionel Bouton +- 1.1.0 release +- SQLite support (RFE from Klaus Alexander Seistrup) + +* Tue Sep 14 2004 Lionel Bouton +- 1.0.1 release +- man page cleanup + +* Tue Sep 07 2004 Lionel Bouton +- pushed default max-age from 12 to 24 hours + +* Sat Aug 07 2004 Lionel Bouton +- bug fix for space trimming values from database + +* Tue Aug 03 2004 Lionel Bouton +- trim spaces before logging possible spams +- v1.0 added license reference at the top + at savannah request + +* Fri Jul 30 2004 Lionel Bouton +- Bugfix: couldn't match on undefined sender +- debug code added + +* Fri Jul 30 2004 Lionel Bouton +- Removed NetAddr::IP dependency at savannah request + +* Sat Jul 17 2004 Lionel Bouton +- Default max-age pushed to 12 hours instead of 5 + (witnessed more than 6 hours for a mailing-list subscription + system) + +* Fri Jul 02 2004 Lionel Bouton +- Documentation + +* Thu Jul 01 2004 Lionel Bouton +- PostgreSQL support added + +* Tue Jun 29 2004 Lionel Bouton +- various cleanups and bug hunting + +* Mon Jun 28 2004 Lionel Bouton +- 2-level AWL support + +* Sun Jun 27 2004 Lionel Bouton +- Initial Version, replaced BDB by mysql in postgrey