[Dovecot] Proxy setup between two servers

Abhijit Hoskeri abhijit at deeproot.co.in
Fri Sep 28 13:40:39 EEST 2007


On Thu, Sep 27, 2007 at 09:38:16PM +0100, Ed W wrote:
> Hi
> 
> >I have not yet tried to proxy to some other host.
> >  
> 
> See my question a week or so previously.  (Using mysql though).

I am trying out that patch now. Thanks.

> 
> Basically you need to return a null entry to mean "this machine", 

I have surmounted my initial error, by using the userdb as LDAP also.

I also discovered, very late, that I needed to set another a total of two variables for 
proxying to work, from the wiki [PasswordDatabase/ExtraFields/Proxy].

proxy: which just needs to be 'set' no value is required.
host: which points to the IP address of the host being proxied to.

So now I have this config:

dovecot -n:
# /etc/dovecot/dovecot.conf
info_log_path: /var/log/dovecot.log
log_timestamp: %Y-%m-%d %H:%M:%S
protocols: pop3 imap
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
mail_extra_groups: mail
mail_debug: yes
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
auth default:
  verbose: yes
  debug: yes
  passdb:
    driver: ldap
    args: /etc/dovecot/dovecot-ldap.conf
  userdb:
    driver: ldap
    args: /etc/dovecot/dovecot-ldap.conf

/etc/dovecot/dovecot-ldap.conf:
hosts = localhost
dn = <dn>
dnpass = <dn-pass>
sasl_bind = no
auth_bind = yes
ldap_version = 2
base = <dn-base>
user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid
pass_attrs = uid=user,userPassword=password,mailHost=host,qmailUID=proxy

I have set the proxy to qmailUID above simply because I need to give it some
value, I think..

Still I get the following error.

Info: Dovecot v1.0.rc15 starting up
Info: auth(default): client in: AUTH        1       PLAIN   service=POP3    secured lip=127.0.0.1   rip=127.0.0.1   resp=<hidden>
Info: auth(default): ldap(hoskeri,127.0.0.1): bind search: base=dc=deeproot,dc=co,dc=in filter=(&(objectClass=posixAccount)(uid=hoskeri))
Info: auth(default): ldap(hoskeri,127.0.0.1): result: uid(user)=hoskeri qmailUID(proxy)=1004 mailHost(host)=192.168.1.5
Info: auth(default): ldap(hoskeri,127.0.0.1): bind: dn=uid=hoskeri,ou=People,dc=deeproot,dc=co,dc=in
Info: auth(default): client out: OK 1       user=hoskeri    proxy   host=192.168.1.5        pass=<hidden>
Info: auth(default): master in: REQUEST     1       7067    1
Info: auth(default): master out: NOTFOUND   1
Info: pop3-login: Internal login failure: user=<hoskeri>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured

In addition to that, If I change the dovecot-ldap.conf to the following I can
log in and the logs show the proxy and host variable, but I get logged in to the
localhost!

/etc/dovecot/dovecot-ldap.conf:
hosts = localhost
dn = uid=deepofix,ou=people,dc=deeproot,dc=co,dc=in
dnpass = abhijit
sasl_bind = no
auth_bind = yes
ldap_version = 2
base = dc=deeproot,dc=co,dc=in
user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid,mailHost=host,qmailUID=proxy
pass_attrs = uid=user,userPassword=password

Basically what I have done here is that I have moved the proxy detection
variables to the user_attrs.

2007-09-28 15:18:14 Info: auth(default): ldap(hoskeri,127.0.0.1): bind: dn=uid=hoskeri,ou=People,dc=deeproot,dc=co,dc=in
2007-09-28 15:18:14 Info: auth(default): client out: OK 1       user=hoskeri
2007-09-28 15:18:14 Info: auth(default): master in: REQUEST     1       7328    1
2007-09-28 15:18:14 Info: auth(default): ldap(hoskeri,127.0.0.1): user search: base=dc=deeproot,dc=co,dc=in scope=subtree filter=(&(objectClass=posixAccount)(uid=hoskeri)) fields=homeDirectory,uidNumber,gidNumber,mailHost,qmailUID
2007-09-28 15:18:14 Info: auth(default): master out: USER       1       hoskeri uid=1004        home=/home/hoskeri      proxy=1004      gid=1000        host=192.168.1.5
2007-09-28 15:18:14 Info: pop3-login: Login: user=<hoskeri>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured
2007-09-28 15:18:14 Info: POP3(hoskeri): Effective uid=1004, gid=1000
2007-09-28 15:18:14 Info: POP3(hoskeri): maildir: root exists (/home/hoskeri/Maildir)
2007-09-28 15:18:14 Info: POP3(hoskeri): maildir: root=/home/hoskeri/Maildir, index=/home/hoskeri/Maildir, control=, inbox=
2007-09-28 15:18:27 Info: POP3(hoskeri): Disconnected: Logged out top=0/0, retr=1/494, del=0/1, size=478

As you can see, even though it seems to have detected the proxy variables
correctly, it still uses the local mailbox. I don't know what else I need to do
:-(.

Thanks for any clue.

-Abhijit


More information about the dovecot mailing list