1 (edited by Clouseau 2014-01-07 18:16:53)

Topic: Local and virtual users - aliases

Hi,

I have this error http://www.iredmail.org/forum/topic3533 … ap172.html

I have virtual users with OpenLDAP backend. iRedMail is upgraded to latest.

I have this in my /etc/postfix/aliases:

...
monit: root
root: user1@gmail.com, user2
...

mail for root arrives to user1@gmail.com but not to user2 which is local account, errors I get are the same as in link above. Is it possible that mail be delivered to local account while I have virtual users? Or maybe is the permission problem on Maildir:

> ls -la /home/user2
...
drwx------  5 user2 user2  4096 Dec 19 16:05 Maildir
...

Tnx.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Local and virtual users - aliases

Any related log in Postfix log when you sent email to root user?

3

Re: Local and virtual users - aliases

ZhangHuangbin wrote:

Any related log in Postfix log when you sent email to root user?

Jan  7 06:25:30  postfix/qmgr[18188]: 9101A20B82D2: from=<root@domain.org>, size=632, nrcpt=1 (queue active)
Jan  7 06:25:30  postfix/local[18199]: 9101A20B82D2: to=<user2@myhostname(fqdn)>, relay=local, delay=2.3, delays=2.2/0/0/0.11, dsn=4.3.0, status=deferred (temporary failure)

root@domain.org and myhostname(fqdn) was changed because of security reasons. myshotname(fqdn) is sample.domain.org

And this is when monit sends mail to root:

Jan  7 06:34:42  amavis[18247]: (18247-01) Passed CLEAN {RelayedInternal}, MYNETS LOCAL [127.0.0.1]:15980 [127.0.0.1] <monit@domain.org> -> <root@myhostname(fqdn)>, Queue-ID: 835DF20B82CF, Message-ID: <1389072880.474285756@myhostname(fqdn)>, mail_id: 7_RMstXN5b0g, Hits: -2.892, size: 534, queued_as: 7229F20B82D1, dkim_new=dkim:domain.org, 1915 ms
Jan  7 06:34:42  postfix/smtp[18414]: 835DF20B82CF: to=<root@myhostname(fqdn)>, relay=127.0.0.1[127.0.0.1]:10024, delay=2.1, delays=0.1/0/0.01/2, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 7229F20B82D1)

Btw. if I comment out in aliases:
#root: user1@gmail.com, user2
the same message from sieve log then refers to root account and mail for root doesn't arrive...

4

Re: Local and virtual users - aliases

Clouseau wrote:

Jan  7 06:25:30  postfix/local[18199]: 9101A20B82D2: to=<user2@myhostname(fqdn)>, relay=local, delay=2.3, delays=2.2/0/0/0.11, dsn=4.3.0, status=deferred (temporary failure)

Obviously, you don't have an entry in /etc/postfix/aliases for local user 'user2', so Postfix doesn't know which email address it should forward to.

Could you please show us full content of /etc/postfix/aliases? Please remove comment lines, and hide/replace sensitive info before pasting.

5 (edited by Clouseau 2014-01-07 21:58:17)

Re: Local and virtual users - aliases

ZhangHuangbin wrote:
Clouseau wrote:

Jan  7 06:25:30  postfix/local[18199]: 9101A20B82D2: to=<user2@myhostname(fqdn)>, relay=local, delay=2.3, delays=2.2/0/0/0.11, dsn=4.3.0, status=deferred (temporary failure)

Obviously, you don't have an entry in /etc/postfix/aliases for local user 'user2', so Postfix doesn't know which email address it should forward to.

Could you please show us full content of /etc/postfix/aliases? Please remove comment lines, and hide/replace sensitive info before pasting.

I have the entry but here is the whole section:

cat postfix/aliases

mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www-data: root
www: root
ftp: root
abuse: root
noc: root
security: root
clamav: root
virusalert: root
spamalert: root
policyd: www@domain.org
amavis: root
monit: root
root: me@mymaildoman.com, james

me@mymaildomain.com - this is my outside mail account on which root mail arrives and this works
user2 is james and he is a local(system) user, root mail doesn't arrive

6

Re: Local and virtual users - aliases

You don't have entry for local user 'james' in /etc/postfix/aliases. Adding one for it should fix your issue. For example:

james: other@domain.com

7 (edited by Clouseau 2014-01-07 22:47:30)

Re: Local and virtual users - aliases

ZhangHuangbin wrote:

You don't have entry for local user 'james' in /etc/postfix/aliases. Adding one for it should fix your issue. For example:

james: other@domain.com

Hmh, I think we have misunderstood. Lets say my domain is frx.com. And lets say my server name is server.frx.com.

On this server,frx.com I have debian wheezy and iRedMail, for couple of years now. It was recently upgraded to wheezy and latest iredmail through upgrade toutorials. On server I have a couple of local users(one is james) so they can access server from outside over ssh and etc. + bunch of virtual mail users. I want the mail that is ment for root to be forwarded to one outside mail and to a mailbox of a local user james.  Forwarding mail to outside works but user james doesn't get mail to his local mailbox on server. I mean, when he log in over ssh he isn't welcomed wiht "You have x mail." And after it he could just use mutt or alpine to read it...

If I put:
- root: james in aliases it would be the same if I put root: james@server.frx.com because this means deliver mail locally
If I put:
- root: james@frx.com - this is a virtual user mail account so root mail would be forwarded to virtual user mailbox james if it existed and I don't want that because user james doesn't exist in LDAP base and it is not a virtual user.

So is it possible that a local user account james accepts all mail for root?

On my other servers where postfix is installed, in aliases I don't have -> james: other@domain.com because I want mail to be kept local. I just have root: james and mail arrives locally to james mailbox on server and it works.

Btw. as I can see in james malbox this started to happen after I upgraded to wheezy. During upgrade I didn't change main.cf of postfix but dovecot had to be changed to dovecot2 so configuration had to be modified of dovecot.conf...

8

Re: Local and virtual users - aliases

iRedMail configures Postfix to use Maildir/ format mailbox, so it doesn't deliver to mbox by default. That's why you can use mutt to read email.

9 (edited by Clouseau 2014-01-08 16:46:30)

Re: Local and virtual users - aliases

ZhangHuangbin wrote:

iRedMail configures Postfix to use Maildir/ format mailbox, so it doesn't deliver to mbox by default. That's why you can use mutt to read email.

Yes, but there is no mail for local user which can be read with mutt...

I still don't know why mail is not delivered to local users on my iRedMail server, I have to use alias in /etc/postfix/aliases to external mail accounts to read mail for root. If I alias root mail to local user account it doesn't get delivered...

This is my dovecot and procmail entry in master.cf of postfix so maybe it can help for debugging:

dovecot unix    -       n       n       -       -      pipe
    flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${domain}
procmail unix    -       n       n       -       -      pipe
  flags=DRhu user=vmail:vmail argv=/usr/bin/procmail -r -t SENDER=${sender} RECIPIENT=${recipient} DOMAIN=${nexthop} -m USER=${user} EXTENSION=${extension} /etc/procmailrc

EDIT: mail -s "test" james < /etc/hosts - this doesn't work, I have the same error in sieve.log... local delivery doesn't work, only to virtual users.

10

Re: Local and virtual users - aliases

Clouseau wrote:

Jan  7 06:25:30  postfix/local[18199]: 9101A20B82D2: to=<user2@myhostname(fqdn)>, relay=local, delay=2.3, delays=2.2/0/0/0.11, dsn=4.3.0, status=deferred (temporary failure)

Postfix correctly find this user and use 'local' as transport. Could you please paste FULL log in Postfix log file related to this testing email?

11

Re: Local and virtual users - aliases

ZhangHuangbin wrote:
Clouseau wrote:

Jan  7 06:25:30  postfix/local[18199]: 9101A20B82D2: to=<user2@myhostname(fqdn)>, relay=local, delay=2.3, delays=2.2/0/0/0.11, dsn=4.3.0, status=deferred (temporary failure)

Postfix correctly find this user and use 'local' as transport. Could you please paste FULL log in Postfix log file related to this testing email?

mail -s "test" james < /etc/hosts

Jan  8 16:07:07 name postfix/pickup[29695]: 8475C20B829A: uid=0 from=<root>
Jan  8 16:07:07 name postfix/cleanup[30020]: 8475C20B829A: message-id=<20140108150707.8475C20B829A@name.mydomain.com>
Jan  8 16:07:07 name postfix/qmgr[659]: 8475C20B829A: from=<root@mydomain.com>, size=540, nrcpt=1 (queue active)
Jan  8 16:07:07 name postfix/local[30746]: 8475C20B829A: to=<james@name.mydomain.com>, relay=local, delay=0.18, delays=0.1/0.01/0/0.06, dsn=4.3.0, status=deferred (temporary failure)

and sieve.log says:
Jan 08 16:07:07 lda(james): Fatal: setgid(2058(vmail) from mail_gid setting) failed with euid=2062(james), gid=2062(james), egid=2062(james): Operation not permitted (This binary should probably be called with process group set to 2058(vmail) instead of 2062(james))

12

Re: Local and virtual users - aliases

I don't understand.

Postfix transport "local" is defined in /etc/postfix/master.cf, if it uses "local" as transport, it should not be delivered by Dovecot LDA.
Could you please show me output of below commands?

# postconf local_transport
# postconf mydestination
# grep '^local' /etc/postfix/master.cf

Again, please hide/replace sensitive info before posting.

13

Re: Local and virtual users - aliases

main.cf:
local_transport = local:$myhostname
mydestination = $myhostname, mail.domain.org, lists.domain.org, localhost, localhost.localdomain, localhost.$myhostname, localhost.$mydomain
myhostname = name.domain.org

mail.domain.org is A record in my DNS for my server aka $myhostname. And mail.domain.org is my smtp and it's binded to virtual interface.
lists.domain.org is a CNAME record in my DNS that is virtual host for mailman. That all works for years...

grep '^local' /etc/postfix/master.cf
local     unix  -       n       n       -       -       local

14

Re: Local and virtual users - aliases

OK, everything looks just fine.
With current Dovecot setting, Dovecot doesn't support deliver email to mbox, it uses Maildir instead.

15

Re: Local and virtual users - aliases

ZhangHuangbin wrote:

OK, everything looks just fine.
With current Dovecot setting, Dovecot doesn't support deliver email to mbox, it uses Maildir instead.

OK... But there is no mail for local user james in /home/james/Maildir... So this is ok, local delivery to local user mailbox cannot work when using virtual users?

Virtual users have there mail in /var/vmail/vmail01/domain.org/...

16

Re: Local and virtual users - aliases

I think we didn't resolved this question or I didn't understand smile

17

Re: Local and virtual users - aliases

No, we didn't solve it.

How about use alternative solutions? For example, use mutt to access mailbox of some virtual mail user?

18

Re: Local and virtual users - aliases

Hmh, that isn't the problem, I can access mailboxes of virtual users... The problem is that local user james which has account on my server doesn't get mails for root. I have to use james gmail  account so he can read mails for root and I have to edit /etc/postfix/aliases to get it work:

root: james@gmail.com

If I put "root: james" instead, he cannot read them because above problems occur, there is no local delivery to local accounts. If this cannot be resolved I can only conclude that mail delivery to local users doesn't work if there are virtual users configured on server...