View previous topic :: View next topic |
Author |
Message |
cayenne l33t
Joined: 17 Oct 2002 Posts: 945 Location: New Orleans
|
Posted: Tue Aug 10, 2004 12:38 am Post subject: Postfix: email looping back to self if sent to other box |
|
|
I know this must be simple, but, I cannot get this to work...I've
searched and found numerous references to this on the postfix newsgroups, and the
web, but, I cannot get this to work.
I've set up virtual host (using mysql to hold the aliases and virtual
hosts on a Gentoo box according to:
http://www.gentoo.org/doc/en/virt-mail-howto.xml
I have 2 boxes.
Box A is pointed to by an MX record a.domain.com
I have another box inside my domain B b.domain.com
There is one user local to box B, and I've tried setting up box A to
relay any mail to this user to box B, but, I keep getting the looping
back to itself error.
I set up on box A, an alias of user to user.b.domain.com in the virtual table.
I've tried putting an entry into the transport table of user.domain.com user.b.domain.com
I've tried putting in my main.cf file on the A box an entry like:
relay_domains = $mydestination $transport_maps
And on the box B, I have in mydestination = $myhostname,
localhost.$mydomain
I know I'm missing something simple here, but, I cannot get this to
work with the combinations I'm trying or from what I've read.
I'm just basically wanting to take email on my main box A, and if it is a certain user that is on box B...relay it to that box which is also running postfix..but, much more simple set up...no virt. hosting stuff put on it. It does work however if locally on box B, I send email to this user or any other locally...so, email seems to be working over there. I just don't think that it is even able to leave box A...
Any ideas or pointers?
TIA,
cayenne _________________ Light travels faster than sound. This is why some people appear bright until you hear them speak......... |
|
Back to top |
|
|
kashani Advocate
Joined: 02 Sep 2002 Posts: 2032 Location: San Francisco
|
Posted: Tue Aug 10, 2004 2:59 am Post subject: |
|
|
Your post was a bit difficult to parse. Let me try to explain what shoudl work and you can take it from there.
two domains will have MX records that look like this pointing to the public machine.
Code: |
domain.com IN MX 10 server.domain.com
domain.net IN MX 10 server.domain.com
|
Your MTA on server.domain.com will know that these domains are local
Code: |
localhost.domain.com
server.domain.com
domain.com
domain.net
|
Your MTA on server.domain.com will forward the mail for the entire domain of domain.net to the internal server because of your transport map
Code: |
domain.net: server.domain.net
|
server.domain.net just needs to know that it is local for domain.net and it'll deliver it locally to the user. I hope this makes sense as it's a bit confusing reading over it myself.
kashani _________________ Will personally fix your server in exchange for motorcycle related shop tools in good shape. |
|
Back to top |
|
|
cayenne l33t
Joined: 17 Oct 2002 Posts: 945 Location: New Orleans
|
Posted: Tue Aug 10, 2004 3:21 pm Post subject: Close |
|
|
Ok....thanks for the reply, and I follow what you are saying. My situation, is a little bit different.
I have one MX record only pointing to one machine. Let's call this machine "A", and its fully qualified name is a.domain.com. I have a router connected to my cable modem, and it routes all traffic on port 25 to this box. I only have one domain.....domain.com. There are no other domains (.net, org..etc).
Now, inside my network, I have another box "B". Its fully qualified name is b.domain.com. Nothing from the outside world is routed to it. Box B has its own MTA (postfix also) running. The MTA on box B can easily send mail to all accounts on itself locally.
I have a user on box B, named fred. This user is NOT on box A.
So, what I'm trying to do, is set up my MTA on box A so that if the outside world mails an email to fred@domain.com, the MTA on box A will know that this really goest to fred on the B box.
On the main box, A, I've set up in the alias table with an entry:
alias destination
fred fred@domain.com
Just in case someone on the A box wants to send fred a message.
On the A box, in the virtual table I have an entry:
email destination
fred@domain.com fred@b.domain.com
On the A box in the transport table I put an entry:
domain destination
b.domain.com relay:[b.domain.com]
In the A box main.cf, I've tried most everything I can think of...
I've put in for the relay_domain = $transport_map, b.domain.com
and combinations.
At this point, I don't know how to get box A, which is a.domain.com to receive an email for fred@domain.com, to figure out fred is a user on another box B which is b.domain.com, and to send it to him there.
I've been checking the logs on both boxes...and with the setups I've been trying...it never even touches box B. The ONLY time I've seen it try to hit box B, is if in the virtual table I put box B's IP address in lieu of the domain name. When I tried this:
virtual table
email destination
fred@domain.com fred@192.168.1.100
It actually did try to hit the B box...it was bounced with some type error which I'll try to trouble shoot later...
One last detail...in both boxes, in the /etc/hosts file I have entries as such:
192.168.1.200 a.domain.com a
192.168.1.100 b.domain.com b
I don't have DNS running, but, I think the host entries should do it right?
At this point, I cannot figure out what to do go get rid of the loops back to self error. In the log it says things like: (I've replaced the actual names of the boxes with A and B appropriately and fudged the IP's)
Aug 10 15:01:45 A postfix/smtp[16632]:warning: host b.domain.com[123.45.67.890] greeted me with my own hostname A
Aug 10 15:01:45 A postfix/smtp[16632]: warning: host b.domain.com[123.45.67.890] replied to HELO/EHLO with my own hostname A
Aug 10 15:01:45 A postfix/smtp[16632]: 4DB2DF5DB8: to=<fred@b.domain.com>, orig_to=<fred@domain.com>, relay=b.domain.com[123.45.67.890], delay=5, status=bounced (mail for [b.domain.com] loops back to myself)
It looks like it it trying to forward things on...but, why am I getting the answer with own host name?
Thanks in advance...if there is any more info, please let me know..I'm kinda desperate to get this done...and have been futzing with it for quite awhile now...
cayenne
ps. postconf -n yields these results:
alias_database = mysql:/etc/postfix/mysql-aliases.cf
alias_maps = mysql:/etc/postfix/mysql-aliases.cf
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
debug_peer_level = 2
default_destination_concurrency_limit = 20
home_mailbox = .maildir/
inet_interfaces = $myhostname, localhost
local_destination_concurrency_limit = 2
local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname
local_transport = local
mail_owner = postfix
mailbox_command = /usr/bin/procmail -a $DOMAIN
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, $mydomain
mydomain = domain.com
myhostname = A
mynetworks = 192.168.1.0/24, 127.0.0.0/8
mynetworks_style = subnet
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
proxy_interfaces = 123.45.67.890
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.0.16-r1/readme
relay_domains = $mydestination b.domain.com
relocated_maps = mysql:/etc/postfix/mysql-relocated.cf
sample_directory = /usr/share/doc/postfix-2.0.16-r1/sample
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_tls_CAfile = /etc/ssl/postfix/cacert.pem
smtpd_tls_cert_file = /etc/ssl/postfix/mail_signed_cert.pem
smtpd_tls_key_file = /etc/ssl/postfix/mailkey.pem
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
transport_maps = mysql:/etc/postfix/mysql-transport.cf
unknown_local_recipient_reject_code = 450
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf
virtual_gid_maps = static:$vmail-gid
virtual_mailbox_base = /
virtual_mailbox_domains = b.domain.com
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf
virtual_minimum_uid = 1000
virtual_transport = virtual
virtual_uid_maps = static:$vmail-uid _________________ Light travels faster than sound. This is why some people appear bright until you hear them speak......... |
|
Back to top |
|
|
nobspangle Veteran
Joined: 23 Mar 2004 Posts: 1318 Location: Manchester, UK
|
Posted: Tue Aug 10, 2004 8:53 pm Post subject: |
|
|
Don't know how correct this is but I just tested it quickly and it worked for me.
open /etc/mail/aliases and add a line Code: | fred: fred@b.domain.com | then run Code: | newaliases
postfix reload | make sure that in /etc/hosts you have a line Code: | 192.168.1.100 b.domain.com | and you should be ok.
The other method is to set fred up as a user on a.domain.com and in his home folder put a .forward file that containsI have this kind of setup to forward my cron reports to the exchange server at work.
One more method, set up fetchmail on box b to collect the mail from a. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|