Страница 1 из 1

Postfix + Dovecot uid и gid пользователя

Добавлено: 2012-04-04 19:28:19
artellab
Postfix + Dovecot нужно чтобы у создаваемых директориях виртуальных пользователей проставлялся UID и GID указанного пользователя..

web1 - gid и uid = 1000 - надо проставить эти GID и UID
vmail - gid и uid = 1002 - под этим пользователем у меня работает dovecot

Полагаю нужно как-то пускать dovecot не от пользователя vmail а от получаемого из БД или еще откуда-то.

Пока сделал так для теста, через static:

postfix main.cf.

Код: Выделить всё

virtual_uid_maps=static:1000 
virtual_gid_maps=static:1000
master.cf

Код: Выделить всё

dovecot unix - n n - - pipe 
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient} 
dovecot.conf

Код: Выделить всё

userdb static { 
 args = uid=1000 gid=1000 home=/var/vmail/%d/%n allow_all_users=yes 
 } 


 socket listen { 
 master { 
 path = /var/run/dovecot/auth-master 
 mode = 0666 
 user = vmail 
 } 
 client { 
 path = /var/spool/postfix/private/auth 
 mode = 0660 
 user = postfix 
 group = postfix 
 } 
 }


Приведены части конфигов, т.к. затык именно тут =)

лог говорит ошибку

Код: Выделить всё

2012-04-03 03:12:32 deliver(test@example.com): Fatal: setgid(1000(web1)) failed with euid=1002(vmail), gid=1002(vmail), egid=1002(vmail): Operation not permitted (This binary should probably be called with process group set to 1000(web1) instead of 1002(vmail)) 

Как заставить dovecot выставлять нужные UID и GID на директории пользователей? Может права где-то я забыл выставить?

Re: Postfix + Dovecot uid и gid пользователя

Добавлено: 2012-04-04 20:21:18
artellab
Вот что помогло.
Multiple UIDs

If you're using more than one UID for users, you're going to have problems running deliver, as most MTAs won't let you run deliver as root. There are two ways to work around this problem:
Make deliver setuid-root.
Use sudo to wrap the invocation of deliver.

Making deliver setuid-root:

Beware: it's insecure to make deliver setuid-root, especially if you have untrusted users in your system. Setuid-root deliver can be used to gain root privileges. You should take extra steps to make sure that untrusted users can't run it and potentially gain root privileges. You can do this by making sure only your MTA has execution access to it. For example:

# chgrp secmail /usr/local/libexec/dovecot/deliver
# chmod 04750 /usr/local/libexec/dovecot/deliver
# ls -l /usr/local/libexec/dovecot/deliver
-rwsr-x--- 1 root secmail 4023932 2009-01-15 16:23 deliver

Then start deliver as a user that belongs to secmail group. Note that you have to recreate these rights after each update of dovecot.