[Dovecot] Password encryption type for dovecot & postfix saslauthd with mysql

2013-07-17 Thread Simon
Hi There,

We are using dovecot v2.2.4 (compiled from source) and postfix (yum install) on 
Centos 6.4. We are storing our virtual user config in mysql. 

Server 1 has dovecot/postfix and accepts incoming mail from our mail filter 
servers - this is purely for IMAP/POP services. Server 2 has postfix for our 
clients to send email via TLS/saslauthd. Both use the same (separate) mysql 
server for config. One issue is that we have a requirement to merge user / 
passwords for sending clients from two sources: 1) the dovecot mailbox list  
2). another list. The dovecot user list is email + password. The other list is 
username + password. To that end we have created a view table in mysql that 
merges the two.. tables + view look a little like this:

table: mail_users (for dovecot)

email,password
t...@test1.com,CRAM-MD5_PASSWORD
te...@test1.com,CRAM-MD5_PASSWORD
b...@bla.com,CRAM-MD5_PASSWORD

table: mail_senders_other 

username,password
username1,CRAM-MD5_PASSWORD
something_else,CRAM-MD5_PASSWORD

view: mail_senders (for postfix)

username,password
t...@test1.com,CRAM-MD5_PASSWORD
te...@test1.com,CRAM-MD5_PASSWORD
b...@bla.com,CRAM-MD5_PASSWORD
username1,CRAM-MD5_PASSWORD
something_else,CRAM-MD5_PASSWORD

I have dovecot working fine, but just need a little push in the correct 
direction (please) to figure out the correct settings and password encryption 
scheme to make the above work. 

Many thanks!

Simon

[Dovecot] Dovecot 2.2.4/sendmail with sql user and aliases

2013-07-17 Thread Cedric

Hi,

We are currently moving from linuxconf/dovecot to a dovecot setup with 
sql support, the problem we currently facing is having a message sent to 
a aliase delivered to the user email inbox with dovecot-lda, i have 
created cedr...@mail.vdl and a alias t...@mail.vdl, when i send to 
cedr...@mail.vdl the message is included in the user inbox file, but 
when i send to t...@mail.vdl it should do the same and not create a new 
created file named test, thank in advance for your help.


# dovecot --version
2.2.4


dovecot.conf
auth_debug = yes
auth_debug_passwords = yes
auth_verbose = yes
default_internal_user = root
default_login_user = mail
disable_plaintext_auth = no
first_valid_uid = 100
mail_access_groups = mail users sysadmin popusers
mail_location = 
mbox:%h/mail:LAYOUT=maildir++:INDEX=MEMORY:CONTROL=%h/mail/control:INBOX=/var/spool/vmail/%d/%n

mail_max_userip_connections = 40
mail_plugins = " quota sieve"
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope 
encoded-character vacation subaddress comparator-i;ascii-numeric 
relational regex imap4flags copy include variables body enotify 
environment mailbox date ihave

mbox_lazy_writes = no
passdb {
  args = /vdl/etc/dovecot/dovecot-sql.conf
  driver = sql
}
plugin {
  sieve = %h/mail/sieve/%n
  sieve_global_dir = /vdl/etc/dovecot/
  sieve_vacation_default_period = 1d
  sieve_vacation_max_period = 7d
}
postmaster_address = x@x.x
protocols = imap pop3
service auth {
  unix_listener auth-userdb {
mode = 0600
user = popusers
  }
}
service imap-login {
  inet_listener imap {
port = 143
  }
  process_min_avail = 4
  vsz_limit = 256 M
}
service pop3-login {
  inet_listener pop3 {
port = 110
  }
  process_min_avail = 16
}
ssl = no
submission_host = localhost:25
userdb {
  args = /vdl/etc/dovecot/dovecot-sql.conf
  driver = sql
}
protocol imap {
  mail_plugins = quota imap_quota mail_log notify
}
protocol pop3 {
  mail_plugins = quota
}
protocol lda {
  mail_plugins = quota sieve
}


dovecot-sql.conf
password_query = SELECT \
concat(s_courriel_utilisateur.utilisateur, '@', s_courriel_domaine.nom) 
AS user,s_courriel_utilisateur.password as password \
FROMs_courriel_utilisateur left join s_courriel_alias on 
s_courriel_utilisateur.id=s_courriel_alias.utilisateur and 
s_courriel_alias.archive !=1 ,s_courriel_domaine \

WHERE s_courriel_utilisateur.archive !=1 \
and s_courriel_domaine.archive !=1 \
and 
s_courriel_utilisateur.domaine=s_courriel_domaine.id \

and s_courriel_domaine.nom = '%d' \
and ( s_courriel_utilisateur.utilisateur = '%n' 
or s_courriel_alias.alias  = '%n' )


user_query = SELECT \
concat("/vhome/",s_courriel_domaine.nom,"/home/",s_courriel_utilisateur.utilisateur) 
as home, \
concat("/vhome/",s_courriel_domaine.nom,"/home/",s_courriel_utilisateur.utilisateur,"/mail/index") 
as "index", \
concat("/vhome/",s_courriel_domaine.nom,"/home/",s_courriel_utilisateur.utilisateur,"/mail/control") 
as control, \
concat("/var/spool/vmail/",s_courriel_domaine.nom,"/",s_courriel_utilisateur.utilisateur) 
as inbox, \

"maildir++" as layout, \
s_courriel_utilisateur.uid as 
uid,s_courriel_domaine.gid as gid \
FROMs_courriel_utilisateur left join s_courriel_alias on 
s_courriel_utilisateur.id=s_courriel_alias.utilisateur and 
s_courriel_alias.archive !=1 ,s_courriel_domaine \

WHERE s_courriel_utilisateur.archive !=1 \
and s_courriel_domaine.archive !=1 \
and 
s_courriel_utilisateur.domaine=s_courriel_domaine.id \

and s_courriel_domaine.nom = '%d' \
and ( s_courriel_utilisateur.utilisateur = '%n' 
or s_courriel_alias.alias  = '%n' )


Transaction debug for cedr...@mail.vdl with message added to file 
/var/spool/vmail/mail.vdl/cedrict


 SELECT 
concat("/vhome/",s_courriel_domaine.nom,"/home/",s_courriel_utilisateur.utilisateur) 
as home, 
concat("/vhome/",s_courriel_domaine.nom,"/home/",s_courriel_utilisateur.utilisateur,"/mail/index") 
as "index", 
concat("/vhome/",s_courriel_domaine.nom,"/home/",s_courriel_utilisateur.utilisateur,"/mail/control") 
as control, 
concat("/var/spool/vmail/",s_courriel_domaine.nom,"/",s_courriel_utilisateur.utilisateur) 
as inbox, "maildir++" as layout, s_courriel_utilisateur.uid as 
uid,s_courriel_domaine.gid as gid FROM s_courriel_utilisateur left join 
s_courriel_alias on 
s_courriel_utilisateur.id=s_courriel_alias.utilisateur and 
s_courriel_alias.archive !=1 ,s_courriel_domaine WHERE 
s_courriel_utilisateur.archive !=1 and s_courriel_domaine.archive !=1 
and s_courriel_utilisateur.domaine=s_courriel_domaine.id and 
s_courriel_domaine.nom = 'mail.vdl' and ( 
s_courriel_utilisateur.utilisateur = 'cedrict' or 
s_courriel_alias.alias  = 'cedrict');

+---

Re: [Dovecot] Dovecot 2.2.4 does not create home directory?

2013-07-17 Thread Dmitry .
Thank you very much! You are absolutely right.


2013/7/17 Axel Luttgens 

> Le 17 juil. 2013 à 16:11, "Dmitry ."  a écrit :
>
> >> Hello Dmitry,
> >>
> >> As a side note: the above documents Dovecot 1.x, and you're using 2.2.4.
> >>
> >
> > I thought that if it works in 1.x to 2.x then be all the more
>
> Probably. :-)
> But sometimes with incompatibilities.
>
>
> > [...]
> > /var/log/dovecot/dovecot.log
> > Jul 17 12:49:41 imap(t...@example.com): Error: user t...@example.com:
> > Initialization failed: Namespace '': mkdir(Maildir) in directory
> > /var/run/dovecot failed: Permission denied (euid=1202(dovecot)
> > egid=202(dovecot) missing +w perm: /var/run/dovecot, dir owned by 0:0
> > mode=0755)
>
> Aaaah!
>
> Those small details...
> I didn't notice it immediately in your original message:
>
> > user_query = SELECT \
> > concat('/var/spool/vmail/', home) AS home, \
> > concat('maildir:', maildir) AS mail \
>
> I guess you should have something like this:
>
> concat('maildir:~/', maildir) AS mail \
>
> HTH,
> Axel
>
>


Re: [Dovecot] Dovecot 2.2.4 does not create home directory?

2013-07-17 Thread Axel Luttgens
Le 17 juil. 2013 à 16:11, "Dmitry ."  a écrit :

>> Hello Dmitry,
>> 
>> As a side note: the above documents Dovecot 1.x, and you're using 2.2.4.
>> 
> 
> I thought that if it works in 1.x to 2.x then be all the more

Probably. :-)
But sometimes with incompatibilities.


> [...]
> /var/log/dovecot/dovecot.log
> Jul 17 12:49:41 imap(t...@example.com): Error: user t...@example.com:
> Initialization failed: Namespace '': mkdir(Maildir) in directory
> /var/run/dovecot failed: Permission denied (euid=1202(dovecot)
> egid=202(dovecot) missing +w perm: /var/run/dovecot, dir owned by 0:0
> mode=0755)

Aaaah!

Those small details...
I didn't notice it immediately in your original message:

> user_query = SELECT \
> concat('/var/spool/vmail/', home) AS home, \
> concat('maildir:', maildir) AS mail \

I guess you should have something like this:

concat('maildir:~/', maildir) AS mail \

HTH,
Axel



Re: [Dovecot] Dovecot 2.2.4 does not create home directory?

2013-07-17 Thread Rob Sterenborg (lists)

On 17-07-13 16:11, Dmitry . wrote:

Isn't the log actually saying what's wrong here?
(I didn't see a file listing that shows what owner/permissions are set.)


Initialization failed: Namespace '': mkdir(Maildir) in directory
/var/run/dovecot failed: Permission denied (euid=1202(dovecot)
egid=202(dovecot) missing +w perm: /var/run/dovecot, dir owned by 0:0
mode=0755)
Jul 17 12:49:41 imap(t...@example.com): Error: Invalid user settings. Refer
to server log for more information.


The log says:

- mkdir(Maildir) in directory /var/run/dovecot failed: Permission denied
  Dovecot couldn't create a directory in /var/run/dovecot. Personally,
  I would not want to create mail directories there, but if you're okay
  with it then I'm okay too.

- (euid=1202(dovecot) egid=202(dovecot)
  Dovecot is running as dovecot:dovecot (1202:202).

- missing +w perm: /var/run/dovecot, dir owned by 0:0 mode=0755)
  The base directory is owned by root:root with 755 permissions, so
  dovecot has no permission to write anything.

I'd choose another place where your mail directories are created and 
have the correct owner/permissions set.



--
Rob



Re: [Dovecot] Dovecot 2.2.4 does not create home directory?

2013-07-17 Thread Dmitry .
> Hello Dmitry,
>
> As a side note: the above documents Dovecot 1.x, and you're using 2.2.4.
>

I thought that if it works in 1.x to 2.x then be all the more

> This is a bit strange... are you really sure the home directory hasn't
been created?
> If yes, do you have some messages in your info.log?

Really ... unfortunately.

/var/log/dovecot/dovecot.info.log
Jul 17 12:49:41 imap-login: Info: Login: user=,
method=CRAM-MD5, rip=192.168.1.2, lip=192.168.1.1, mpid=10506,
session=

/var/log/dovecot/dovecot.log
Jul 17 12:49:41 imap(t...@example.com): Error: user t...@example.com:
Initialization failed: Namespace '': mkdir(Maildir) in directory
/var/run/dovecot failed: Permission denied (euid=1202(dovecot)
egid=202(dovecot) missing +w perm: /var/run/dovecot, dir owned by 0:0
mode=0755)
Jul 17 12:49:41 imap(t...@example.com): Error: Invalid user settings. Refer
to server log for more information.


2013/7/17 Axel Luttgens 

> Le 17 juil. 2013 à 14:32, "Dmitry ." a écrit :
>
> > Hi,
> >
> > [...]
> >
> > And yet, here
> > http://wiki.dovecot.org/HowTo/SimpleVirtualInstall
> > it is written
> > Users can be added by editing this file. Dovecot automatically notices
> the
> > new users immediately after they're added. It also creates their home
> > directories when the user logs in.
>
> Hello Dmitry,
>
> As a side note: the above documents Dovecot 1.x, and you're using 2.2.4.
>
>
> > However, the directory is not created.
> >
> > [...]
> > Jul 17 12:49:41 imap(t...@example.com): Debug: Effective uid=1202,
> gid=202,
> > home=/var/spool/vmail/example.com/test/
> > Jul 17 12:49:41 imap(t...@example.com): Debug: Home dir not found:
> > /var/spool/vmail/example.com/test/
> > Jul 17 12:49:41 imap(t...@example.com): Debug: Namespace inbox:
> > type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes,
> > subscriptions=yes location=maildir:Maildir/
> > Jul 17 12:49:41 imap(t...@example.com): Debug: maildir++: root=Maildir,
> > index=, indexpvt=, control=, inbox=Maildir, alt=
> > Jul 17 12:49:41 imap(t...@example.com): Debug: Namespace : Maildir
> doesn't
> > exist yet, using default permissions
> > Jul 17 12:49:41 imap(t...@example.com): Debug: Namespace : Using
> > permissions from Maildir: mode=0700 gid=default
>
> This is a bit strange... are you really sure the home directory hasn't
> been created?
> If yes, do you have some messages in your info.log?
>
> Axel
>
>
>


Re: [Dovecot] Variable similar to %u but providing the username changed by a database lookup?

2013-07-17 Thread Axel Luttgens
Le 5 juil. 2013 à 19:14, Axel Luttgens a écrit :

> [...]
> 
> Hello Steffen,
> 
> You helped me to look twice at those matters.
> So, it seems that variable %u (or, for what matters, even %n) indeed expands 
> to the value as changed thru a database lookup.
> 
> In fact, I now understand that I was struggling with a somewhat unexpected 
> behavior of the prefetch database, and that I failed to correctly interpret 
> the behaviors I was encountering.
> Will be a question for a next post. ;-)

Thanks to Timo (see http://www.dovecot.org/list/dovecot/2013-July/091315.html), 
that prefetch question has been solved.

But...
But this allowed me to track more narrowly a differing behavior of the prefetch 
and the user databases. If you allow, I'll try to explain what I mean.

Let's consider these settings from dovecot.conf:

mail_uid= dovemailer
mail_gid= dovemailer

mail_home   = /some/path/%u

plugin {
quota = dict:Quota utilisateur:%u:proxy::sql_quota
}

and a password query looking like this one:

password_query = \
SELECT \
passwd AS password, \
nickname AS user, \
mail_home AS userdb_home, \
[...]
WHERE \
[...]

John Doe, with nickname "john.doe" and a NULL mail_home, authenticates for a 
pop session as "u123456":

auth: Debug: auth client connected (pid=15516)
[...]
auth-worker(15518): Debug: auth(u123456,127.0.0.1): username changed 
u123456 -> john.doe
auth: Debug: auth(u123456,127.0.0.1,): username 
changed u123456 -> john.doe
[...]
auth: Debug: prefetch(john.doe,127.0.0.1,): success
[...]
pop3(john.doe): Debug: Effective uid=999, gid=999, 
home=/some/path/john.doe
pop3(john.doe): Debug: Quota root: name=Quota utilisateur backend=dict 
args=john.doe:proxy::sql_quota
[...]
pop3(john.doe): Disconnected: Logged out top=0/0, retr=0/0, del=0/92, 
size=144038

Note the "username changed" lines.
And it clearly appears that variable %u appearing in dovecot.conf has been 
expanded to the converted name ("john.doe"), not the original one ("u123456").

Let's now consider a userdb query similar to this one:

userdb_query = \
SELECT \
nickname AS user, \
mail_home AS userdb_home, \
[...]
WHERE \
[...]

and send a message to john@example.com:

lmtp(15823): Connect from local
[...]
auth: Debug: master in: USER1   john@example.com
service=lmtp
auth: Debug: prefetch(john@example.com): passdb didn't return 
userdb entries, trying the next userdb
[...]
auth-worker(15825): Debug: auth(john@example.com): username changed 
john@example.com -> john.doe
auth: Debug: userdb out: USER   1   john@example.com
lmtp(15823): Debug: auth input: john@example.com 
lmtp(15823): Debug: Added userdb setting: plugin/=yes
lmtp(15823, john@example.com): Debug: Effective uid=999, gid=999, 
home=/some/path/john@example.com
lmtp(15823, john@example.com): Debug: Quota root: name=Quota 
utilisateur backend=dict args=john@example.com:proxy::sql_quota
[...]
lmtp(15823): Disconnect from local: Successful quit

There's a "username changed" line too, leading to great hopes...
Yet, variable %u from dovecot.conf has been expanded to "john@example.com", 
not "john.doe".
And John Doe now has two mailboxes: one for receiving emails, the other for 
reading emails.

I understand I am on the fringe here, since the wiki doesn't say anything about 
the possible effects of a "AS username" (or "AS user") clause in the 
userdb_query.
On the other hand, this could also just reflect an omission in the 
documentation, since the "username changed" line written to the log tend to 
indicate there could/should be an effect.

Hence my question: what's the intended behavior?


TIA,
Axel

Re: [Dovecot] Dovecot 2.2.4 does not create home directory?

2013-07-17 Thread Axel Luttgens
Le 17 juil. 2013 à 14:32, "Dmitry ." a écrit :

> Hi,
> 
> [...]
> 
> And yet, here
> http://wiki.dovecot.org/HowTo/SimpleVirtualInstall
> it is written
> Users can be added by editing this file. Dovecot automatically notices the
> new users immediately after they're added. It also creates their home
> directories when the user logs in.

Hello Dmitry,

As a side note: the above documents Dovecot 1.x, and you're using 2.2.4.


> However, the directory is not created.
> 
> [...]
> Jul 17 12:49:41 imap(t...@example.com): Debug: Effective uid=1202, gid=202,
> home=/var/spool/vmail/example.com/test/
> Jul 17 12:49:41 imap(t...@example.com): Debug: Home dir not found:
> /var/spool/vmail/example.com/test/
> Jul 17 12:49:41 imap(t...@example.com): Debug: Namespace inbox:
> type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes,
> subscriptions=yes location=maildir:Maildir/
> Jul 17 12:49:41 imap(t...@example.com): Debug: maildir++: root=Maildir,
> index=, indexpvt=, control=, inbox=Maildir, alt=
> Jul 17 12:49:41 imap(t...@example.com): Debug: Namespace : Maildir doesn't
> exist yet, using default permissions
> Jul 17 12:49:41 imap(t...@example.com): Debug: Namespace : Using
> permissions from Maildir: mode=0700 gid=default

This is a bit strange... are you really sure the home directory hasn't been 
created?
If yes, do you have some messages in your info.log?

Axel




Re: [Dovecot] Fail2ban and logging

2013-07-17 Thread Paul van der Vlis
Hello Mark (and others),

On 16-07-13 05:00, Mark Sapiro wrote:
> On 07/15/2013 09:09 AM, Paul van der Vlis wrote:
>>
>> Are you blocked when you login a few times with a wrong password?
>>
>> I expect your log will say something like "auth failed, 22 attempts in
>> 30 secs", and fail2ban will see that as 1 authentications error, so will
>> not block you.
> 
> 
> I am blocked. The log says
> 
> Jul 15 19:36:06 sbh16 dovecot: pop3-login: Aborted login (auth failed, 1
> attempts in 2 secs): user=, method=APOP, rip=98.248.186.228,
> lip=72.52.113.16, TLS, session=
> 
> Jul 15 19:36:16 sbh16 dovecot: pop3-login: Aborted login (auth failed, 1
> attempts in 6 secs): user=, method=APOP, rip=98.248.186.228,
> lip=72.52.113.16, TLS, session=
> 
> Jul 15 19:36:29 sbh16 dovecot: pop3-login: Aborted login (auth failed, 1
> attempts in 10 secs): user=, method=APOP, rip=98.248.186.228,
> lip=72.52.113.16, TLS, session=
> 
> Jul 15 19:36:49 sbh16 dovecot: pop3-login: Aborted login (auth failed, 1
> attempts in 17 secs): user=, method=APOP, rip=98.248.186.228,
> lip=72.52.113.16, TLS, session=
> 
> Jul 15 19:37:09 sbh16 dovecot: pop3-login: Aborted login (auth failed, 1
> attempts in 17 secs): user=, method=APOP, rip=98.248.186.228,
> lip=72.52.113.16, TLS, session=
> 
> 
> The difference may be that I am connecting to pop3s, port 995 with SSL,
> not port 110 with STARTTLS.

What wonders me is that every attempt is logged. With me the attemps are
counted together.  I think it's not very important which port or
protocol is used.

With regards,
Paul van der Vlis.





-- 
Paul van der Vlis Linux systeembeheer, Groningen
http://www.vandervlis.nl/



Re: [Dovecot] Dovecot 2.2.4 does not create home directory?

2013-07-17 Thread Odhiambo Washington
The MTA/MDA creates home directories during delivery.


On 17 July 2013 15:32, Dmitry .  wrote:

> Hi,
>
> Does not create, or something I did wrong?
>
> Here
> http://wiki2.dovecot.org/VirtualUsers/Home
> it is written
>
> Home vs. mail directory
> Home directory shouldn't be the same as mail directory. It's possible to do
> that, but you might run into trouble with it sooner or later. Some problems
> with this are:
>
> and
>
> Ways to set up home directory
> The home directory is the same as the mail directory.
> If for example home=/var/vmail/domain/user/
> mail=/var/vmail/domain/user/mail/, set:
> mail_home = /var/vmail/%d/%n
> mail_location = maildir:~/mail
>
> I think I've done it so.
>
> And yet, here
> http://wiki.dovecot.org/HowTo/SimpleVirtualInstall
> it is written
> Users can be added by editing this file. Dovecot automatically notices the
> new users immediately after they're added. It also creates their home
> directories when the user logs in.
>
> However, the directory is not created.
>
> My config:
>
> # dovecot -n
> # 2.2.4: /etc/dovecot/dovecot.conf
> # OS: Linux 3.9.6 x86_64 Slackware 14.0
> auth_debug = yes
> auth_debug_passwords = yes
> auth_mechanisms = plain login digest-md5 cram-md5 rpa apop
> auth_verbose = yes
> auth_verbose_passwords = plain
> debug_log_path = /var/log/dovecot/dovecot.debug.log
> disable_plaintext_auth = no
> info_log_path = /var/log/dovecot/dovecot.info.log
> lda_mailbox_autocreate = yes
> listen = 192.168.1.1
> log_path = /var/log/dovecot/dovecot.log
> mail_debug = yes
> mail_gid = dovecot
> mail_uid = dovecot
> managesieve_notify_capability = mailto
> managesieve_sieve_capability = fileinto reject envelope encoded-character
> vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
> copy include variables body enotify environment mailbox date ihave
> namespace inbox {
>   inbox = yes
>   location =
>   mailbox Drafts {
> auto = subscribe
> special_use = \Drafts
>   }
>   mailbox Sent {
> auto = subscribe
> special_use = \Sent
>   }
>   mailbox Spam {
> auto = subscribe
> special_use = \Junk
>   }
>   mailbox Trash {
> auto = subscribe
> special_use = \Trash
>   }
>   prefix =
> }
> passdb {
>   args = /etc/dovecot/dovecot-sql.conf
>   driver = sql
> }
> plugin {
>   antispam_allow_append_to_spam = NO
>   antispam_backend = dspam
>   antispam_debug_target = syslog
>   antispam_dspam_args =
> --user;%Lu;--deliver=;--source=error;--signature=%%s
>   antispam_dspam_binary = /usr/bin/dspam
>   antispam_dspam_notspam = --class=innocent
>   antispam_dspam_result_blacklist = Virus;Blocklisted;Blacklisted
>   antispam_dspam_result_header = X-DSPAM-Result
>   antispam_dspam_spam = --class=spam
>   antispam_signature = X-DSPAM-Signature
>   antispam_signature_missing = move
>   antispam_skip_from_line = NO
>   antispam_spam = Spam;spam;SPAM;Junk;junk;JUNK;
>   antispam_trash = Trash;trash;Deleted;deleted;Deleted Items;Deleted
> Messages;
>   antispam_verbose_debug = 1
>   sieve = ~/.dovecot.sieve
>   sieve_default = /etc/dovecot/sieve/default.sieve
>   sieve_dir = ~/sieve
>   sieve_global_dir = /etc/dovecot/sieve/
> }
> protocols = imap pop3 lmtp sieve
> service lmtp {
>   inet_listener lmtp {
> address = 127.0.0.1
> port = 24
>   }
> }
> service managesieve-login {
>   inet_listener sieve {
> port = 4190
>   }
> }
> ssl_cert =  ssl_key =  userdb {
>   args = /etc/dovecot/dovecot-sql.conf
>   driver = sql
> }
> verbose_ssl = yes
> protocol lmtp {
>   mail_plugins = " sieve"
> }
> protocol lda {
>   mail_plugins = " sieve"
> }
> protocol imap {
>   mail_max_userip_connections = 15
>   mail_plugins = " antispam"
> }
> protocol imaps {
>   mail_max_userip_connections = 15
>   mail_plugins = " antispam"
> }
>
>
> # grep -v '^ *\(#.*\)\?$' dovecot-sql.conf
> driver = pgsql
> connect = host=localhost dbname=dbname user=user password=password
> default_pass_scheme = PLAIN
> password_query = SELECT password FROM users WHERE email = '%u' AND enabled
> = 1
> user_query = SELECT \
> concat('/var/spool/vmail/', home) AS home, \
> concat('maildir:', maildir) AS mail \
> FROM users WHERE email = '%u' AND enabled = 1
>
> where in db
> home = "example.com/test/"
> maildir = "Maildir/"
>
> /etc/passwd
> dovecot:x:1202:202:Dovecot:/dev/null:/bin/bash
> dovenull:x:1203:203:Dovenull:/dev/null:/bin/false
>
> /etc/group
> dovecot:x:202:
> dovenull:x:203:
>
> cd /var/spool
> # ls -l
> drwxrwxr-x 4 dovecot dovecot  4096 Jul 17 12:41 vmail
>
>
> /var/log/dovecot/dovecot.debug.log
>
> Jul 17 12:49:41 auth: Debug: Loading modules from directory:
> /usr/lib64/dovecot/auth
> Jul 17 12:49:41 auth: Debug: Read auth token secret from
> /var/run/dovecot/auth-token-secret.dat
> Jul 17 12:49:41 auth: Debug: auth client connected (pid=10501)
> Jul 17 12:49:41 auth: Debug: client in: AUTH1   CRAM-MD5
> service=imapsession=RONGFqLhrgDAqAPOlip=192.168.1.1
> rip=192.168.1.2  lport=143   rport=50094
> Jul 17 12:49:41 aut

[Dovecot] Dovecot 2.2.4 does not create home directory?

2013-07-17 Thread Dmitry .
Hi,

Does not create, or something I did wrong?

Here
http://wiki2.dovecot.org/VirtualUsers/Home
it is written

Home vs. mail directory
Home directory shouldn't be the same as mail directory. It's possible to do
that, but you might run into trouble with it sooner or later. Some problems
with this are:

and

Ways to set up home directory
The home directory is the same as the mail directory.
If for example home=/var/vmail/domain/user/
mail=/var/vmail/domain/user/mail/, set:
mail_home = /var/vmail/%d/%n
mail_location = maildir:~/mail

I think I've done it so.

And yet, here
http://wiki.dovecot.org/HowTo/SimpleVirtualInstall
it is written
Users can be added by editing this file. Dovecot automatically notices the
new users immediately after they're added. It also creates their home
directories when the user logs in.

However, the directory is not created.

My config:

# dovecot -n
# 2.2.4: /etc/dovecot/dovecot.conf
# OS: Linux 3.9.6 x86_64 Slackware 14.0
auth_debug = yes
auth_debug_passwords = yes
auth_mechanisms = plain login digest-md5 cram-md5 rpa apop
auth_verbose = yes
auth_verbose_passwords = plain
debug_log_path = /var/log/dovecot/dovecot.debug.log
disable_plaintext_auth = no
info_log_path = /var/log/dovecot/dovecot.info.log
lda_mailbox_autocreate = yes
listen = 192.168.1.1
log_path = /var/log/dovecot/dovecot.log
mail_debug = yes
mail_gid = dovecot
mail_uid = dovecot
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
copy include variables body enotify environment mailbox date ihave
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
auto = subscribe
special_use = \Drafts
  }
  mailbox Sent {
auto = subscribe
special_use = \Sent
  }
  mailbox Spam {
auto = subscribe
special_use = \Junk
  }
  mailbox Trash {
auto = subscribe
special_use = \Trash
  }
  prefix =
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
plugin {
  antispam_allow_append_to_spam = NO
  antispam_backend = dspam
  antispam_debug_target = syslog
  antispam_dspam_args = --user;%Lu;--deliver=;--source=error;--signature=%%s
  antispam_dspam_binary = /usr/bin/dspam
  antispam_dspam_notspam = --class=innocent
  antispam_dspam_result_blacklist = Virus;Blocklisted;Blacklisted
  antispam_dspam_result_header = X-DSPAM-Result
  antispam_dspam_spam = --class=spam
  antispam_signature = X-DSPAM-Signature
  antispam_signature_missing = move
  antispam_skip_from_line = NO
  antispam_spam = Spam;spam;SPAM;Junk;junk;JUNK;
  antispam_trash = Trash;trash;Deleted;deleted;Deleted Items;Deleted
Messages;
  antispam_verbose_debug = 1
  sieve = ~/.dovecot.sieve
  sieve_default = /etc/dovecot/sieve/default.sieve
  sieve_dir = ~/sieve
  sieve_global_dir = /etc/dovecot/sieve/
}
protocols = imap pop3 lmtp sieve
service lmtp {
  inet_listener lmtp {
address = 127.0.0.1
port = 24
  }
}
service managesieve-login {
  inet_listener sieve {
port = 4190
  }
}
ssl_cert = ):
query: SELECT password FROM users WHERE email = 't...@example.com' AND
enabled = 1
Jul 17 12:49:41 auth: Debug:
password(t...@example.com,192.168.1.2,):
Generating CRAM-MD5 from user 't...@example.com@', password 'test'
Jul 17 12:49:41 auth: Debug:
password(t...@example.com,192.168.1.2,):
Credentials:
6062bc903ac97de43f0b5d33ebe8c1a63bb9ae1a88ec39cf6fd85a645de8c63a
Jul 17 12:49:41 auth: Debug: client passdb out: OK  1   user=
t...@example.com

Jul 17 12:49:41 auth: Debug: master in: REQUEST 2206334977  10501
1   49e1fcdcc5e1c2becb50c3b47d31cdebsession_pid=10506
Jul 17 12:49:41 auth: Debug:
sql(t...@example.com,192.168.1.2,):
SELECT concat('/var/spool/vmail/', home) AS home, concat('maildir:',
maildir) AS mail FROM users WHERE email = 't...@example.com' AND enabled = 1
Jul 17 12:49:41 auth: Debug: master userdb out: USER2206334977
t...@example.com  home=/var/spool/vmail/example.com/test/
mail=maildir:Maildir/  auth_token=670c839af976e3c0c74db1754e28ff40a2557095
Jul 17 12:49:41 imap: Debug: Loading modules from directory:
/usr/lib64/dovecot
Jul 17 12:49:41 imap: Debug: Module loaded:
/usr/lib64/dovecot/lib90_antispam_plugin.so
Jul 17 12:49:41 imap: Debug: Added userdb setting: mail=maildir:Maildir/
Jul 17 12:49:41 imap(t...@example.com): Debug: Effective uid=1202, gid=202,
home=/var/spool/vmail/example.com/test/
Jul 17 12:49:41 imap(t...@example.com): Debug: Home dir not found:
/var/spool/vmail/example.com/test/
Jul 17 12:49:41 imap(t...@example.com): Debug: Namespace inbox:
type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes,
subscriptions=yes location=maildir:Maildir/
Jul 17 12:49:41 imap(t...@example.com): Debug: maildir++: root=Maildir,
index=, indexpvt=, control=, inbox=Maildir, alt=
Jul 17 12:49:41 imap(t...@example.com): Debug: Namespace : Maildir doesn't
exist yet, using default permissions
Jul 17 12:49:41 imap(t...@example.com): Debug: Namespace : Us