LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-26-2010, 08:59 AM   #1
craseal
LQ Newbie
 
Registered: Aug 2010
Posts: 12

Rep: Reputation: 0
postfix incoming bounce problem


I set up postfix with dovecot and everything works fine (I can send e-mails both locally and from a client), except for incoming mails.

I checked my logs and whenever an email comes in, let's say that it was sent to john@example.com, postfix changes it to john@HOSTNAME.local. The message then of course bounces, because I set to accept messages only for domains that exist on my server.

Something important: I have multiple domains on my server, and I want all of them to be able to send e-mails. That's why I have setup virtual domains in postfix.

Here's my main.cf:
Code:
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix

mail_owner = postfix
inet_interfaces = all

mydestination = localhost, /etc/postfix/domains/domains
virtual_maps = hash:/etc/postfix/domains/addresses


unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/

debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = check_policy_service inet:127.0.0.1:9999,
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_non_fqdn_recipient,
    reject_unknown_recipient_domain,
    reject_unauth_destination,
smtpd_sender_restriction = reject_non_fqdn_sender
broken_sasl_auth_clients = yes
 
Old 08-26-2010, 11:43 AM   #2
jamrock
Member
 
Registered: Jan 2003
Location: Kingston, Jamaica
Posts: 444

Rep: Reputation: 41
I would recommend reading the following documents:

http://www.postfix.org/BASIC_CONFIGURATION_README.html

http://www.postfix.org/VIRTUAL_READM...irtual_mailbox

It is best to get everything working with a single domain and local users first. Then you can add virtual domains and virtual users.

I think you need to change this.

Quote:
mydestination = localhost, /etc/postfix/domains/domains
Please note the following from the documentation:

Quote:
IMPORTANT: If your machine is a mail server for its entire domain, you must list $mydomain as well.

Example 1: default setting.

/etc/postfix/main.cf:
mydestination = $myhostname localhost.$mydomain localhost

Example 2: domain-wide mail server.

/etc/postfix/main.cf:
mydestination = $myhostname localhost.$mydomain localhost $mydomain

Example 3: host with multiple DNS A records.

/etc/postfix/main.cf:
mydestination = $myhostname localhost.$mydomain localhost
www.$mydomain ftp.$mydomain




Quote:
Notes:

*

Line 2: The virtual_mailbox_domains setting tells Postfix that example.com is a so-called virtual mailbox domain. If you omit this setting then Postfix will reject mail (relay access denied) or will not be able to deliver it (mail for example.com loops back to myself).

NEVER list a virtual MAILBOX domain name as a mydestination domain!
 
Old 08-26-2010, 03:49 PM   #3
craseal
LQ Newbie
 
Registered: Aug 2010
Posts: 12

Original Poster
Rep: Reputation: 0
I've changed the mydestination parameter to this setting as you suggested.

But this didn't change anything so I removed virtual_maps = hash:/etc/postfix/domains/addresses and now I can receive mail for my primary domain, but not for any other domain.

So I followed the http://www.postfix.org/VIRTUAL_README.html and set this (let's say example.com is my primary domain -> I set the parameter mydomain to list it as such):
Code:
virtual_alias_domains = example.net, example.org
virtual_alias_maps = hash:/etc/postfix/domains/addresses
The /etc/postfix/domains/addresses file looks like this:
Code:
info@example.net     info
john@example.net     john

info@example.org     info
nelly@example.org    nelly
kate@example.org     kate
I can still receive the e-mail for my main domain, but all e-mail meant for example.net and example.org are redirected to root@hostname.example.com

Last edited by craseal; 08-26-2010 at 03:50 PM.
 
Old 08-27-2010, 12:04 AM   #4
jamrock
Member
 
Registered: Jan 2003
Location: Kingston, Jamaica
Posts: 444

Rep: Reputation: 41
What value do you have for myorigin in your main.cf?

Example.com is the local domain, not any of the virtual ones. What happens when you send mail to info@example.com?

What happens when you send mail to info?

Which of the 3 options did you choose for mydestination?

Last edited by jamrock; 08-27-2010 at 12:07 AM.
 
Old 08-27-2010, 07:09 AM   #5
craseal
LQ Newbie
 
Registered: Aug 2010
Posts: 12

Original Poster
Rep: Reputation: 0
I didn't have a value set for myorigin. Now I've set it to $mydomain, which results in all mails being rerouted to @example.com.

This is my mydestination setting:
Code:
mydestination = $myhostname, localhost.$mydomain, $mydomain, localhost
If I send a message to info@example.com or to info, it's delivered to info@example.com. If I send mail to info@example.net or any other mail at example.net or example.org it's rerouted to root@example.com (
 
Old 08-27-2010, 08:38 AM   #6
jamrock
Member
 
Registered: Jan 2003
Location: Kingston, Jamaica
Posts: 444

Rep: Reputation: 41
Take a look at your logs.

cat /var/log/maillog

What does it say about mail that is being sent to info@example.net? It should tell you why the mail is being forwarded to root@example.com.

Did you run the command "postmap /etc/postfix/virtual"? This creates the database from the hash:/etc/postfix/domains/addresses text file. Postfix reads the database in order to know the accounts to which the mail must be forwarded.

Here is some more information on setting up virtual domains.

http://www.postfix.org/virtual.5.html

Last edited by jamrock; 08-27-2010 at 10:13 AM.
 
Old 08-27-2010, 11:19 AM   #7
craseal
LQ Newbie
 
Registered: Aug 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Yes, I've run the postmap command and then reloaded postfix.

The log is not really helpful (at least not for me):
Code:
Aug 27 18:12:57 mladi postfix/local[7971]: BB74C54EA254: to=<root@example.com>, orig_to=<info@example.net>, relay=local, delay=0.2, delays=0.12/0.05/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
 
Old 08-27-2010, 12:32 PM   #8
jamrock
Member
 
Registered: Jan 2003
Location: Kingston, Jamaica
Posts: 444

Rep: Reputation: 41
I see what you mean. The mails are being forwarded to root without any error messages. I will try to reproduce this over the weekend.

Please post the results of "postconf -n". This will show your Postfix configuration.

On another issue. Did you edit the aliases file to map root to a regular user account?
 
1 members found this post helpful.
Old 08-27-2010, 01:05 PM   #9
craseal
LQ Newbie
 
Registered: Aug 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Here's the result from postconf -n:
Code:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
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, $mydomain, localhost
mydomain = example.com
mynetworks = 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks,         permit_sasl_authenticated,     reject_unknown_recipient_domain,  reject_unauth_destination,     reject_non_fqdn_recipient
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
unknown_local_recipient_reject_code = 550
virtual_alias_domains = example.net, example.org
virtual_alias_maps = hash:/etc/postfix/domains/addresses
The aliases file is untouched. I checked it and root isn't mapped to anything, there are however a lot of services mapped to root, but no e-mails among them. The only e-mail address mappings I have are in /etc/postfix/domains/addresses.

Last edited by craseal; 08-27-2010 at 01:12 PM.
 
Old 08-29-2010, 03:07 PM   #10
jamrock
Member
 
Registered: Jan 2003
Location: Kingston, Jamaica
Posts: 444

Rep: Reputation: 41
Okay then...

Quote:
Yes, I've run the postmap command and then reloaded postfix.
What file did you use with the postmap command?

Quote:
virtual_alias_maps = hash:/etc/postfix/domains/addresses
It appears as if you need to run

postmap /etc/postfix/domains/addresses

This will create a file called /etc/postfix/domains/addresses.db. This is the database that postfix will search. It seems as if /etc/postfix/virtuals is the default file.

If that doesn't work, you can try using a file in the /etc/postfix directory such as /etc/postfix/domain_addresses.
 
Old 08-30-2010, 07:16 AM   #11
craseal
LQ Newbie
 
Registered: Aug 2010
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you for your help jamrock, I really apreciate it!

I have run postmap with the file /etc/postfix/domains/addresses, but I guess you're right and it would be easier if I put that file in the postfix directory.

Since I was a bit pressed with time constraints I just set up a google apps account for handling e-mails. I have only about 10 e-mail addresses (for now) that need to be taken care, so I guess this will have to do it until I have enough time to set up postfix properly.

Thanks again for your effort and all the help!
 
  


Reply

Tags
dovecot, mail, postfix


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
postfix bounce.cf alex2323 Linux - Server 1 12-23-2009 02:39 PM
bounce mail to mailbox owner (postfix) Gran_Maestre Linux - Server 0 02-21-2009 10:30 AM
Postfix - Bounce AND forward? wachaca Linux - Server 1 12-12-2006 09:33 PM
postfix incoming mail problem punker22 Linux - Networking 1 07-17-2004 01:45 AM
Postfix Problem - No incoming mail Gareman Linux - Networking 4 02-10-2003 12:40 PM


All times are GMT -5. The time now is 05:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration