Re: [Dovecot] Another hint from the clue box 8-) imapc/imap proxy user mailbox server location

2012-03-13 Thread Timo Sirainen
On 12.3.2012, at 20.57, Terry Carmen wrote:

>> If you can use userdb passwd-file and export the data to that file, it'll 
>> work. http://wiki2.dovecot.org/AuthDatabase/PasswdFile
>> 
>> Example line:
>> 
>> user1::1000:1000::/home/user::userdb_imapc_host=exch1.example.com
>> 
>> Note that you can't then return any userdb fields from passdb ldap lookup.
> 
> That doesn't seem to work because I can't create the passdb file containing 
> the user's password, since they're only known to the remote IMAP server that 
> I want imapproxy to connect to.

Well, you could allow users to log in with any password and then let it just 
fail later at imapc login, but that's a bit ugly.

You could also use passdb imap {} + userdb passwd-file {} with some extra work. 
The authentication would be done against the remote imap server, while the 
userdb_imapc_host would be looked up from the passwd-file.

> What would be perfect is if I could do something like this:
> 
> 
> 
> http://wiki.dovecot.org/HowTo/ImapProxy#IMAP_and_POP3_session_proxying
> Proxy only server
..
> All I really need is a way to lookup the user's home IMAP server when given 
> the username, as above.
> 
> Does imapproxy still support this 1.x feature?

This describes a regular dummy proxying setup. Sure you could still do that, 
but it's not imapc proxying. 
http://wiki2.dovecot.org/PasswordDatabase/ExtraFields/Proxy

Re: [Dovecot] Another hint from the clue box 8-) imapc/imap proxy user mailbox server location

2012-03-12 Thread Terry Carmen

On 03/04/2012 09:58 AM, Timo Sirainen wrote:

On 4.3.2012, at 16.48, Terry Carmen wrote:


 pass_attrs = ..., \
 msExchHomeServerName=userdb_imapc_host=%49.100$.example.com

 If the prefix differs, but all of the exchange server names have  
the same length, for example 10, you can also do:


 pass_attrs = ..., \
 msExchHomeServerName=userdb_imapc_host=%-10$.example.com
 There's no otherwise nice way to parse this string.



If by prefix, you mean the  
"/O=example/OU=INT/cn=Configuration/cn=Servers/" part, then, yes,  
they're different.


OK, so if the prefix or suffix isn't always the same length you  
can't do the above.


I could export the data to a text file as  
username:homeexchangeserver (or whatever other format is needed).


homeservers.txt:
user1:exch1.example.com
user2:exch1.example.com
user3:exch1.example.com
user4:exch2.example.com

Is it possible to do a lookup in a text file to get this?



If you can use userdb passwd-file and export the data to that file,  
it'll work. http://wiki2.dovecot.org/AuthDatabase/PasswdFile


Example line:

user1::1000:1000::/home/user::userdb_imapc_host=exch1.example.com

Note that you can't then return any userdb fields from passdb ldap lookup.


That doesn't seem to work because I can't create the passdb file  
containing the user's password, since they're only known to the remote  
IMAP server that I want imapproxy to connect to.


What would be perfect is if I could do something like this:



http://wiki.dovecot.org/HowTo/ImapProxy#IMAP_and_POP3_session_proxying
Proxy only server

. . .

In this document I assume that Dovecot is installed under  
/opt/dovecot, by default it is installed under /usr/local when  
compiling from source. Examples in this document are for MySQL but  
configs do not differ much with PostgreSQL.


SQL table structure

Create SQL table like

CREATE TABLE proxy (
  user varchar(255) NOT NULL,
  host varchar(16) default NULL,
  destuser varchar(255) default NULL,
  PRIMARY KEY  (user)
);

//

All I really need is a way to lookup the user's home IMAP server when  
given the username, as above.


Does imapproxy still support this 1.x feature?

Thanks!

Terry











Re: [Dovecot] Another hint from the clue box 8-) imapc/imap proxy user mailbox server location

2012-03-04 Thread Timo Sirainen
On 4.3.2012, at 16.48, Terry Carmen wrote:

>>  pass_attrs = ..., \
>>  msExchHomeServerName=userdb_imapc_host=%49.100$.example.com
>> 
>>  If the prefix differs, but all of the exchange server names have the same 
>> length, for example 10, you can also do:
>> 
>>  pass_attrs = ..., \
>>  msExchHomeServerName=userdb_imapc_host=%-10$.example.com
>>  There's no otherwise nice way to parse this string.
> 
> 
> If by prefix, you mean the "/O=example/OU=INT/cn=Configuration/cn=Servers/" 
> part, then, yes, they're different.

OK, so if the prefix or suffix isn't always the same length you can't do the 
above.

> I could export the data to a text file as username:homeexchangeserver (or 
> whatever other format is needed).
> 
> homeservers.txt:
> user1:exch1.example.com
> user2:exch1.example.com
> user3:exch1.example.com
> user4:exch2.example.com
> 
> Is it possible to do a lookup in a text file to get this?


If you can use userdb passwd-file and export the data to that file, it'll work. 
http://wiki2.dovecot.org/AuthDatabase/PasswdFile

Example line:

user1::1000:1000::/home/user::userdb_imapc_host=exch1.example.com

Note that you can't then return any userdb fields from passdb ldap lookup.

Re: [Dovecot] Another hint from the clue box 8-) imapc/imap proxy user mailbox server location

2012-03-04 Thread Terry Carmen

- Message from Timo Sirainen  -
      Date: Sun, 4 Mar 2012 14:45:48 +0200
      From: Timo Sirainen 
   Subject: Re: [Dovecot] Another hint from the clue box 8-) imapc/imap
proxy user mailbox server location
        To: Terry Carmen 
        Cc: dovecot@dovecot.org

On 2.3.2012, at 0.35, Terry Carmen wrote:
With the exchange server being returned in the msExchHomeServerName  
property as:


   /O=example/OU=INT/cn=Configuration/cn=Servers/cn=exchangeservername

   I believe this should somehow end up in the userdb section,  
which currently contains "driver = prefetch", but can't seem to  
figure out specifically what should be there.
  ..  > The only important part is "cn=exchangeservername", which is  
the machine name and would need to be prepended to example.com to  
get the fqdn.

  Do all of the values have the same prefix? Then I guess you can do:

  pass_attrs = ..., \
  msExchHomeServerName=userdb_imapc_host=%49.100$.example.com

  If the prefix differs, but all of the exchange server names have  
the same length, for example 10, you can also do:


  pass_attrs = ..., \
  msExchHomeServerName=userdb_imapc_host=%-10$.example.com
  There's no otherwise nice way to parse this string.



If by prefix, you mean the  
"/O=example/OU=INT/cn=Configuration/cn=Servers/" part, then, yes,  
they're different.


I could export the data to a text file as username:homeexchangeserver  
(or whatever other format is needed).


homeservers.txt:
user1:exch1.example.com
user2:exch1.example.com
user3:exch1.example.com
user4:exch2.example.com

Is it possible to do a lookup in a text file to get this?

Terry




Re: [Dovecot] Another hint from the clue box 8-) imapc/imap proxy user mailbox server location

2012-03-04 Thread Timo Sirainen
On 2.3.2012, at 0.35, Terry Carmen wrote:

> With the exchange server being returned in the msExchHomeServerName property 
> as:
> 
> /O=example/OU=INT/cn=Configuration/cn=Servers/cn=exchangeservername
> 
> I believe this should somehow end up in the userdb section, which currently 
> contains "driver = prefetch", but can't seem to figure out specifically what 
> should be there.
..
> The only important part is "cn=exchangeservername", which is the machine name 
> and would need to be prepended to example.com to get the fqdn.


Do all of the values have the same prefix? Then I guess you can do:

pass_attrs = ..., \
  msExchHomeServerName=userdb_imapc_host=%49.100$.example.com

If the prefix differs, but all of the exchange server names have the same 
length, for example 10, you can also do:

pass_attrs = ..., \
  msExchHomeServerName=userdb_imapc_host=%-10$.example.com

There's no otherwise nice way to parse this string.



[Dovecot] Another hint from the clue box 8-) imapc/imap proxy user mailbox server location

2012-03-01 Thread Terry Carmen
I'm running imapproxy as shown at  
http://wiki2.dovecot.org/HowTo/ImapcProxy. In fact, that's my config  
in the wiki. 8-)


It's been working, but has performance issues when the Exchange server  
that's hard-coded as imapc_host=xxx.xxx.xxx.xxx doesn't happen to be  
the user's home exchange server.


I'd like to point dovecot at the correct Exchange server based on an  
LDAP query, and in fact, have an LDAP search that works:


DC=example,DC=com

(&(objectCategory=person)(objectClass=user)(!(userAccountcontrol:1.2.840.113556.1.4.803:=2))(sAMAccountName=username))

With the exchange server being returned in the msExchHomeServerName  
property as:


/O=example/OU=INT/cn=Configuration/cn=Servers/cn=exchangeservername

I believe this should somehow end up in the userdb section, which  
currently contains "driver = prefetch", but can't seem to figure out  
specifically what should be there.


The only important part is "cn=exchangeservername", which is the  
machine name and would need to be prepended to example.com to get the  
fqdn.


Can anybody toss me a clue?

Once I get it working, I'll update the wiki.

Thanks!

Terry