-------- Original-Nachricht --------
> Datum: Fri, 13 Nov 2009 14:12:41 -0700
> Von: "Nathanael D. Noblet" <[email protected]>
> An: [email protected]
> Betreff: Re: [Dspam-user] Dspam delivery failures...

> On 11/13/2009 01:31 PM, Steve wrote:
> >
> > -------- Original-Nachricht --------
> >> Datum: Fri, 13 Nov 2009 13:08:33 -0700
> >> Von: "Nathanael D. Noblet"<[email protected]>
> >> An: [email protected]
> >> Betreff: [Dspam-user] Dspam delivery failures...
> >
> >> Hello,
> >>
> > Hallo Nathanael,
> >
> >
> >>     So in the same vein as some of the postfix issues discussed on the
> >> list recently I've got a question.
> >>
> >>
> >>     When dspam is configured to deliver via lmtp and a socket,
> >> periodically it has issues. When it does this I get a dspam permission
> >> denied error and the mail bounces with the following...
> >>
> >> with status 255: "/usr/bin/dspam". Command output: 3015: [11/11/2009
> >>      18:05:53] Connection to socket /var/lib/imap/socket/lmtp failed:
> >> Permission denied.
> >>
> >> I want a way to configure dspam to *never* bounce mail regardless of
> >> what happens. So either tell postfix to try again somehow, or
> >> *something* so that it queue's it or something.
> >>
> > You lost me here. Who has issues? DSPAM? Postfix? From looking at
> message above I would say that DSPAM has issues sending a mail back to 
> Postfix.
> Right? If that is the case then I can't tell Postfix to retry as Postfix has
> already injected/delivered mail to DSPAM and the mail is no longer in the
> Postfix queue.
> 
> Let me give you an example of how our system is setup to help clear it
> up...
> 
> 
> postfix:25
>    -> content_filter=scan:127.0.0.1:10025 (clamav)
>    -> re-injected via postfix:10026
>    -> delivered to dspam for processing
>    -> delivered to cyrus for delivery to user mailboxes.
> 
> 
> dspam is configured to deliver via LMTP
> 
> DeliveryHost /var/lib/imap/socket/lmtp
> DeliveryIdent postman
> DeliveryProto LMTP
> 
> What happens is that /var/lib/imap/socket/lmtp is accessible only via 
> user cyrus or group mail. dspam runs as its own user 'dspam'. So gets 
> denied access to the lmtp socket. To solve this before I just made the 
> imap/socket directories permissions 777. Which works well till cyrus is 
> updated, I don't catch it, and the permission of that directory return 
> to 750 and dspam is denied access.
> 
> Then what happens is that mail bounces back to postfix since dspam 
> returned exit code 255 and postfix bounces it back to the sender.
> 
> The solution for me was to change my dspam line to now run as 
> user=dspam:mail so it has group access.
> 
> However it still means that it could happen if dspam is misconfigured 
> some way. I don't run a dspam server, it runs the process per delivery, 
> defined in master.cf as follows (it used to be simply user=dspam)
> 
> dspam   unix    -       n       n       -       10      pipe
>    flags=Ru user=dspam:mail argv=/usr/bin/dspam --deliver=innocent,spam 
> --user $user -i f $sender -- $recipient
> 
> 
> So what I'm hoping for is an error code exit that postfix would 
> interpret as, try again later. It seems that this should be possible
> 
Yes. That would be possible. Most MTA's obey the error codes defined in 
sysexits.h:
#define EX_USAGE        64      /* command line usage error */
#define EX_DATAERR      65      /* data format error */
#define EX_NOINPUT      66      /* cannot open input */
#define EX_NOUSER       67      /* addressee unknown */
#define EX_NOHOST       68      /* host name unknown */
#define EX_UNAVAILABLE  69      /* service unavailable */
#define EX_SOFTWARE     70      /* internal software error */
#define EX_OSERR        71      /* system error (e.g., can't fork) */
#define EX_OSFILE       72      /* critical OS file missing */
#define EX_CANTCREAT    73      /* can't create (user) output file */
#define EX_IOERR        74      /* input/output error */
#define EX_TEMPFAIL     75      /* temp failure; user is invited to retry */
#define EX_PROTOCOL     76      /* remote error in protocol */
#define EX_NOPERM       77      /* permission denied */
#define EX_CONFIG       78      /* configuration error */

So to have Postfix (or another MTA) retry we would need to return EX_TEMPFAIL. 
Currently DSPAM returns various error codes but there is no interface exposed 
to the DSPAM operator to influence the codes returned. I could imagine that we 
could add such a capability to DSPAM and allow to control from within 
dspam.conf what to return under what condition.

Some stuff is already inside DSPAM and would only need to be extended. But I 
can tell you now that for DSPAM 3.9.0 this will not happen as we are currently 
in a feature freeze. Might I suggest to you to add a feature request into our 
tracker so that we could consider adding that functionality into DSPAM after 
releasing 3.9.0?


> cut from this link/question
> 
> "Can I safely assume that if my the script that the pipe command for
> the mailbox_transport exits with EX_TEMPFAIL (75), Postfix will keep
> the the message in the queue and retry delivering it at some point?
> And if the script exits with EX_UNAVAILABLE (69), will Postfix bounce
> the message back to the sender (I bounce spam messages after saving it
> as I've read some reports stating that spammers sometimes remove email
> addresses from their lists when they get bounces)?"
> 
> (http://readlist.com/lists/postfix.org/postfix-users/14/71606.html)
> 
> Which makes me think that dspam could return different error codes like 
> if it exited with code 75 instead of 255. Postfix would hold onto it, 
> then try dspam again.
> 
> How does this solve my problem? Well the only thing it solves is that 
> the bounce doesn't go back to the user, and the mail isn't lost. dspam 
> would probably have to get smarter too (syslog entry) or a way to inform 
> an admin of a problem... But first things first. When this happened to 
> use last wednesday ( I missed the cyrus update ). A user lost some 
> important mail and it bounced to the sender. Had it stayed in the 
> postfix queue, it would have sat there and waited for me to fix cyrus 
> instead.
> 
Shame on you! You don't have proper operation instructions. You should follow 
ITIL Release to Production then things like that should (/would) not happen :)

I am making a joke. No one is error free. For such situations I use Monit and 
have a great set of checks enabled and should I mess up something then I get 
very quickly a message from Monit informing me that things are not the way they 
should be.


> I hope that makes more sense.
> 
It makes sense to me. Definitely.

> >
> >
> >> Is that possible? so
> >> that an error like this which is my fault can make it so that users
> mail
> >> doesn't bounce back? If it doesn't have this ability, I'm more than
> >> willing to provide a patch if given a few hints as to where to look at
> >> implementing it. Its been awhile since I've done C programming, but not
> >> that long, and I'd love to get involved a bit more.
> >>
> > The problem is that DSPAM does not have a queue manager. Holding a mail
> back and retrying later means that the mail is staying inside DSPAM's
> current memory and the more mails stay there the more memory is used and soon 
> or
> later the maximum allowed connections to DSPAM will saturate and Postfix
> will not be able to send new mail to DSPAM.
> >
> > Is the deamon behind the socket able to accept messages with other
> transport options? Maybe by SMTP or other ways?
> >
> > Maybe we could implement some kind of retry count with a delay and then
> a fallback to an alternative delivery method and if that fails then raising
> the error we currently do.
> >
> > Or we rewrite DSPAM to have a queue manager and spool messages there?
> 
> I think fallback delivery would be a good solution too. I don't think 
> dspam needs a queue manager. That's not its job, and in the spirit of 
> unix shouldn't do more than what it is supposed to. Classify mail and 
> pass it along. Fallback to some file store would be good too, that way 
> the mail could be delivered manually by injecting it.
> 
> >> Also, is anyone planning on providing fedora packages of dspam?
> >>
> > I had done RPMs for 3.8.0 some while ago. I made them for Tony Earnshaw
> but he did not liked the way things where made inside the RPM. Anyway... I
> still have those SPEC files somewhere around and could port them to 3.9.0
> without big issues.
> 
> If you have the spec file that'd be great, I'll submit it and go through 
> the review process to get in ship shape.
> 
I have found a older version of the spec in my mail. I know that I have 
somewhere a more recent version since I know that I used a SPEC to install 
3.9.0 on a CentOS 5.1 system. But I need to search for it. Here is however the 
old (and probably not super clean) edition:
---------------------------------------
%define real_name               dspam
%define real_version            3.8.0
#%define debug_package          %{nil}
#%define __spec_install_post    %{_libdir}/rpm/brp-compress || :
#%define __os_install_post      %{_libdir}/rpm/brp-compress || :
%define dspam_user              nobody
%define dspam_group             mail
%define dspam_homedir           %{_localstatedir}/lib/dspam
%define dspam_confdir           %{_sysconfdir}
%define dspam_logdir            %{_localstatedir}/log/dspam
%define dspam_mode              2511
%define SINGLE_DRIVER           %([ 
"%{?_with_mysql:1}%{?_with_postgres:1}%{?_with_sqlite:1}%{?_with_sqlite3:1}" == 
"" ] && echo "1" || echo "0")

# use "rpmbuild --with mysql" or "rpm --define '_with_mysql 1'" (for RPM 3.x)
# to build with MySQL support (off by default)
%{?_with_mysql:%define MYSQL_DRIVER 1}
%{!?_with_mysql:%define MYSQL_DRIVER 0}

# use "rpmbuild --with postgres" or "rpm --define '_with_postgres 1'" (for RPM 
3.x)
# to build with PostgreSQL support (off by default)
%{?_with_postgres:%define POSTGRESQL_DRIVER 1}
%{!?_with_postgres:%define POSTGRESQL_DRIVER 0}

# use "rpmbuild --with sqlite3" or "rpm --define '_with_sqlite3 1'" (for RPM 
3.x)
# to build with SQLite3 support (off by default)
%{?_with_sqlite3:%define SQLITE3_DRIVER 1}
%{!?_with_sqlite3:%define SQLITE3_DRIVER 0}

# use "rpmbuild --with sqlite" or "rpm --define '_with_sqlite 1'" (for RPM 3.x)
# to build with SQLite support (off by default)
%{?_with_sqlite:%define SQLITE_DRIVER 1}
%{!?_with_sqlite:%define SQLITE_DRIVER 0}

# use "rpmbuild --with ldap" or "rpm --define '_with_ldap 1'" (for RPM 3.x)
# to build with OpenLDAP_FLAG support (off by default)
%{?_with_ldap:%define LDAP_FLAG 1}
%{!?_with_ldap:%define LDAP_FLAG 0}

# use "rpmbuild --with clamav" or "rpm --define '_with_clamav 1'" (for RPM 3.x)
# to build with SQLite support (off by default)
%{?_with_clamav:%define CLAMAV_FLAG 1}
%{!?_with_clamav:%define CLAMAV_FLAG 0}

# use "rpmbuild --with daemon" or "rpm --define '_with_daemon 1'" (for RPM 3.x)
# to build with daemon support (off by default)
%{?_with_daemon:%define DAEMON_FLAG 1}
%{!?_with_daemon:%define DAEMON_FLAG 0}

# use "rpmbuild --with debug" or "rpm --define '_with_debug 1'" (for RPM 3.x)
# to build with debug support (off by default)
%{?_with_debug:%define DEBUG_FLAG 1}
%{!?_with_debug:%define DEBUG_FLAG 0}

# use "rpmbuild --with verbose_debug" or "rpm --define '_with_verbose_debug 1'" 
(for RPM 3.x)
# to build with verbose debug support (off by default)
%{?_with_verbose_debug:%define VERBOSE_DEBUG_FLAG 1}
%{!?_with_verbose_debug:%define VERBOSE_DEBUG_FLAG 0}

# use "rpmbuild --with bnr_debug" or "rpm --define '_with_bnr_debug 1'" (for 
RPM 3.x)
# to build with BNR debug support (off by default)
%{?_with_bnr_debug:%define BNR_DEBUG_FLAG 1}
%{!?_with_bnr_debug:%define BNR_DEBUG_FLAG 0}

# use "rpmbuild --with large_domain" or "rpm --define '_with_large_domain 1'" 
(for RPM 3.x)
# to build with large domain support (off by default)
%{?_with_large_domain:%define LARGE_DOMAIN_FLAG 1}
%{!?_with_large_domain:%define LARGE_DOMAIN_FLAG 0}

# use "rpmbuild --with user_homedirs" or "rpm --define '_with_user_homedirs 1'" 
(for RPM 3.x)
# to build with user homedirs support (off by default)
%{?_with_user_homedirs:%define USER_HOMEDIRS_FLAG 1}
%{!?_with_user_homedirs:%define USER_HOMEDIRS_FLAG 0}

# use "rpmbuild --with virtual_users" or "rpm --define '_with_virtual_users 1'" 
(for RPM 3.x)
# to build with virtual users support (off by default)
%{?_with_virtual_users:%define VIRTUAL_USERS_FLAG 1}
%{!?_with_virtual_users:%define VIRTUAL_USERS_FLAG 0}

# use "rpmbuild --with syslog" or "rpm --define '_with_syslog 1'" (for RPM 3.x)
# to build with syslog support (off by default)
%{?_with_syslog:%define SYSLOG_FLAG 1}
%{!?_with_syslog:%define SYSLOG_FLAG 0}

Summary:                A library and Mail Delivery Agent for Bayesian spam 
filtering
Name:                   %{real_name}
Version:                %{real_version}
Release:                CVS
License:                GPL
Packager:               Stevan Bajic <[email protected]>
Vendor:                 Sensory Networks
Group:                  System Environment/Daemons
Source0:                dspam-cvs-1198497923.tar.gz
Source1:                dspam-cron
Source2:                dspam-logrotate
Source3:                dspam-init.d
URL:                    http://www.nuclearelephant.com/projects/dspam/
Provides:               %{real_name} = %{version}-%{release}
Obsoletes:              %{real_name} <= %{version}-%{release}
BuildRequires:          autoconf >= 2.5
BuildRequires:          automake >= 1.7
BuildRequires:          libtool
%if %{MYSQL_DRIVER}
BuildRequires:          mysql-devel
%endif
%if %{POSTGRESQL_DRIVER}
BuildRequires:          postgresql-devel
%endif
%if %{SQLITE_DRIVER}
BuildRequires:          sqlite-devel < 3.0
%endif
%if %{SQLITE3_DRIVER}
BuildRequires:          sqlite-devel >= 3.0
%endif
%if %{LDAP_FLAG}
BuildRequires:          openldap-devel
%endif
Requires:               gcc
Requires:               sed
Requires:               perl
Requires:               rpm
Requires(post):         /sbin/chkconfig
Requires(preun):        /sbin/service
Requires(preun):        /sbin/chkconfig
Requires(postun):       /sbin/service
Buildroot:              %{_tmppath}/%{name}-%{version}-root


%description
The DSPAM agent masquerades as the email server's local delivery
agent and filters/learns spams using an advanced Bayesian
statistical approach (based on Baye's theorem of combined
probabilities) which provides an administratively
maintenance-free, easy-learning Anti-Spam service custom tailored
to each individual user's behavior. Advanced because on top of
standard Bayesian filtering is also incorporated the use of
Chained Tokens, de-obfuscation, and other enhancements. DSPAM
works great with Sendmail and Exim, and should work well with
any other MTA that supports an external local delivery agent
(postfix, qmail, etc.)


%if %{MYSQL_DRIVER}
%package -n     %{real_name}-mysql_drv
Summary:        MySQL driver for %{real_name}
Group:          Applications/Internet
Requires:       %{real_name} = %{version}-%{release}
Requires:       mysql
Provides:       %{real_name}-mysql_drv = %{version}-%{release}
Obsoletes:      %{real_name}-mysql_drv <= %{version}-%{release}


%description -n %{real_name}-mysql_drv
MySQL driver for DSPAM.
%endif


%if %{POSTGRESQL_DRIVER}
%package -n     %{real_name}-pgsql_drv
Summary:        PostgreSQL driver for %{real_name}
Group:          Applications/Internet
Requires:       %{real_name} = %{version}-%{release}
Requires:       postgresql
Provides:       %{real_name}-pgsql_drv = %{version}-%{release}
Obsoletes:      %{real_name}-pgsql_drv <= %{version}-%{release}


%description -n %{real_name}-pgsql_drv
PostgreSQL driver for DSPAM.
%endif


%if %{SQLITE3_DRIVER}
%package -n     %{real_name}-sqlite3_drv
Summary:        SQLite v3.x driver for %{real_name}
Group:          Applications/Internet
Requires:       %{real_name} = %{version}-%{release}
Requires:       sqlite >= 3.0
Provides:       %{real_name}-sqlite3_drv = %{version}-%{release}
Obsoletes:      %{real_name}-sqlite3_drv <= %{version}-%{release}


%description -n %{real_name}-sqlite3_drv
SQLite v3.x driver for DSPAM.
%endif


%if %{SQLITE_DRIVER}
%package -n     %{real_name}-sqlite_drv
Summary:        SQLite v2.x driver for %{real_name}
Group:          Applications/Internet
Requires:       %{real_name} = %{version}-%{release}
Requires:       sqlite < 3.0
Provides:       %{real_name}-sqlite_drv = %{version}-%{release}
Obsoletes:      %{real_name}-sqlite_drv <= %{version}-%{release}


%description -n %{real_name}-sqlite_drv
SQLite v2.x driver for DSPAM.
%endif


%package -n     %{real_name}-devel
Summary:        Development library and header files for the %{real_name} 
library
Group:          Development/C
Requires:       %{real_name} = %{version}-%{release}
Provides:       %{real_name}-devel = %{version}-%{release}
Obsoletes:      %{real_name}-devel <= %{version}-%{release}


%description -n %{real_name}-devel
DSPAM has had its core engine moved into a separate library,
libdspam. This library can be used by developers to provide
'drop-in' spam filtering for their mail client applications,
other anti-spam tools, or similar projects.


%package -n     %{real_name}-web
Summary:        Web-based interface for %{real_name}
Group:          Applications/Internet
Requires:       %{real_name} = %{version}-%{release}
Requires:       perl
Requires:       webserver
Requires:       perl(CGI)
Requires:       perl-GD >= 2.0
Requires:       perl-GD-Graph3d >= 2.0
Requires:       perl-GDGraph
Provides:       %{real_name}-web = %{version}-%{release}
Obsoletes:      %{real_name}-web <= %{version}-%{release}


%description -n %{real_name}-web
Web-based interface for DSPAM's powerful anti-spam engine.


%prep


%setup -q -n %{name}


%build
#export WANT_AUTOCONF_2_5=1
aclocal -I m4
sh ./autogen.sh
autoheader
automake --add-missing
autoconf
umask 022


%configure \
        --enable-long-usernames \
%if %{SYSLOG_FLAG}
        --enable-syslog \
%else
        --disable-syslog \
%endif
%if %{LARGE_DOMAIN_FLAG}
        --enable-large-scale \
        --disable-domain-scale \
%else
        --enable-domain-scale \
        --disable-large-scale \
%endif
%if %{USER_HOMEDIRS_FLAG}
        --enable-homedir \
%else
        --disable-homedir \
%endif
%if %{VIRTUAL_USERS_FLAG}
        %if %{MYSQL_DRIVER}
                --enable-virtual-users \
        %endif
        %if %{POSTGRESQL_DRIVER}
                --enable-virtual-users \
        %endif
%endif
%if %{MYSQL_DRIVER}
        --enable-preferences-extension \
        --with-mysql-includes='%{_includedir}/mysql' \
        --with-mysql-libraries='%{_libdir}/mysql' \
%endif
%if %{POSTGRESQL_DRIVER}
        --enable-preferences-extension \
        --with-pgsql-includes='%{_includedir}/pgsql' \
        --with-pgsql-libraries='%{_libdir}' \
%endif
%if %{DAEMON_FLAG}
        --enable-daemon \
%else
        --disable-daemon \
%endif
%if %{LDAP_FLAG}
        --enable-ldap \
%else
        --disable-ldap \
%endif
%if %{CLAMAV_FLAG}
        --enable-clamav \
%else
        --disable-clamav \
%endif
%if %{DEBUG_FLAG}
        --enable-debug \
%else
        --disable-debug \
%endif
%if %{VERBOSE_DEBUG_FLAG}
        --enable-verbose-debug \
%else
        --disable-verbose-debug \
%endif
%if %{BNR_DEBUG_FLAG}
        --enable-bnr-debug \
%else
        --disable-bnr-debug \
%endif
        
--with-storage-driver='hash_drv%{?_with_mysql:,mysql_drv}%{?_with_postgres:,pgsql_drv}%{?_with_sqlite:,sqlite_drv}%{?_with_sqlite3:,sqlite3_drv}'
 \
        --with-dspam-home='%{dspam_homedir}' \
        --sysconfdir='%{dspam_confdir}' \
        --with-dspam-owner='%{dspam_user}' \
        --with-dspam-group='%{dspam_group}' \
        --with-dspam-home-group='%{dspam_group}' \
        --with-dspam-mode='%{dspam_mode}' \
        --with-logdir='%{dspam_logdir}'

%{__make} %{?_smp_mflags} OPTIMIZE="%{optflags} -fPIC -DPIC"


%install
[ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf $RPM_BUILD_ROOT
%{__make} DESTDIR=$RPM_BUILD_ROOT install
#%{__make} DESTDIR=$RPM_BUILD_ROOT install-strip

## make some dirs
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_includedir}/dspam/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{dspam_homedir}/opt-in/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{dspam_homedir}/opt-out/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{dspam_homedir}/txt/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{dspam_logdir}/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_var}/run/dspam/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_libdir}/dspam/
%{__install} -d -p -m 755 $RPM_BUILD_ROOT%{_usr}/share/%{name}-webui/templates/

## storage related configuration and scripts
%if %{MYSQL_DRIVER}
        %{__install} -m 644 src/tools.mysql_drv/mysql_objects-space.sql \
                
$RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/mysql_objects-space.sql
        %{__install} -m 644 src/tools.mysql_drv/mysql_objects-speed.sql \
                
$RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/mysql_objects-speed.sql
        %{__install} -m 644 src/tools.mysql_drv/mysql_objects-4.1.sql \
                
$RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/mysql_objects-4.1.sql
        %{__install} -m 644 src/tools.mysql_drv/purge.sql \
                $RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/mysql_purge.sql
        %{__install} -m 644 src/tools.mysql_drv/purge-4.1.sql \
                $RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/mysql_purge-4.1.sql
        %if %{VIRTUAL_USERS_FLAG}
                %{__install} -m 644 src/tools.mysql_drv/virtual_users.sql \
                        
$RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/mysql_virtual_users.sql
                %{__install} -m 644 
src/tools.mysql_drv/virtual_user_aliases.sql \
                        
$RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/mysql_virtual_user_aliases.sql
        %endif
%endif
%if %{POSTGRESQL_DRIVER}
        %{__install} -m 644 src/tools.pgsql_drv/pgsql_objects.sql \
                $RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/pgsql_objects.sql
        %{__install} -m 644 src/tools.pgsql_drv/purge.sql \
                $RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/pgsql_purge.sql
        %if %{VIRTUAL_USERS_FLAG}
                %{__install} -m 644 src/tools.pgsql_drv/virtual_users.sql \
                        
$RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/pgsql_virtual_users.sql
        %endif
%endif
%if %{SQLITE_DRIVER}
        %{__install} -m 644 src/tools.sqlite_drv/purge-2.sql \
                $RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/sqlite2_purge.sql
%endif
%if %{SQLITE3_DRIVER}
        %{__install} -m 644 src/tools.sqlite_drv/purge-3.sql \
                $RPM_BUILD_ROOT%{dspam_homedir}/sql-scripts/sqlite3_purge.sql
%endif

## install text notifications
echo "Scanned and tagged as SPAM with DSPAM ${real_version} by Your ISP.com"> \
        $RPM_BUILD_ROOT%{dspam_homedir}/txt/msgtag.spam
echo "Scanned and tagged as non-SPAM with DSPAM ${real_version} by Your 
ISP.com"> \
        $RPM_BUILD_ROOT%{dspam_homedir}/txt/msgtag.nonspam
%{__install} -m 644 txt/*.txt \
        $RPM_BUILD_ROOT%{dspam_homedir}/txt/

## install cron script
%{__install} -m 755 %{SOURCE1} \
        $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{real_name}.cron

## install logrotate script
%{__install} -m 644 %{SOURCE2} \
        $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{real_name}.logrotate
# install init.d script
%{__install} -Dp -m0755 %{SOURCE3} \
        $RPM_BUILD_ROOT%{_initrddir}/dspam

## install devel files
%{__install} -m 0644 src/*.h \
        $RPM_BUILD_ROOT%{_includedir}/dspam/

## when only one storage driver is compiled, it is linked statically with DSPAM
%if %{SINGLE_DRIVER}
        %{__sed} -i -e "s:^[\t ]\(StorageDriver[\t 
]\{1,99\}%{_libdir}\)\(lib[a-z3]*_drv.*\)$:\1dspam/\2:" \
                src/dspam.conf
%else
        %{__sed} -i -e "s:^[\t ]\(StorageDriver[\t ]\{1,99\}.*\)$:# \1:" \
                src/dspam.conf
%endif

## fix perms
%{__chmod} %{dspam_mode} $RPM_BUILD_ROOT%{_bindir}/dspamc

## install additional copy of dspam.conf as reference
%{__install} -m0644 src/dspam.conf \
        $RPM_BUILD_ROOT%{dspam_confdir}/dspam.conf.default

# install web-ui
%{__install} -Dp -m0644 webui/htdocs/*.{css,gif} \
        $RPM_BUILD_ROOT%{_usr}/share/%{name}-webui/
%{__install} -Dp -m0644 webui/cgi-bin/templates/*.html \
        $RPM_BUILD_ROOT%{_usr}/share/%{name}-webui/templates
%{__install} -Dp -m0644 
webui/cgi-bin/{admins,configure.pl,default.prefs,rgb.txt,*.cgi} \
        $RPM_BUILD_ROOT%{_usr}/share/%{name}-webui/
%{__cat} << EOF > $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/dspam-web-ui.conf
#
# Web-UI for DSPAM.
#
Alias /dspam %{_usr}/share/%{name}-webui
ScriptAlias /dspam %{_usr}/share/%{name}-webui
<Directory "%{_usr}/share/%{name}-webui">
        DirectoryIndex  dspam.cgi
        AllowOverride   None
        Options         -Indexes +ExecCGI
        Order           allow,deny
        Allow           from all
        AuthType        Basic
        AuthName        "DSPAM LOGIN"
        Require         valid-user
        ## Apache 2.2.x
        #AuthFileName   /path/to/dspam-htpasswd
        ## Apache 2.0.x
        #AuthUserFile   /path/to/dspam-htpasswd
</Directory>
EOF


%post
/sbin/chkconfig --add %{name}
source %{_sysconfdir}/profile
/sbin/ldconfig


%preun
if [ $1 -eq 0 ]; then
        /sbin/service %{name} stop &>/dev/null || :
        /sbin/chkconfig --del %{name}
        /sbin/ldconfig
        source %{_sysconfdir}/profile
fi


%postun
if [ $1 -ge 1 ]; then
        /sbin/service %{name} restart &>/dev/null || :
fi


%clean
#[ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root)
%doc %attr(0644,root,root) CHANGELOG README* RELEASE.NOTES UPGRADING
%doc %attr(0644,root,root) doc/*.txt
%dir %{dspam_homedir}
%dir %{dspam_homedir}/opt-in
%dir %{dspam_homedir}/opt-out
%dir %{dspam_homedir}/txt
%dir %{dspam_logdir}
%dir %{_var}/run/dspam
%attr(0755,root,root) %config(noreplace) 
%{_sysconfdir}/cron.daily/%{real_name}.cron
%attr(0644,root,root) %config(noreplace) 
%{_sysconfdir}/logrotate.d/%{real_name}.logrotate
%attr(0640,%{dspam_user},%{dspam_group}) %config(noreplace) 
%{dspam_confdir}/dspam.conf
%attr(0644,root,%{dspam_group}) %config(noreplace) 
%{dspam_confdir}/dspam.conf.default
%attr(0644,root,root) %config(noreplace) %{dspam_homedir}/txt/*
#%attr(0755,root,root) %{_initrddir}/dspam
%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/dspam
%attr(0644,root,root) %{_mandir}/man1/*
%{_bindir}/*
%if ! %{SINGLE_DRIVER}
%dir %{_libdir}/dspam
%{_libdir}/libdspam.*
%{_libdir}/dspam/libhash_drv*
%endif


%if %{MYSQL_DRIVER}
%files -n %{real_name}-mysql_drv
%defattr(-,root,root)
%dir %{_libdir}/dspam
%{_libdir}/dspam/libmysql_drv*
%dir %attr(0755,root,root) %{dspam_homedir}/sql-scripts
%attr(0644,root,root) %config(noreplace) %{dspam_homedir}/sql-scripts/mysql_*
%endif


%if %{POSTGRESQL_DRIVER}
%files -n %{real_name}-pgsql_drv
%defattr(-,root,root)
%dir %{_libdir}/dspam
%{_libdir}/dspam/libpgsql_drv*
%dir %attr(0755,root,root) %{dspam_homedir}/sql-scripts
%attr(0644,root,root) %config(noreplace) %{dspam_homedir}/sql-scripts/pgsql_*
%endif


%if %{SQLITE3_DRIVER}
%files -n %{real_name}-sqlite3_drv
%defattr(-,root,root)
%dir %{_libdir}/dspam
%attr(0755,root,root) %{_libdir}/dspam/libsqlite3_drv*
%dir %attr(0755,root,root) %{dspam_homedir}/sql-scripts
%attr(0644,root,root) %config(noreplace) %{dspam_homedir}/sql-scripts/sqlite3_*
%endif


%if %{SQLITE_DRIVER}
%files -n %{real_name}-sqlite_drv
%defattr(-,root,root)
%dir %{_libdir}/dspam
%{_libdir}/dspam/libsqlite_drv*
%dir %attr(0755,root,root) %{dspam_homedir}/sql-scripts
%attr(0644,root,root) %config(noreplace) %{dspam_homedir}/sql-scripts/sqlite2_*
%endif


%files -n %{real_name}-devel
%defattr(-,root,root)
%doc src/example.c
%dir %{_includedir}/dspam
%{_includedir}/dspam/*
%attr(0644,root,root) %{_libdir}/pkgconfig/dspam.pc
%attr(0644,root,root) %{_mandir}/man3/*


%files -n %{real_name}-web
%dir %attr(0755,root,root) %{_usr}/share/%{name}-webui
%attr(0644,root,root) %{_usr}/share/%{name}-webui/*
%attr(0644,root,root) %config(noreplace) 
%{_sysconfdir}/httpd/conf.d/dspam-web-ui.conf


%changelog
* Wed Dec 26 2007 Stevan Bajic <[email protected]>
- Avoid using the %exclude macro as it looks like
  FC6 does not like this command.

* Sun Dec 23 2007 Stevan Bajic <[email protected]>
- Make Tony Earnshaw happy :)

* Sat Dec 22 2007 Stevan Bajic <[email protected]>
- Added newest Gentoo patch set

* Tue Apr 17 2007 Stevan Bajic <[email protected]>
- Initial relase
---------------------------------------


If you need files referenced in this SPEC file then let me know. Some of the 
files referenced are already included in DSPAM 3.9.0.



> >> If not,
> >> I'd like to volunteer to submit them to the fedora community and become
> >> the packager for fedora.
> >>
> > GREAT! That would be super if you could do that.
> 
> >> One more thing, I'm glad the project hasn't died and people have taken
> >> it up. Really excited about that. So although I know no one in the new
> >> project I'm excited to get involved again.
> >>
> > Should you ever make a trip to my country then you can have a coffee
> with me at any time :)
> 
> What country?
> 
Confoederatio Helvetica -> Switzerland


Steve
-- 
DSL-Preisknaller: DSL Komplettpakete von GMX schon für 
16,99 Euro mtl.!* Hier klicken: http://portal.gmx.net/de/go/dsl02

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Dspam-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspam-user

Reply via email to