Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am new to postfix, i need to configure it so that any incoming email to my server will be delivered to a local user account(/etc/passwd). My server will not have any virtual domains($mydestination) listed anywhere, i just need to catchall unknown mails to local user account.

i have seen some topic related to this configuration using luser_relay and local_receipients_maps. but i don't now how to use them, if you have time, can you please tell me how to use that? I am using postfix on centos 5.5 server

Thanks in advance.

share|improve this question
add comment

3 Answers 3

If everything is setup ok.. you can add the following in your main.cf

luser_relay = username
local_recipient_maps =

More Info

Replace username with the recipient's user name or complete address, e.g. john or john@mydomain.com

share|improve this answer
add comment

Here's how I did it:

virtual_transport = regex:/etc/postfix/virtual
root@testmailm01:/etc/postfix# cat virtual
/system/        SystemsLog@example.com ###this allows you to send outbound logs to another server
/*/     webtest ###catch everything and drop it in the webtest mailbox 

Our alpha test servers point to this box directly as their mail servers so that the developers can experiment with email addresses. In addition, our main SMTP servers have a transport directive:

[adminuser@smtpserver01 adminuser]$ cat /etc/postfix/transport
example.com :[exchange.server.addy]
testing.example.com :[testmailm01.example.cfx]

This allows the developers to test certain things in beta & prod environments by changing the @ to @testing.example.com, which redirects anything with that suffix to the above "test" mail server.

Hope that helps.

edit: did you configure the transport_maps setting? standard "help me" information for postfix problems is the output from "postconf -n" and "cat /etc/postfix/transport". Additionally, if you can locate the full conversation with the error, that would help a lot.

if you can find one of the lines ("grep 'web58007.mail.re3.yahoo.com' /var/log/maillog" or possibly /var/log/mail.log)

Jul 26 21:30:01 fjdx421.example.cfx postfix/qmgr[13444]: 2FBBF17B433: to=<oracle@oram101.example.cfx>, relay=none, delay=0, status=deferred (delivery temporarily suspended: connect to oram101.example.cfx[172.18.52.101]: Connection refused) 

the odd looking alphanumeric is the pseudo-unique identifier for that conversation, do a "grep 2FBBF17B433 /your/mail/logfile" and post that output as well

edit: first off, I apologize...I was referencing transport maps previously and what you need to define is "virtual_alias_maps". It was correct in my first response but then, for some reason, my brain attached itself to transport_maps...getting old I guess.

Looking at your postconf output, you need to define:

postconf -e virtual_alias_maps = hash:/etc/postfix/virtual
postconf -e recipient_canonical = hash:/etc/postfix/recipient_canonical

then, edit /etc/postfix/virtual:

/*/  <your.test.account>

and /etc/postfix/recipient_canonical:

/./     webtest

and then reload postfix with postfix reload Once that is done, you need to make sure you're correctly attaching to this mail server as it is likely not listed as an MX record anywhere. The easiest method of testing is to:

telnet <mail.server.addy> 25

A sample conversation with mostly bogus info:

Connected to testmailm01.example.cfx.
Escape character is '^]'.
220 testmailm01 ESMTP Postfix
HELO nowhere.com
250 testmailm01
mail from: someone@someplace.com
250 2.1.0 Ok
rcpt to: noone@noplace.com
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
bla bla blah
.
250 2.0.0 Ok: queued as 9B4E820E249

The log entries from this conversation:

root@testmailm01:/etc/postfix# grep 9B4E820E249 /var/log/mail.log
Jul 27 08:37:17 testmailm01 postfix/smtpd[16125]: 9B4E820E249: client=someuser.example.cfx[172.18.47.102]
Jul 27 08:37:25 testmailm01 postfix/cleanup[18529]: 9B4E820E249: message-id=<20100727133717.9B4E820E249@testmailm01>
Jul 27 08:37:25 testmailm01 postfix/qmgr[1556]: 9B4E820E249: from=<someone@someplace.com>, size=359, nrcpt=1 (queue active)
Jul 27 08:37:25 testmailm01 postfix/local[18554]: 9B4E820E249: to=<webtest@testmailm01.example.cfx>, orig_to=<noone@noplace.com>, relay=local, delay=17, delays=17/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Jul 27 08:37:25 testmailm01 postfix/qmgr[1556]: 9B4E820E249: removed

I also have virtual_transport configured, although I'm not sure, after re-reading the description, why. Just in case it's required (try the above first, then add this if it's still not working). This box is semi-production, so I can't just go mucking about with the config to test stuff:

postconf -e virtual_transport = regex:/etc/postfix/virtual

The virtual file remains unchanged, although you always need to make sure you've postmap'd any files that are using the hash: statement with:

postmap <file>

edit: according to this:

Jul 28 20:17:18 rabbits postfix/smtpd[1369]: NOQUEUE: reject: RCPT from mail-wy0-f182.google.com[74.125.82.182]: 554 5.7.1 <ss@amamun.info>: Relay access denied; from=<almamunbd@gmail.com> to=<ss@amamun.info> proto=ESMTP helo=<mail-wy0-f182.google.com>

you're sending email to amamun.info, but your mydestination contains:

mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = test.com
myhostname = rabbits.test.com

without a virtual, there's nothing in there that I can see that would allow your server to pickup email destined for @amamun.info. Depending on what you're wanting to do with the email, you need to either add that domain to your mydestination list, relay_domains, or as a virtual.

share|improve this answer
    
I added this to /etc/postfix/virtual /system/ SystemsLog@example.com ###this allows you to send outbound logs to another server /*/ testuser ###catch everything and then i restarted postfix, when testing i found reject message in mail log files: reject: RCPT from web58007.mail.re3.yahoo.com[68.142.236.115]: 554 5.7.1 <test@domain.com>: Relay access denied; any idea why? –  Md. Abdullah Al Mamun Jul 26 '10 at 14:33
add comment

Thanks for your reply, I am describing my requirement again here in details

I need to configure my postfix so that it catches all mail, it doesn't matter if it is spam mail and all incoming mail should go to a local system user account. Postfix will not have any virtual domain list. For this i have installed postfix (postfix-2.3.3-2.1.centos.mysql_pgsql) in a centos 5.4 server. Here is my configuration:

[root@rabbits postfix]# /usr/sbin/postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = test.com
myhostname = rabbits.test.com
mynetworks = 127.0.0.0/8
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
relay_domains =
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
[root@rabbits postfix]#

Suppose I own a domain name something.info, its MX record is pointed to this server, but its domain name not listed anywhere in postfix config files but i need to catchall email destined to "anything@something.info" to a local system account like "catchtest" same way i want to catch all other unknown domains email to the same local account, it doesn't matter if it is a spam mail. so for this what i actually need to do in postfix config files.

Thanks.

EDIT: Hi, thanks for your detail steps, i tried that but still same result, before delivering the mail, it is rejecting with Relay denied message.

Jul 28 20:17:18 rabbits postfix/smtpd[1369]: NOQUEUE: reject: RCPT from mail-wy0-f182.google.com[74.125.82.182]: 554 5.7.1 <ss@amamun.info>: Relay access denied; from=<almamunbd@gmail.com> to=<ss@amamun.info> proto=ESMTP helo=<mail-wy0-f182.google.com>
Jul 28 20:17:19 rabbits postfix/smtpd[1369]: disconnect from mail-wy0-f182.google.com[74.125.82.182]

Here is the main.cf file after modification with your configuration

[root@rabbits postfix]# /usr/sbin/postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix 
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = test.com
myhostname = rabbits.test.com
mynetworks = 127.0.0.0/8
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
relay_domains = sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_transport = regex:/etc/postfix/virtual


#cat /etc/postfix/virtual
/*/  admin@localhost


#cat recipient_canonical
/./     admin
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.