LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 05-20-2009, 03:46 AM   #1
bandad
LQ Newbie
 
Registered: Dec 2005
Location: Surrey, UK
Distribution: slackware, ubuntu, and ipcop
Posts: 25

Rep: Reputation: 15
Postfix virtual mail and transport file conflict


I have a mail server for a "one man" company with two virtual domains.
This provides mail services for the owner in two roles, one as a self-employed consultant (domain1), and the other as a director of another company (domain2).

Domain2 has its own mail server, so all we need to do is fetch the mail from there and keep a local copy which the owner/director can access remotely via IMAP (dovecot) and/or SquirrelMail.

The problem I have is that he is unable to send mail to his colleagues at domain2, because postfix tries to deliver it to the local virtual domain instead of to the remote domain2 mail server.

Typical log entry looks like this:
May 19 14:15:14 mail postfix/smtpd[11632]: NOQUEUE: reject: RCPT from unknown[x.x.x.x]: 550 5.1.1 <anyone@domain2>: Recipient address rejected: User unknown in virtual mailbox table; from=<director@domain2> to=<anyone@domain2> proto=ESMTP helo=<xxxxx>

/etc/postfix/main.cf includes:
transport_maps = hash:/etc/postfix/transport
virtual_mailbox_domains = /etc/postfix/vhosts

vhosts looks like this:
domain1
domain2

The transport file looks like this:
director@domain2 virtual:
domain2 smtp:[mail.domain2]
domain1 virtual:

local test (sendmail -bv anyone@domain2) works fine and the message is relayed, but when the owner sends an email from his laptop it gets the error message above. How can I configure postfix for this to work properly?

thanks
 
Old 05-20-2009, 03:50 AM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Can you shoe "postconf -n"?

Edit- and can you re-phrase that last paragraph - I don't follow.

Last edited by billymayday; 05-20-2009 at 03:55 AM.
 
Old 05-20-2009, 04:14 AM   #3
bandad
LQ Newbie
 
Registered: Dec 2005
Location: Surrey, UK
Distribution: slackware, ubuntu, and ipcop
Posts: 25

Original Poster
Rep: Reputation: 15
postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = scan:127.0.0.1:10026
home_mailbox = Maildir/
inet_interfaces = all
mailbox_size_limit = 0
mydestination = mail.domain1, localhost.domain1, localhost
myhostname = localhost
mynetworks_style = subnet
myorigin = /etc/mailname
readme_directory = no
receive_override_options = no_address_mappings
recipient_delimiter = +
relayhost = [auth.smtp.1and1.co.uk]
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/saslpass
smtp_sasl_security_options = noanonymous
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
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
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_loglevel = 0
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = /etc/postfix/vhosts
virtual_mailbox_maps = hash:/etc/postfix/vmaps
virtual_minimum_uid = 1000
virtual_uid_maps = static:5000


re previous last paragraph...
I have followed the recommended local test/debugging process to send a test message from the mail server using "sendmail -bv name@domain2". This attempts to send a probe message and reports via an email to the originator (in this case root@localost) with a status report. The report shows that the relay (transport method) was correct and the message was deliverable.

HTH
 
Old 05-20-2009, 04:17 AM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
[cancel that]

Last edited by billymayday; 05-20-2009 at 04:21 AM.
 
Old 05-20-2009, 04:24 AM   #5
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Dumb question, but you did postmap transport didn't you?

Can you show a few more log lines around the sending?

I got the first part of the final para, it was more the bit around the boss sending.
 
Old 05-20-2009, 04:34 AM   #6
bandad
LQ Newbie
 
Registered: Dec 2005
Location: Surrey, UK
Distribution: slackware, ubuntu, and ipcop
Posts: 25

Original Poster
Rep: Reputation: 15
The "boss sending"! ah!

The boss uses his laptop(s) to access his mail server remotely. Mostly he uses Outlook, but he also has an Apple Mac with mac mail. When he sends a message (or replies to one from his colleagues in domain2) his mail client initiates an smtp session with his mail server, usually from an "unknown" address. It is this session that generates the problem.

grep 11387 /var/log/mail.log ...

May 19 14:07:52 mail postfix/smtpd[11387]: connect from unknown[41.252.49.158]
May 19 14:07:57 mail postfix/smtpd[11387]: BD00E466395: client=unknown[41.252.49.158], sasl_method=LOGIN, sasl_username=director@domain2
May 19 14:08:02 mail postfix/smtpd[11387]: NOQUEUE: reject: RCPT from unknown[41.252.49.158]: 550 5.1.1 <name@domain2>: Recipient address rejected: User unknown in virtual mailbox table; from=<director@domain2> to=<name@domain2> proto=ESMTP helo=<xxxx>
May 19 14:08:06 mail postfix/smtpd[11387]: disconnect from unknown[41.252.49.158]

(how do you stuff into code tags on this forum?)
 
Old 05-20-2009, 04:36 AM   #7
bandad
LQ Newbie
 
Registered: Dec 2005
Location: Surrey, UK
Distribution: slackware, ubuntu, and ipcop
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by billymayday View Post
Dumb question, but you did postmap transport didn't you?
Yes!
 
Old 05-20-2009, 04:40 AM   #8
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
You'd be surprised how often people miss really easy stull

Code tags are "[" code "]" (ie no " or spaces) and /code at end

Can you post the reports from the sendmail -bv test.

Are you sure your transport syntax is correct? We can't see that if you replace actual domains with domain2, etc.
 
Old 05-20-2009, 04:55 AM   #9
bandad
LQ Newbie
 
Registered: Dec 2005
Location: Surrey, UK
Distribution: slackware, ubuntu, and ipcop
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by billymayday View Post
Can you post the reports from the sendmail -bv test.

Are you sure your transport syntax is correct? We can't see that if you replace actual domains with domain2, etc.
Sorry, don't feel free to give the actual address details. I've left the .co.uk parts in to make it look more real.

content of email report:
Code:
This is the mail system at host localhost.

Enclosed is the mail delivery report that you requested.

                  The mail system

<name@domain2.co.uk>: delivery via
   mail.domain2.co.uk[x.x.x.x]:25: 250 2.1.5 name@domain2.co.uk
Reporting-MTA: dns; localhost
X-Postfix-Queue-ID: 4B89646639D
X-Postfix-Sender: rfc822; root@domain1.co.uk
Arrival-Date: Wed, 20 May 2009 08:25:10 +0100 (BST)

Final-Recipient: rfc822; name@domain2.co.uk
Action: deliverable
Status: 2.1.5
Remote-MTA: dns; mail.domain2.co.uk
Diagnostic-Code: smtp; 250 2.1.5 name@domain2.co.uk
Received: by localhost (Postfix, from userid 0)
	id 4B89646639D; Wed, 20 May 2009 08:25:10 +0100 (BST)
From: root@domain1.co.uk
Subject: probe
To:
	name@domain2.co.uk
Message-Id: <20090520072510.4B89646639D@localhost>
Date: Wed, 20 May 2009 08:25:10 +0100 (BST)
I don't understand why the transport file doesn't map when the boss is sending. Note the "delivery via" part of the above status report. This matches the transport file.

Code:
director@domain2.co.uk	virtual:
domain2.co.uk	smtp:[mail.domain2.co.uk]
domain1.co.uk	virtual:
Is there a precedence order somewhere?

Thanks for your help
 
Old 05-20-2009, 05:19 AM   #10
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
So I take it this is only happening on authenticated sessions? What if he send unauthenticated from withing mynetworks?
 
Old 05-20-2009, 05:23 AM   #11
bandad
LQ Newbie
 
Registered: Dec 2005
Location: Surrey, UK
Distribution: slackware, ubuntu, and ipcop
Posts: 25

Original Poster
Rep: Reputation: 15
Not able to test that at the moment. He's abroad and I don't have access to the premises.
How does the authentication status affect the routing decisions?
 
Old 05-20-2009, 06:02 AM   #12
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I'm just trying to narrow stuff down. I wouldn't have thought it would, but you never know.

Is there nothing useful in virtual_alias_maps or any other files?
 
Old 05-20-2009, 07:46 AM   #13
bandad
LQ Newbie
 
Registered: Dec 2005
Location: Surrey, UK
Distribution: slackware, ubuntu, and ipcop
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by billymayday View Post
Is there nothing useful in virtual_alias_maps or any other files?
this does nothing more than map root/postmaster to my own email address.

vhosts lists the two domains

vmaps maps the two identities (fully qualified email addresses) to the virtual mailbox folders. as below:
Code:
name@domain1.co.uk   domain1.co.uk/name/
name@domain2.co.uk   domain2.co.uk/name/
What would happen if I removed the domain2 from the vhosts? Would postfix use the transport file to route the incoming mail for name@domain2.co.uk to the virtual folders? or would it just screw up the virtual delivery agent?
 
Old 05-20-2009, 08:48 PM   #14
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Quote:
May 19 14:08:02 mail postfix/smtpd[11387]: NOQUEUE: reject: RCPT from unknown[41.252.49.158]: 550 5.1.1 <name@domain2>: Recipient address rejected: User unknown in virtual mailbox table; from=<director@domain2> to=<name@domain2> proto=ESMTP helo=<xxxx>
Since domain2 is in the virtual mailbox class, postfix will reject mail to recipients not listed in vmaps. The solution is either 1. to list all valid recipients in vmaps (this includes users on both the local machine and the remote domain2 MX), or 2. have a catchall entry in vmaps. The mailbox that you list is just a dummy, since transport_maps determines the final transport in the end.

Last edited by Berhanie; 05-20-2009 at 09:25 PM.
 
Old 05-20-2009, 09:36 PM   #15
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I'm confused - isn't name@domain2.co.uk meant to be on the other server, and where is the director entry?

Try Berhanie's suggestion of a catchall (@domain2.co.uk), although it would be preferable to deal with invalid users on the remote server more neatly.
 
  


Reply

Tags
postfix, transport



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 mail transport problem ayush1440 Linux - Server 3 03-17-2008 05:45 AM
how to forward mail to postfix virtual user justkeny2k Linux - Networking 7 12-22-2006 12:43 AM
mail filtering with Postfix and virtual mailboxes pembo13 Linux - Networking 2 09-17-2004 07:09 AM
No Incoming postfix mail, virtual domains geokker Linux - Software 0 06-22-2004 06:09 AM
Is virtual user for mail (postfix) and ftp (proftpd) possible pembo13 Linux - Software 0 01-11-2004 03:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:51 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration