Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

postfix+cyrus+mailbox does not exist

428 views
Skip to first unread message

Kim Emax

unread,
Oct 28, 2005, 4:36:25 PM10/28/05
to
Hi

For the last couple of years I´ve been using postfix along with
courier-imap, but now I´m going to switch to cyrus, and have followed
the guide from postfix.org -> doc -> Postfix+Cyrus+Web-cyradm howto by
Luc de Louw (http://www.delouw.ch/linux/postfix.phtml)

However that causes me some trouble, when I send testmails, they´re
bounced with "Mailbox does not exist". I can´t see what I´ve missed (or
if it´s a postfix or cyrus problem for that matter :-) Anyone running a
similar setup, who´s got a clue?

Here´s a bit of the maillog:
Oct 28 11:58:27 serv010 postfix/pickup[4515]: 6870E5F0054: uid=0 from=<root>
Oct 28 11:58:27 serv010 postfix/cleanup[4577]: 6870E5F0054:
message-id=<2005102809582...@emax.dk>
Oct 28 11:58:27 serv010 postfix/qmgr[4516]: 6870E5F0054:
from=<ro...@emax.dk>, size=279, nrcpt=1 (queue active)
Oct 28 11:58:27 serv010 postfix/pipe[4583]: 6870E5F0054:
to=<em...@emax.dk>, orig_to=<kim...@emax.dk>, relay=cyrus, delay=0,
status=bounced (data format error. Command output: emax: Mailbox does
not exist )
Oct 28 11:58:27 serv010 postfix/cleanup[4577]: 7890D5F0055:
message-id=<2005102809582...@emax.dk>
Oct 28 11:58:27 serv010 postfix/qmgr[4516]: 7890D5F0055: from=<>,
size=1968, nrcpt=1 (queue active)
Oct 28 11:58:27 serv010 postfix/qmgr[4516]: 6870E5F0054: removed
Oct 28 11:58:27 serv010 postfix/pipe[4583]: 7890D5F0055:
to=<ro...@emax.dk>, relay=cyrus, delay=0, status=bounced (data format
error. Command output: root: Mailbox does not exist )
Oct 28 11:58:27 serv010 postfix/qmgr[4516]: 7890D5F0055: removed

master.cf:
<snip></snip>
lmtp unix - - n - - lmtp
<snip></snip>
old-cyrus unix - n n - - pipe
flags= user=cyrus argv=/usr/cyrus/bin/deliver -r ${sender} -m
${extension} ${user}

# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
cyrus unix - n n - - pipe
flags= user=cyrus argv=/usr/cyrus/bin/deliver -r ${sender} -m
${extension} ${user}

cyrus.conf:
# standard standalone server implementation

START {
# do not delete this entry!
recover cmd="ctl_cyrusdb -r"

# this is only necessary if using idled for IMAP IDLE
# idled cmd="idled"
}

# UNIX sockets start with a slash and are put into /var/imap/socket
SERVICES {
# add or remove based on preferences
imap cmd="imapd" listen="192.168.1.5:imap" prefork=0
imaplocal cmd="imapd -C /etc/imapd-local.conf"
listen="127.0.0.1:imap" prefork=0
imaps cmd="imapd -s" listen="192.168.1.5:imaps" prefork=0
imapslocal cmd="imapd -C /etc/imapd-local.conf"
listen="127.0.0.1:imaps" prefork=0
pop3 cmd="pop3d" listen="pop3" prefork=0
pop3s cmd="pop3d -s" listen="pop3s" prefork=0
sieve cmd="timsieved" listen="192.168.1.5:sieve" prefork=0
sievelocal cmd="timsieved -C /etc/imapd-local.conf
listen="127.0.0.1:sieve" prefork=0

# at least one LMTP is required for delivery
# lmtp cmd="lmtpd" listen="lmtp" prefork=0
lmtpunix cmd="lmtpd" listen="/var/imap/socket/lmtp" prefork=1

# this is only necessary if using notifications
# notify cmd="notifyd" listen="/var/imap/socket/notify"
proto="udp" prefork=1
}

EVENTS {
# this is required
checkpoint cmd="ctl_cyrusdb -c" period=30

# this is only necessary if using duplicate delivery suppression
delprune cmd="ctl_deliver -E 3" period=1440

# this is only necessary if caching TLS sessions
tlsprune cmd="tls_prune" period=1440
}

imapd.conf:
postmaster: postmaster
configdirectory: /var/imap
partition-default: /var/spool/imap
# admins: cyrus # no admins!
allowanonymouslogin: no
allowplaintext: yes
sasl_mech_list: PLAIN
servername: masterminds.dk
autocreatequota: 20480
reject8bit: no
quotawarn: 90
timeout: 30
poptimeout: 10
dracinterval: 0
drachost: localhost
sasl_pwcheck_method: saslauthd
sievedir: /usr/sieve
sendmail: /usr/sbin/sendmail
sieve_maxscriptsize: 32
sieve_maxscripts: 5

# unixhierarchysep: yes« is only used if you like to have usernames like
»hans.mueller.somedomain.tld«
# 28/10-2005: removed the outcomment and make sure this is set to no
unixhierarchysep: no

imapd-local.conf:
postmaster: postmaster
configdirectory: /var/imap
partition-default: /var/spool/imap
admins: cyrus
allowanonymouslogin: no
allowplaintext: yes
sasl_mech_list: PLAIN
servername: masterminds.dk
autocreatequota: 20480
reject8bit: no
quotawarn: 90
timeout: 30
poptimeout: 10
dracinterval: 0
drachost: localhost
sasl_pwcheck_method: saslauthd
sievedir: /usr/sieve
sendmail: /usr/sbin/sendmail
sieve_maxscriptsize: 32
sieve_maxscripts: 5
# 28/10-2005: removed the outcomment and make sure this is set to no
unixhierarchysep: no


[root@serv010 root]# postconf -n
2bounce_notice_recipient = postm...@ayianapa.dk
alias_maps = hash:/etc/aliases
body_checks = regexp:/etc/postfix/securitysage/body_checks
bounce_notice_recipient = postm...@ayianapa.dk
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
delay_notice_recipient = postm...@ayianapa.dk
disable_vrfy_command = yes
error_notice_recipient = postm...@ayianapa.dk
header_checks = regexp:/etc/postfix/block255,
regexp:/etc/postfix/header_checks,
regexp:/etc/postfix/securitysage/header_checks
html_directory = no
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailbox_transport = cyrus
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/share/man
mime_header_checks = regexp:/etc/postfix/mime_header_checks
mydestination = $myhostname, $mynetworks, localhost.$mydomain,
$transport_maps
mydomain = $myhostname
myhostname = emax.dk
mynetworks = 192.168.1.0/24, 127.0.0.0/8, 213.237.12.252/32,
213.84.242.68/32, 195.135.219.0/24, 81.7.149.95/32, 85.82.1.250/32,
195.135.216.0/24
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
recipient_delimiter = +
relay_domains = $mydestination
sample_directory = /etc/postfix
sender_canonical_maps = mysql:/etc/postfix/mysql-canonical.cf
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
unknown_local_recipient_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf

mysql> select * from virtual;
+------------------+------+----------+--------+
| alias | dest | username | status |
+------------------+------+----------+--------+
| ro...@emax.dk | root | root | 1 |
| kim...@emax.dk | emax | emax | 1 |
+------------------+------+----------+--------+

mysql> select * from accountuser;
+----------+---------------+--------+-------------+
| username | password | prefix | domain_name |
+----------+---------------+--------+-------------+
| cyrus | KuugKb.lIBFX2 | | |
| emax | 09F5EN7.iqzBw | www. | emax.dk |
| root | 09F5EN7.iqzBw | www. | emax.dk |
+----------+---------------+--------+-------------+

[root@serv010 root]# ps -ax | egrep "(sasl|mysql|imap|postfix|cyrus)"
2300 ? S 0:00 /bin/sh /usr/bin/mysqld_safe
--datadir=/var/lib/mysql
--pid-file=/var/lib/mysql/serv010.masterminds.dk.pid
2329 ? S 0:00 [mysqld]
2350 ? S 0:00 [mysqld]
2351 ? S 0:00 [mysqld]
2352 ? S 0:00 [mysqld]
2353 ? S 0:00 [mysqld]
2354 ? S 0:00 [mysqld]
2355 ? S 0:00 [mysqld]
2356 ? S 0:00 [mysqld]
2357 ? S 0:00 [mysqld]
2358 ? S 0:00 [mysqld]
4479 ? S 0:00 /usr/local/sbin/saslauthd -c -a pam
4567 ? S 0:00 /usr/sbin/saslauthd -m
/var/run/saslauthd/mux -a shadow
5332 pts/1 S 0:00 mysql -u root -p mail
5333 ? S 0:00 [mysqld]


--
Take Care
Kim Emax - master|minds - Vi tænker IT for dig...
Konsulentbistand, programmering, design & hosting af websites.
http://www.masterminds.dk - http://www.emax.dk
Køb din vin online på http://www.gmvin.dk,
Danmarks måske mest avancerede VinWebShop

mouss

unread,
Oct 28, 2005, 8:30:50 PM10/28/05
to
Kim Emax a écrit :

> Hi
>
> For the last couple of years I´ve been using postfix along with
> courier-imap, but now I´m going to switch to cyrus, and have followed
> the guide from postfix.org -> doc -> Postfix+Cyrus+Web-cyradm howto by
> Luc de Louw (http://www.delouw.ch/linux/postfix.phtml)
>
> However that causes me some trouble, when I send testmails, they´re
> bounced with "Mailbox does not exist". I can´t see what I´ve missed
> (or if it´s a postfix or cyrus problem for that matter :-) Anyone
> running a similar setup, who´s got a clue?

move back to courier-imap, since it apparently worked for you. if your
mda/imap/pop/webmail server doesn't do what you want, ask on its mailing
list.

Magnus Bäck

unread,
Oct 29, 2005, 3:22:24 AM10/29/05
to
On Friday, October 28, 2005 at 22:36 CEST,
Kim Emax <pos...@emax.dk> wrote:

> For the last couple of years I´ve been using postfix along with
> courier-imap, but now I´m going to switch to cyrus, and have followed
> the guide from postfix.org -> doc -> Postfix+Cyrus+Web-cyradm howto by
> Luc de Louw (http://www.delouw.ch/linux/postfix.phtml)
>
> However that causes me some trouble, when I send testmails, they´re
> bounced with "Mailbox does not exist". I can´t see what I´ve missed (or
> if it´s a postfix or cyrus problem for that matter :-) Anyone running a
> similar setup, who´s got a clue?

> Here´s a bit of the maillog:
> Oct 28 11:58:27 serv010 postfix/pickup[4515]: 6870E5F0054: uid=0 from=<root>
> Oct 28 11:58:27 serv010 postfix/cleanup[4577]: 6870E5F0054:
> message-id=<2005102809582...@emax.dk>
> Oct 28 11:58:27 serv010 postfix/qmgr[4516]: 6870E5F0054:
> from=<ro...@emax.dk>, size=279, nrcpt=1 (queue active)
> Oct 28 11:58:27 serv010 postfix/pipe[4583]: 6870E5F0054:
> to=<em...@emax.dk>, orig_to=<kim...@emax.dk>, relay=cyrus, delay=0,
> status=bounced (data format error. Command output: emax: Mailbox does
> not exist )

Postfix delivers messages to em...@emax.dk to Cyrus, telling Cyrus that
it should deliver the message to the user emax. Is that what should've
happened? If so, this is not a Postfix problem. Investigate and ask on
a Cyrus list why Cyrus doesn't think emax is a valid recipient. Perhaps
Cyrus expects fully qualified addresses and not bare usernames? If so,
modify the cyrus line in master.cf to send something other than ${user}
to deliver. Anyway, invoke the deliver program from the shell until you
get it working. Only then should you try to get it working with Postfix.

[...]

--
Magnus Bäck
mag...@dsek.lth.se

Kim Emax

unread,
Oct 29, 2005, 3:44:36 AM10/29/05
to
mouss wrote:
> move back to courier-imap, since it apparently worked for you. if your
> mda/imap/pop/webmail server doesn't do what you want, ask on its mailing
> list.

My _current_ setup is running courier-imap, i´m testning a new setup
cause I need to assign quota on each user individual.

Magnus Bäck

unread,
Oct 29, 2005, 4:13:05 AM10/29/05
to
On Saturday, October 29, 2005 at 09:44 CEST,
Kim Emax <pos...@emax.dk> wrote:

> mouss wrote:
>
> > move back to courier-imap, since it apparently worked for you. if
> > your mda/imap/pop/webmail server doesn't do what you want, ask on
> > its mailing list.
>
> My _current_ setup is running courier-imap, i´m testning a new setup
> cause I need to assign quota on each user individual.

Assuming you are using virtual users and can't use the file system
quota system, you do know that Courier-IMAP supports per-user quotas?

--
Magnus Bäck
mag...@dsek.lth.se

Kim Emax

unread,
Oct 29, 2005, 4:42:41 AM10/29/05
to

No, had no idea. I´m using courier-imap-3.0.8, and as far as I remember,
that wasn´t possible and I´ve never check if it later could support
it... I´ve tried sometime ago to upgrade to courier-imap-4.0.3, but that
didn´t work at all, so I dropped that again (don´t fix it if it ain´t
broken). Later I was told that cyrus could what I wanted, so I looked
into that. I´ll check the doc for the lates courier...

Thank You for the info.

Ralf Hildebrandt

unread,
Oct 29, 2005, 4:53:22 AM10/29/05
to
* Kim Emax <pos...@emax.dk>:

> No, had no idea. I?m using courier-imap-3.0.8,

Sufficient

--
Ralf Hildebrandt (Ralf.Hil...@charite.de) spam...@charite.de
http://www.postfix-book.com/ Tel. +49 (0)30-450 570-155
The opposite of increment is excrement.
-- Seen on Usenet, so it must be true.

Andreas Winkelmann

unread,
Oct 29, 2005, 4:42:03 PM10/29/05
to

You didn't show, that you have created the Mailboxes "emax" and "root" in
Cyrus-Imapd. Did you?

--
Andreas

Toon van der Pas

unread,
Oct 30, 2005, 5:38:19 AM10/30/05
to
On Sat, Oct 29, 2005 at 10:42:03PM +0200, Andreas Winkelmann wrote:
> Am Friday 28 October 2005 22:36 schrieb Kim Emax:
>
> > For the last couple of years I´ve been using postfix along with
> > courier-imap, but now I´m going to switch to cyrus, and have followed
> > the guide from postfix.org -> doc -> Postfix+Cyrus+Web-cyradm howto by
> > Luc de Louw (http://www.delouw.ch/linux/postfix.phtml)

Ah! That's the same method that I used.
It's not completely perfect, I must say.
I have everything working, but it took some time and sweat to get
there. For one, the described configuration doesn't force postfix to
query the MySQL database for existence of the mailbox.
That's wrong, because postfix will then accept email for non-existent
mailboxes, and send a bounce message later (when the local delivery fails).
The correct configuration should make postfix query the MySQL database
for the existence of the mailbox and reject the message during the
SMTP-session. No bounce message needed.

> > However that causes me some trouble, when I send testmails, they´re
> > bounced with "Mailbox does not exist". I can´t see what I´ve missed (or
> > if it´s a postfix or cyrus problem for that matter :-) Anyone running a
> > similar setup, who´s got a clue?

The mailbox DOES exist in Cyrus, no?
Then you should check how the mailboxes are named in Cyrus and in
your MySQL database. The names should match, of course.

And you should configure postfix to verify the existence of the
mailbox by querying the MySQL database, so it can reject email
messages for nonexistent mailboxes BEFORE queueing them.
Here are some settings from my main.cf postfix configuration file:

virtual_alias_maps = hash:/etc/postfix/virtual, mysql:/etc/postfix/mysql-virtual.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-vmailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-vmailbox.cf
local_recipient_maps = unix:passwd.byname, $alias_maps, mysql:/etc/postfix/mysql-local-maps.cf
relay_recipient_maps = mysql:/etc/postfix/mysql-relay-recipients.cf
sender_canonical_maps = mysql:/etc/postfix/mysql-canonical.cf

Query specifications in my mysql* files:

mysql-virtual.cf:
dbname = mail
table = virtual
select_field = dest
where_field = alias
additional_conditions = and status = '1'

mysql-vmailbox-domains.cf:
dbname = mail
table = domain
select_field = domain_name
where_field = domain_name

mysql-vmailbox.cf:
dbname = mail
table = virtual
select_field = dest
where_field = alias
additional_conditions = and status = '1'

mysql-local-maps.cf:
dbname = mail
table = virtual
select_field = alias
where_field = alias

mysql-relay-recipients.cf:
dbname = mail
table = virtual
select_field = alias
where_field = alias

mysql-canonical.cf:
dbname = mail
table = virtual
select_field = alias
where_field = username
additional_conditions = and status = '1' limit 1

This happens to work great for me. YMMV though.
I didn't change the database structure, it's exactly the database
structure as described by Luc de Louw. When some MTA tries to address
(MAILTO) a user for whom no mailbox exists, then the message is
rejected and postfix logs a 550 NOQUEUE record with the text
"<email-address>: Recipient address rejected: User unknown in virtual mailbox table"

Once again: this works for me.
If you or somebody else has any improvements on this example, then
please let me know. I'm always in for learning new tricks. :-)

Regards,
Toon.

Kim Emax

unread,
Nov 2, 2005, 6:22:10 PM11/2/05
to
Toon van der Pas wrote:
> On Sat, Oct 29, 2005 at 10:42:03PM +0200, Andreas Winkelmann wrote:

>>>Luc de Louw (http://www.delouw.ch/linux/postfix.phtml)
>
> Ah! That's the same method that I used.
> It's not completely perfect, I must say.
> I have everything working, but it took some time and sweat to get
> there. For one, the described configuration doesn't force postfix to
> query the MySQL database for existence of the mailbox.
> That's wrong, because postfix will then accept email for non-existent
> mailboxes, and send a bounce message later (when the local delivery fails).
> The correct configuration should make postfix query the MySQL database
> for the existence of the mailbox and reject the message during the
> SMTP-session. No bounce message needed.

Interesting... I´ll look into that. Such a mail will be rejected with a
556 then?

> The mailbox DOES exist in Cyrus, no?

Where Do I look for that? I haven´t found a setting that tells cyrus
where to put the mail... so it must be at the default location...

I my current running setup (courier) I use /data/mail/DOMAIN/USER/Maildir/

I can see that the web-cyradm adds a file in /var/mail/

[root@serv010 root]# ls -al /var/mail/
total 140
drwxrwxr-x 2 root mail 4096 Nov 3 01:06 .
drwxr-xr-x 14 root root 4096 Oct 26 17:40 ..
-rw-rw---- 1 cyrus mail 0 Oct 26 17:39 cyrus
-rw-rw---- 1 emax mail 0 Sep 8 21:33 emax
-rw------- 1 root root 130150 Oct 8 19:25 root

However it looks strange that emax should have been created to months ago...

> Then you should check how the mailboxes are named in Cyrus and in
> your MySQL database. The names should match, of course.

The mailbox emax exists in MySQL

> And you should configure postfix to verify the existence of the
> mailbox by querying the MySQL database, so it can reject email
> messages for nonexistent mailboxes BEFORE queueing them.
> Here are some settings from my main.cf postfix configuration file:

Thanks, I´ll look into that...

> This happens to work great for me. YMMV though.
> I didn't change the database structure, it's exactly the database
> structure as described by Luc de Louw. When some MTA tries to address
> (MAILTO) a user for whom no mailbox exists, then the message is
> rejected and postfix logs a 550 NOQUEUE record with the text
> "<email-address>: Recipient address rejected: User unknown in virtual mailbox table"
>
> Once again: this works for me.
> If you or somebody else has any improvements on this example, then
> please let me know. I'm always in for learning new tricks. :-)

I have 1200 spammer adresses in a MySQL table that I block, You can have
those? :-)

/Kim


>>>Here´s a bit of the maillog:
>>>Oct 28 11:58:27 serv010 postfix/pickup[4515]: 6870E5F0054: uid=0
>>>from=<root> Oct 28 11:58:27 serv010 postfix/cleanup[4577]: 6870E5F0054:
>>>message-id=<2005102809582...@emax.dk>
>>>Oct 28 11:58:27 serv010 postfix/qmgr[4516]: 6870E5F0054:
>>>from=<ro...@emax.dk>, size=279, nrcpt=1 (queue active)
>>>Oct 28 11:58:27 serv010 postfix/pipe[4583]: 6870E5F0054:
>>>to=<em...@emax.dk>, orig_to=<kim...@emax.dk>, relay=cyrus, delay=0,
>>>status=bounced (data format error. Command output: emax: Mailbox does
>>>not exist )
>>>Oct 28 11:58:27 serv010 postfix/cleanup[4577]: 7890D5F0055:
>>>message-id=<2005102809582...@emax.dk>
>>>Oct 28 11:58:27 serv010 postfix/qmgr[4516]: 7890D5F0055: from=<>,
>>>size=1968, nrcpt=1 (queue active)
>>>Oct 28 11:58:27 serv010 postfix/qmgr[4516]: 6870E5F0054: removed
>>>Oct 28 11:58:27 serv010 postfix/pipe[4583]: 7890D5F0055:
>>>to=<ro...@emax.dk>, relay=cyrus, delay=0, status=bounced (data format
>>>error. Command output: root: Mailbox does not exist )
>>>Oct 28 11:58:27 serv010 postfix/qmgr[4516]: 7890D5F0055: removed
>>
>>You didn't show, that you have created the Mailboxes "emax" and "root" in
>>Cyrus-Imapd. Did you?
>
>

0 new messages