Discussion:
[Dovecot] virtual domain
Barry Kwok
2005-09-26 21:33:57 UTC
Permalink
we are currently using vm-pop3d to implement virtual domains. But due to some locking problem in vm-pop3d, we want to test the possibility to change to dovecot.
Currently, in vm-pop3d, the passwd file is located in
/etc/virtual/domain1.com/passwd
/etc/virtual/domain2.com/passwd

and the passwd format is:
user: md5 encrpted password

and the email is store in
/var/spool/virtual/domain1.com/user
/var/spool/virtual/domain2.com/user

and we login as ***@domain1.com, ***@domain2.com .
We want to maintain this format as login id and the password format.
What should be changed in dovecot.conf? Thanks.
Jean-Marc Pigeon
2005-09-26 21:45:14 UTC
Permalink
Bonjour Barry Kwok,
Post by Barry Kwok
we are currently using vm-pop3d to implement virtual domains. But due to some locking problem in vm-pop3d, we want to test the possibility to change to dovecot.
Currently, in vm-pop3d, the passwd file is located in
[....]
Post by Barry Kwok
We want to maintain this format as login id and the password format.
What should be changed in dovecot.conf? Thanks.
See mailling list last week exchange
Subject: "v1.0.alpha2, virtual domain authentication."


A bientot
--
==========================================================================
Jean-Marc Pigeon Internet: Jean-***@safe.ca
SAFE Inc. Phone: (514) 493-4280 Fax: (514) 493-1946
Clement's Home base <"http://www.clement.safe.ca">
==========================================================================
Timo Sirainen
2005-09-26 21:48:45 UTC
Permalink
Post by Barry Kwok
we are currently using vm-pop3d to implement virtual domains. But due to some locking problem in vm-pop3d, we want to test the possibility to change to dovecot.
Currently, in vm-pop3d, the passwd file is located in
/etc/virtual/domain1.com/passwd
/etc/virtual/domain2.com/passwd
passdb passwd-file {
args = /etc/virtual/%d/passwd
}

This requires Dovecot 1.0.alpha2 or later.
Post by Barry Kwok
user: md5 encrpted password
In MD5crypt format? ie. $1$something? Then it should work directly.
Post by Barry Kwok
and the email is store in
/var/spool/virtual/domain1.com/user
/var/spool/virtual/domain2.com/user
As mboxes? For IMAP you'll need also some directory where non-INBOXes
are stored, and with POP3 Dovecot also wants a directory where it can
store index files.

If you don't want either, you could do something like:

default_mail_env = mbox:/tmp:INBOX=/var/spool/virtual/%d/%u:INDEX=MEMORY
Barry Kwok
2005-09-27 13:29:52 UTC
Permalink
Post by Timo Sirainen
Post by Barry Kwok
we are currently using vm-pop3d to implement virtual domains. But due to some locking problem in vm-pop3d, we want to test the possibility to change to dovecot.
Currently, in vm-pop3d, the passwd file is located in
/etc/virtual/domain1.com/passwd
/etc/virtual/domain2.com/passwd
passdb passwd-file {
args = /etc/virtual/%d/passwd
}
This requires Dovecot 1.0.alpha2 or later.
Post by Barry Kwok
user: md5 encrpted password
In MD5crypt format? ie. $1$something? Then it should work directly.
Post by Barry Kwok
and the email is store in
/var/spool/virtual/domain1.com/user
/var/spool/virtual/domain2.com/user
As mboxes? For IMAP you'll need also some directory where non-INBOXes
are stored, and with POP3 Dovecot also wants a directory where it can
store index files.
default_mail_env = mbox:/tmp:INBOX=/var/spool/virtual/%d/%u:INDEX=MEMORY
Thank you. Timo.
I have installed Dovecot 1.0 alpha3 and tested. It is a mbox POP3 only server. The relevent part of dovecot.conf I have changed:

default_mail_env = mbox:/tmp:INBOX:/var/spool/virutal/%d/%u:INDEX=MEMORY

passdb passwd-file {
# Path for passwd-file
args = /etc/virtual/%d/passwd
}

userdb static {
args = uid=503 gid=503 mail=mbox:/var/spool/virtual/%d/%n
}

I can login with ***@domain1.com but there is error in logfile:
Sep 27 13:15:16 ns2 dovecot: pop3(***@domain1.com): mbox: Can't create root IMAP folder /mail: Permission denied
Sep 27 13:15:16 ns2 dovecot: pop3(***@domain1.com): Failed to create storage with data: mbox:/var/spool/virtual/domain1.com/user
Sep 27 13:15:16 ns2 dovecot: pop3-login: Login: user=<***@domain1.com>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured
Sep 27 13:15:16 ns2 dovecot: child 19147 (pop3) returned error 89

I then created a /mail directory with file mode 777, then it is OK.

Why I need a IMAP folder in a POP3 only server and can I change that folder to /tmp directory.
Timo Sirainen
2005-09-27 16:45:43 UTC
Permalink
Post by Barry Kwok
userdb static {
args = uid=503 gid=503 mail=mbox:/var/spool/virtual/%d/%n
}
Drop the "mail" part from here. You already have it in default_mail_env,
and it's correct there. Here you're saying that the .../%d/%n is the
mail directory, not file. If it refuses to start up without the mail=
part, replace it with home=/tmp instead.
Post by Barry Kwok
Why I need a IMAP folder in a POP3 only server
Dovecot is mostly an IMAP server, POP3 was just an afterthought.
Post by Barry Kwok
and can I change that folder to /tmp directory.
Yes, as long as nothing actually gets written there (and with
INDEX=MEMORY and POP3 nothing should get written there).
Barry Kwok
2005-09-27 17:43:08 UTC
Permalink
Post by Timo Sirainen
Post by Barry Kwok
userdb static {
args = uid=503 gid=503 mail=mbox:/var/spool/virtual/%d/%n
}
Drop the "mail" part from here. You already have it in default_mail_env,
and it's correct there. Here you're saying that the .../%d/%n is the
mail directory, not file. If it refuses to start up without the mail=
part, replace it with home=/tmp instead.
Post by Barry Kwok
Why I need a IMAP folder in a POP3 only server
Dovecot is mostly an IMAP server, POP3 was just an afterthought.
Post by Barry Kwok
and can I change that folder to /tmp directory.
Yes, as long as nothing actually gets written there (and with
INDEX=MEMORY and POP3 nothing should get written there).
Thank you Timo, I have just tried. But I found that I must add the mail=mbox:/var/spool/virtual/%d/%n part. Without this part, the dovecot seems not checking the right location of mail spool and simply say that "no new email". Now I added this part together with "home=/tmp" part into userdb config and It works now with IMAP folder in /tmp directory.
But I want to ask if there is any file locking problem as I am running virtual email with vmail as owner for all mbox accounts.
And it seems that they are all share the same IMAP folder located in /tmp directory.
Timo Sirainen
2005-09-28 03:05:12 UTC
Permalink
Post by Barry Kwok
Post by Timo Sirainen
Post by Barry Kwok
userdb static {
args = uid=503 gid=503 mail=mbox:/var/spool/virtual/%d/%n
}
Drop the "mail" part from here. You already have it in default_mail_env,
and it's correct there. Here you're saying that the .../%d/%n is the
mail directory, not file. If it refuses to start up without the mail=
part, replace it with home=/tmp instead.
Post by Barry Kwok
Why I need a IMAP folder in a POP3 only server
Dovecot is mostly an IMAP server, POP3 was just an afterthought.
Post by Barry Kwok
and can I change that folder to /tmp directory.
Yes, as long as nothing actually gets written there (and with
INDEX=MEMORY and POP3 nothing should get written there).
Thank you Timo, I have just tried. But I found that I must add the mail=mbox:/var/spool/virtual/%d/%n part. Without this part, the dovecot seems not checking the right location of mail spool and simply say that "no new email". Now I added this part together with "home=/tmp" part into userdb config and It works now with IMAP folder in /tmp directory.
default_mail_env should have been enough, since it's used instead of the
mail= part if it doesn't exist.

Also that setting above breaks if the user's mbox file doesn't exist.
Using mail=mbox:/tmp:INBOX=/var/spool/virtual/%d/%n should fix that.

Also since you're overriding default_mail_env, the indexes are now
written to home directory, ie. /tmp directory. For everyone. And they'll
conflict with each others and probably create problems. So you'll need
to add :INDEX=MEMORY to the mail= there as well.
Post by Barry Kwok
But I want to ask if there is any file locking problem as I am running virtual email with vmail as owner for all mbox accounts.
As long as all programs accessing the mbox files are using compatible
locking, there are no problems. Dovecot specifies that in
mbox_read_locks and mbox_write_locks. You should check that whatever is
writing the mails to the mbox files uses the same locks.
Post by Barry Kwok
And it seems that they are all share the same IMAP folder located in /tmp directory.
With your settings, yes. You should fix that or it'll cause problems..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20050927/d52640e6/attachment.pgp
Loading...