<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>193081</bug_id>
          
          <creation_ts>2007-09-19 16:15 0000</creation_ts>
          <short_desc>mail-filter/dspam: Database setup should not be fixed to &apos;localhost&apos; as the database server</short_desc>
          <delta_ts>2007-09-30 17:09:06 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>bugs.gentoo.org@meisel.cc</reporter>
          <assigned_to>mrness@gentoo.org</assigned_to>
          

      

      
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-19 16:15:42 0000</bug_when>
            <thetext>The current installation mechanism of dspam with SQL database backends depends on the assumption that every database engine runs locally on the mail server. While this assumption is true for small installations using berkeley db, sqlite (and so on) large scale installations have a separate database server &apos;somewhere&apos; in the network.

The current dspam package installation process should be separated into two stages:
Stage 1: Install of the package as it is (which means every necessary file including the (by use flag) preselected database connectors.
Stage 2: Using the command &quot;emerge --config =dspam-3.x.x&quot; which triggers the execution of the pkg_config() section in the ebuild. This should do the finishing touches depending on the database backend setting the admin/installer did in the dspam.conf configuration file (selecting database backends, setting connection credentials and passwords)

This method has the following advantages:
1. The admin can use more than one database backend
2. Remote database backend installations are possible
3. The installation part of dspam is separate from the initialization part (which can be done more than once for different DB set-ups)


Reproducible: Always

Steps to Reproduce:</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jer@gentoo.org</who>
            <bug_when>2007-09-19 16:39:41 0000</bug_when>
            <thetext>

*** This bug has been marked as a duplicate of bug 193073 ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-09-19 18:52:35 0000</bug_when>
            <thetext>You&apos;re right, this isn&apos;t a duplicate, but it is very close to being marked as invalid.

The emerge --config phase is meant to configure a fresh installed instance of the package, therefore it shouldn&apos;t rely on data found in dspam.conf. That being said, I admit the current pkg_config is less than perfect because it relies on those pesky *.data files created on installation. 

&gt; This method has the following advantages:
&gt; 1. The admin can use more than one database backend

Don&apos;t see the point, but the current form supports multiple backends also, only you have to run emerge --config twice if you wanna configure mysql and postgres backends on the same box. 

&gt; 2. Remote database backend installations are possible

As opposed to what we have now? Just modify the *.data file and dspam.conf before running emerge --config and you will be able to configure the database on another server.
 
&gt; 3. The installation part of dspam is separate from the initialization part
&gt; (which can be done more than once for different DB set-ups)

Still don&apos;t see the advantage. AFAIK dspam cannot use multiple backends at the same time and having multiple dspam configurations on the same machine is totally pointless.

If you want an improved pkg_config (one who wouldn&apos;t rely on current content of the dspam.conf and remove the need of having *.data files) just propose a patch. I would like a pkg_config who read database parameters from dspam.conf as defaults and asks user to either confirm or alter them.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-09-23 09:37:48 0000</bug_when>
            <thetext>You don&apos;t have anything to say about my comments so I close this bug as INVALID (the subject is obviously so anyway).</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-23 10:30:12 0000</bug_when>
            <thetext>Not so fast ;-)

I&apos;m working in my own business, which is a full time job, I don&apos;t have as much time as a maintainer of a Gentoo package to respond.

Anyhow. I don&apos;t want to argue about technical insignificances. 

My point is that the Postgresql set-up of dspam is broken. It is not automatic and probably never should be, the only thing it really must do is set-up dspam correctly and NOT the Postgresql part.
BTW: In a real live environment there might even be a different administrator which set-up the database, and (s)he probably would not like to see a script doing stuff with the database. Especially with commands like &quot;createlang&quot; in Postgresql which touch very security sensitive areas of a database system.

Long argument cut short:
1. The dspam routine &apos;must&apos; only set-up it self.
2. I should only &apos;advise&apos; the Admin on how to set-up up secondary systems ... Customized commands for the Databases are a nice add-on ;-) 
3. It definitely should NOT touch other productive systems (like the database) because they could be set-up in special way, which results not only a faulty set-up of dspam, but also a broken database system with broader consequences.

So leave the bug closed if you like ... I don&apos;t really care about it very much, I use an overlay with the correct set-up routine for me. 
But keep in mind that with this bug dspam will set many systems in danger of being broken (auto-magically) by your set-up .... as well as the Security of the whole system is in danger by an additional software package not being actively used (an full blown installed Postgresql server with every &apos;security hole&apos; (in the future)) which needs to be patched by upgrading ... every Admin will thank you for that and every security aware person won&apos;t like using the dspam package ...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-09-23 13:56:32 0000</bug_when>
            <thetext>I have one full time job as a programmer and also I&apos;m involved in 2 part time jobs. Somehow I find time to respond on bugs like this, even though I don&apos;t have a personal interest.

(In reply to comment #4)
&gt; My point is that the Postgresql set-up of dspam is broken. It is not automatic
&gt; and probably never should be, the only thing it really must do is set-up dspam
&gt; correctly and NOT the Postgresql part.

Do you honestly think I would ever consider maintaining a pkg_config function if it weren&apos;t the database setup? 

&gt; BTW: In a real live environment there might even be a different administrator
&gt; which set-up the database, and (s)he probably would not like to see a script
&gt; doing stuff with the database. Especially with commands like &quot;createlang&quot; in
&gt; Postgresql which touch very security sensitive areas of a database system.

No one force you to run pkg_config. Just do it manually if you must.

&gt; Long argument cut short:
&gt; 1. The dspam routine &apos;must&apos; only set-up it self.

Selecting a few parameters in dspam.conf such as StorageDriver or PgSQLServer isn&apos;t a reason to create pkg_config(), isn&apos;t it?

&gt; 2. I should only &apos;advise&apos; the Admin on how to set-up up secondary systems ...
&gt; Customized commands for the Databases are a nice add-on ;-) 

Forward to him a sql script on how you would like to make your own database then.

&gt; 3. It definitely should NOT touch other productive systems (like the database)
&gt; because they could be set-up in special way, which results not only a faulty
&gt; set-up of dspam, but also a broken database system with broader consequences.
&gt; 
&gt; So leave the bug closed if you like ... I don&apos;t really care about it very much,
&gt; I use an overlay with the correct set-up routine for me.

You use an overlay just because you don&apos;t like pkg_config?!? Ah... I forgot. You also don&apos;t like having an unused Postgres server on your box... Time to ask for minimal USE flag on dev-d/postgres perhaps?
 
&gt; But keep in mind that with this bug dspam will set many systems in danger of
&gt; being broken (auto-magically) by your set-up 

Interesting... How will my setup bork your server again? You give the address of the Postgres server, root user and root password and expect the emerge to check if database server is reachable?!? Geez... 

&gt; .... as well as the Security of
&gt; the whole system is in danger by an additional software package not being
&gt; actively used (an full blown installed Postgresql server with every &apos;security
&gt; hole&apos; (in the future)) which needs to be patched by upgrading

Some security freaks wouldn&apos;t install gcc on their boxes because they see it as a security hazard. We on the other hand prefer to fix real security holes, not the perceived ones. 
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>robim42@googlemail.com</who>
            <bug_when>2007-09-24 05:51:32 0000</bug_when>
            <thetext>&gt; Interesting... How will my setup bork your server again? You give the address
&gt; of the Postgres server, root user and root password and expect the emerge to
&gt; check if database server is reachable?!? Geez... 
Well psql lets you do nasty things like execute shell commands. I personally don&apos;t like those database shells, if they have an buffer overflow somewhere (I&apos;m sure they all do) you&apos;re doomed :-/

Anyway why not use a python script to call the set-up scripts as a wrapper. All you need is a thin python sql binding (psycopg or something like that would do). No servers required (even the install could be faster because the fat ass database would not have been compiled) and everybody is happy! ;-))

Just my 50 cent</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-09-24 07:40:48 0000</bug_when>
            <thetext>(In reply to comment #6)
&gt; Anyway why not use a python script to call the set-up scripts as a wrapper. All
&gt; you need is a thin python sql binding (psycopg or something like that would
&gt; do). No servers required (even the install could be faster because the fat ass
&gt; database would not have been compiled) and everybody is happy! ;-))

I&apos;m not familiar with psycopg, but if it can execute sql scripts just like psql, this is a good alternative. However this has nothing to do with this bug.

Just attach a patch to bug 193073 that would allow pkg_config() and dspam.cron to use this alternative. The RDEPEND in this case will contain &quot;postgres? ( || ( dev-python/psycopg dev-db/postgresql ) )&quot;.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>robim42@googlemail.com</who>
            <bug_when>2007-09-25 13:21:41 0000</bug_when>
            <thetext>Well I don&apos;t know python and PostgreSQL very well. I would take me weeks to write such a script. :-/</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-25 13:57:38 0000</bug_when>
            <thetext>Created an attachment (id=131862)
python, psycopg wrapper for pkg_config routines

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-25 13:58:31 0000</bug_when>
            <thetext>Hi there!

Here a quick script which takes either 5 or 6 arguments, depending if a virtual user set-up is wanted or not.

Usage: prepare-dspam-postgresql.py [database host] [dspam user] [dspam passwd] [dspam dbname] [set-up DB script] [OPTIONAL: set-up virutal-user script]

Example: prepare-dspam-postgresql.py 192.168.5.5 dspam secr3t mydspam /path/to/pgsql_objects.sql /path/to/pgsql_virtual_users.sql

It does take the pkg_config routines and embeds them into python using a psycopg ( dev-python/psycopg ) connector. 

Alin, if you like a write another, smarter wrapper (reading the configuration from dspam.conf) for the cron qurge.sql script!?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-25 14:00:34 0000</bug_when>
            <thetext>Typo in last sentence:
Alin, I write another &apos;smarter&apos; wrapper (reading the configuration
from dspam.conf) for the cron qurge.sql script, if you like?!</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-09-25 15:09:01 0000</bug_when>
            <thetext>(In reply to comment #11)
&gt; Typo in last sentence:
&gt; Alin, I write another &apos;smarter&apos; wrapper (reading the configuration
&gt; from dspam.conf) for the cron qurge.sql script, if you like?!

This piece of code must be executed by sh because it should run from pkg_config and dspam.cron (don&apos;t wanna install a wrapper for such a simple task). If your code satisfy this condition, post it here. If not, I will probably write some awk code for it.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-09-25 15:29:29 0000</bug_when>
            <thetext>Ah, and another thing... I also need to execute the sql purge script found in /etc/mail/dspam directory. For that reason, I want a database terminal like psql, that would be capable to do database creation and purge the old data when called from dspam.cron.

I also need some special env vars through I could pass authentication data to the script (dspam.cron isn&apos;t interactive).</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-26 11:48:26 0000</bug_when>
            <thetext>Sure no problem ... env vars or command args or both for the purge script? </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-26 12:13:50 0000</bug_when>
            <thetext>Ok, the attached script purge-postgresql.py you can either be called with arguments: purge-postgresql.py [database host] [dspam user] [dspam passwd] [dspam dbname] [purge DB script]

or without arguments, but the following environment vars set:
DSPAM_PgSQL_HOST, DSPAM_PgSQL_USER, DSPAM_PgSQL_PWD, DSPAM_PgSQL_DB and DSPAM_PgSQL_PURGE_SQL
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-26 12:15:25 0000</bug_when>
            <thetext>Created an attachment (id=131931)
python, psycopg wrapper for daily (cron based) postgresql database clean-up

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-26 16:17:06 0000</bug_when>
            <thetext>There is already a small problem embedded in the pgsql_objects.sql file.

The command:
create language plpgsql;
only work for PostgreSQL &lt; 8.0
for PostgreSQL 8.0 and later you need to run:
createlang -Upostgres plpgsql &lt;DBNAME&gt;
Otherwise you will get an syntax error for the current (and also my python wrapper, which I can fix) dspam database set-up.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-09-29 12:52:59 0000</bug_when>
            <thetext>Well, createlang is installed by postgresql. Please come up with an alternative or I will be forced dev-lib/postgresql dependency. I will force &gt;=libpq-8 dependency anyway, so you don&apos;t need to take previous postgres versions into account.

Aside from that I almost finished the r7 revision, which is far better polished version than the one before.

You were right about pkg_config not being able to configure any other sql server than localhost. Sorry about that. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2007-09-30 12:08:59 0000</bug_when>
            <thetext>Fixed in -r7, just the way you wanted. Changes occured in pkg_config:
  - edit database parameters of the dspam.conf
  - create database with whatever settings user specified in his dspam.conf
  - make database creation optionally
  - pgsql: use psycopg script when psql is missing (postgresql can be missing, see the new RDEPEND)
  - pgsql: fix language creation

Changes occured in dspam.cron:
  - sql purge scripts no longer required
  - read database parameters directly from dspam.conf
  - pgsql: use psycopg script when psql is missing

I&apos;ve just lost almost an entire weekend over this. The next person who will have anything to add to dspam ebuild, better have patches and be prepared to fix whatever I tell him to. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bugs.gentoo.org@meisel.cc</who>
            <bug_when>2007-09-30 17:09:06 0000</bug_when>
            <thetext>Cheers Alin ... you are a * .... :-)</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>131862</attachid>
            <date>2007-09-25 13:57 0000</date>
            <desc>python, psycopg wrapper for pkg_config routines</desc>
            <filename>prepare-dspam-postgresql.py</filename>
            <type>text/plain</type>
            <data encoding="base64">IyEvYmluL2VudiBweXRob24KCmltcG9ydCBzeXMKaW1wb3J0IHBzeWNvcGcyCmZyb20gcHN5Y29w
ZzIuZXh0ZW5zaW9ucyBpbXBvcnQgSVNPTEFUSU9OX0xFVkVMX0FVVE9DT01NSVQKCmRlZi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c3MgPSBpbnB1dFN0dWZmKCdE
Qi1Vc2VyIFBhc3N3b3JkJykKICAgICAgICBleGNlcHQgRXhjZXB0aW9uLCBlOgogICAgICAgICAg
ICBwcmludCBlCiAgICAgICAgICAgIHN5cy5leGl0KDIpCiAgICByZXR1cm4gY29uCgppZiBfX25h
bWVfXyA9PSAnX19tYWluX18nOgogICAgbWFpbigpCg==
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>131931</attachid>
            <date>2007-09-26 12:15 0000</date>
            <desc>python, psycopg wrapper for daily (cron based) postgresql database clean-up</desc>
            <filename>purge-postgresql.py</filename>
            <type>text/plain</type>
            <data encoding="base64">IyEvYmluL2VudiBweXRob24KCmltcG9ydCBzeXMsIG9zCmltcG9ydCBwc3ljb3BnMgpmcm9tIHBz
eWNvcGcyLmV4dGVuc2lvbnMgaW1wb3J0IElTT0xBVElPTl9MRVZFTF9BVVRPQ09NTUlUCgpkZWYg
bWFpbigpOgogICAgaWYgbGVuKHN5cy5hcmd2KSA9PSA2OgogICAgICAgIHRoaXNjcmlwdCwgaG9z
dG5hbWVpcCwgZHNwYW11c2VyLCBkc3BhbXBhc3MsIGRzcGFtZGIsIHB1cmdlc2NyaXB0ID0gc3lz
LmFyZ3YKICAgIGVsc2U6CiAgICAgICAgZW52ID0gb3MuZW52aXJvbgogICAgICAgIGlmIHNldCgo
J0RTUEFNX1BnU1FMX0hPU1QnLCAnRFNQQU1fUGdTUUxfVVNFUicsICdEU1BBTV9QZ1NRTF9QV0Qn
LCAnRFNQQU1fUGdTUUxfREInLCAnRFNQQU1fUGdTUUxfUFVSR0VfU1FMJykpIDw9IHNldChlbnYp
OgogICAgICAgICAgICBob3N0bmFtZWlwID0gZW52WydEU1BBTV9QZ1NRTF9IT1NUJ10KICAgICAg
ICAgICAgZHNwYW11c2VyID0gZW52WydEU1BBTV9QZ1NRTF9VU0VSJ10KICAgICAgICAgICAgZHNw
YW1wYXNzID0gZW52WydE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AgIGYuY2xvc2UoKQogICAgZXhjZXB0IEV4Y2VwdGlv
biwgZToKICAgICAgICBwcmludCAiRVJST1I6ICIsZQogICAgICAgIHN5cy5leGl0KDQpCiAgICB0
cnk6CiAgICAgICAgY3VyLmV4ZWN1dGUoc2NyaXB0KQogICAgZXhjZXB0IEV4Y2VwdGlvbiwgZToK
ICAgICAgICBwcmludCAiRVJST1I6ICIsZQogICAgICAgIHN5cy5leGl0KDUpCiAgICBjb24uY2xv
c2UoKQogICAgCmlmIF9fbmFtZV9fID09ICdfX21haW5fXyc6CiAgICBtYWluKCkK
</data>        

          </attachment>
    </bug>

</bugzilla>