[Dovecot] Pop-before-smtp and MySQL?

Matteo Garofano m.garofano at internetware.it
Mon Nov 28 17:21:27 EET 2005


Thanks again,
I made some debugging but it didn't helped.
I wrote something similar to the line you suggested at the top of the
popbsmtp.sh script
this is the result:

dovecot: Nov 28 14:50:41 Info: Dovecot v1.0-stable starting up
dovecot: Nov 28 14:50:42 Info: auth(default): mysql: Connected to postfix
Login from , parameters 1=/usr/local/libexec/dovecot/pop3, 2=, 3=, 4=
dovecot: Nov 28 14:50:59 Info: pop3-login: Login: teo at xarrampicate.it
[192.168.100.70]

it seems that no variable is passed during the execution of the mail_execute 
commands

compilation options:
./configure --with-mysql --without-passwd --without-passwd-file --without-shadow

the dovecot.conf file is:
--------------------------
protocols = pop3
ssl_disable = yes
disable_plaintext_auth = no
log_path = /var/log/dovecot3
log_timestamp = "%b %d %H:%M:%S "
login_user = dovecotauth
first_valid_uid = 50
default_mail_env = mbox:/tmp:INBOX=/var/spool/mail/%u
mail_log_prefix = "%Us(%u):"
protocol imap {
}
protocol pop3 {
mail_executable = /usr/local/libexec/dovecot/popbsmtp.sh 
/usr/local/libexec/dovecot/pop3
}
auth default {
  mechanisms = plain
  passdb = sql /usr/local/etc/dovecot-sql.conf
  userdb = sql /usr/local/etc/dovecot-sql.conf
  user = dovecot
}
--------------------------


the popbsmtp.sh is:

#!/bin/sh
echo "Login from $3, parameters 1=$1, 2=$2, 3=$3, 4=$4" >> /var/log/dovecot3
(
    IP=`echo $3 | sed 's/\]//'`
    if [ -n "$IP" ]
    then
        export HOME=/root/
        echo "replace into relay_ip VALUES('$IP','RELAY',now());" | mysql 
postfix
        export HOME=/
    fi
) >> /var/log/dovecot3 2>&1

exec $*

--------------------------
dovecot is: 1.0-stable


still in the limbo...
thanks for any help
te0x

----- Original Message ----- 
From: "Lorens" <dovecot.fdop at tagged.lorens.org>
To: "Matteo Garofano" <m.garofano at internetware.it>
Cc: <dovecot at dovecot.org>
Sent: Monday, November 28, 2005 3:46 PM
Subject: Re: [Dovecot] Pop-before-smtp and MySQL?


> On Mon, Nov 28, 2005 at 12:40:08PM +0100, Matteo Garofano wrote:
>> Hi,
>> I found that dovecot have many nice features.
>> Now I write because I'm tring to setup the dovecot server, I would
>> substitute a qpopper daemon (patched for mysql authentication)
>> The problem I find is to set up the pop-before-smtp using sql (mysq) as
>> written in http://wiki.dovecot.org/moin.cgi/PopBSMTPAndDovecot
>> (Waiting for post_login ;-)
>> I would use the script popbsmtp.sh and not a perl pig. (I'm using qpopper
>> patched to store the relay IP in mysql and it works)
>> I set .my.cnf in /root
>> What happen is that the $3 don't contain the IP that should be written to
>> the DB. Is there something I miss ?
>> I tried to modify the dovecot.conf file like this
>> mail_executable = /usr/local/libexec/dovecot/popbsmtp.sh
>> /usr/local/libexec/dovecot/pop3 %r "%r"
>> and it write to the db the litteral value %r and not the ip, otherwise it
>> write nothing.
>
> The first thing to do is some debugging: in the popbsmtp.sh
> script write the received parameters to a file, and decide where
> the problem is!  For exemple,
>
> echo "Login from $3, parameters 1=$1, 2=$2, 3=$3, 4=$4" >>
> /var/log/dovecot3
>
> I did not need to put %r in the dovecot.conf, my line is
>
> mail_executable = /usr/lib/dovecot/popbsmtp.sh /usr/lib/dovecot/pop3
>
> If you put any junk afterwards, you will find that it's not $3
> anymore but $4 or $5 or whatever.
>
> My dovecot version is a 1.0stable.
>
>



More information about the dovecot mailing list