LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 04-18-2008, 01:18 PM   #1
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Rep: Reputation: 15
how to make postfix only relay certain domain mail?


hi,
I have postfix 2.2.10, how to make postfix only relay certain domain mail?like only "test.com" email can be pass throught.
second question is after I change /etc/postfix/virtual, I restart postfix, but the setting in "virutal" still working, what should I do?
thanks in advance!
jimmy
 
Old 04-18-2008, 02:20 PM   #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
Start here http://www.postfix.org/postconf.5.html#relay_domains

Did you postmap virtual (ie postmap /etc/postfix/virtual) to create the db?
 
Old 04-18-2008, 03:22 PM   #3
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Original Poster
Rep: Reputation: 15
postmap is working, but can you tell me what exactly I should change in main.cf? I know "Postfix relays mail "trusted" clients (IP address matches $mynetworks) to any destination".
but I only want "trusted" clients relay mail to one destination like " test.com, what should I do?
thanks!
jimmy
 
Old 04-18-2008, 04:15 PM   #4
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Original Poster
Rep: Reputation: 15
postmap is working, but can you tell me what exactly I should change in main.cf? I know "Postfix relays mail "trusted" clients (IP address matches $mynetworks) to any destination".
but I only want "trusted" clients relay mail to one destination like " test.com, what should I do?
thanks!
jimmy
 
Old 04-18-2008, 05:00 PM   #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
I don't follow your comment about virtual by the way.


I'm not sure I've done this myself before, but here's what I think you need without trying it

relay_domains = $mydestination, test.com

transport_maps = hash:/etc/postfix/transport

in /etc/postfix/transport

test.com smtp:destination_server.com

where destination_server.com is the server you want to relay to.

You need to postmap transport btw.

In this setup, any domains listed in mydestination will deliver locally, test.com will deliver via relay. I think this will work with vitual domains, but may not
 
Old 04-18-2008, 05:19 PM   #6
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Original Poster
Rep: Reputation: 15
I thinks you didn't get what I mean.

the postfix server IP is 192.168.1.103, the mail will come from the other server 192.168.1.183( they are in same lan).

right now the server 192.168.1.183 can send mail to any destination relay from 192.168.103, but I want limit the destination to "opt-intelligence.com" only, so only the email from 192.168.1.103 and from address is "xxx@opt-intelligence.com" and "to address" is "xxx@opt-intelligence.com" can be replayed in 192.168.1.103.

here is my "postconf -n"
[root@optimization postfix]# 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
html_directory = /usr/share/doc/postfix-2.2.10-documentation/html
inet_interfaces = 192.168.1.103
mail_owner = postfix
mailbox_size_limit = 10485760000
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 209715200
mydomain = opt-intelligence.com
mynetworks = 192.168.1.183, 192.168.1.232
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.2.10-documentation/readme
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, reject_unlisted_recipient
unknown_local_recipient_reject_code = 550
 
Old 04-22-2008, 12:18 PM   #7
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Original Poster
Rep: Reputation: 15
I finally figure it out, hope the following configuration can help people has same question as mine.
1.[root@optimization ~]# vi /etc/postfix/main.cf
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access, reject
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/access, reject
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/access, reject


2.[root@optimization ~]# vi /etc/postfix/access

intelligence.com OK
192.168.1.183 OK
127.0.0.1 OK

3.[root@optimization ~]# postmap /etc/postfix/access
[root@optimization ~]# postfix reload
postfix/postfix-script: refreshing the Postfix mail system
 
Old 02-06-2013, 06:08 AM   #8
dinoosh.niki
LQ Newbie
 
Registered: Jul 2009
Posts: 1

Rep: Reputation: 0
relay certain domain mail using transport maps

I think the most logical and easiest way to do this is use transport_maps.

I had the same problem and i only had access to the relaying server (the server which relays mail to the remote server).

I just added transport_maps = hash:/etc/postfix/transport to main.cf.

Then vi /etc/postfix/transport

example.com smtp:relayhostort
* error: Only allowing one domain

postmap /etc/postfix/transport

reload postfix

Now its working without any issue.

Hope this helps for someone.
 
  


Reply


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 - Single domain with multipe relay host jignesh.vasani Linux - Software 10 11-30-2009 04:53 PM
Mail Relay in Postfix dougnc Linux - Software 14 08-01-2007 09:51 AM
Postfix to relay mail purelithium Linux - Networking 7 02-08-2006 02:01 PM
Postfix as a mail relay (getting relay access denied) hypexr Linux - Software 3 09-13-2005 07:15 PM
PostFix Mail Relay... CRCool75 Linux - Networking 4 08-20-2004 04:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 11:52 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