| Red Hat This forum is for the discussion of Red Hat Linux. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-18-2008, 01:18 PM
|
#1
|
|
Member
Registered: Jun 2006
Posts: 132
Rep:
|
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
|
|
|
|
04-18-2008, 02:20 PM
|
#2
|
|
Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
Start here http://www.postfix.org/postconf.5.html#relay_domains
Did you postmap virtual (ie postmap /etc/postfix/virtual) to create the db?
|
|
|
|
04-18-2008, 03:22 PM
|
#3
|
|
Member
Registered: Jun 2006
Posts: 132
Original Poster
Rep:
|
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
|
|
|
|
04-18-2008, 04:15 PM
|
#4
|
|
Member
Registered: Jun 2006
Posts: 132
Original Poster
Rep:
|
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
|
|
|
|
04-18-2008, 05:00 PM
|
#5
|
|
Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
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
|
|
|
|
04-18-2008, 05:19 PM
|
#6
|
|
Member
Registered: Jun 2006
Posts: 132
Original Poster
Rep:
|
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
|
|
|
|
04-22-2008, 12:18 PM
|
#7
|
|
Member
Registered: Jun 2006
Posts: 132
Original Poster
Rep:
|
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
|
|
|
|
02-06-2013, 06:08 AM
|
#8
|
|
LQ Newbie
Registered: Jul 2009
Posts: 1
Rep:
|
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:relayhost  ort
* error: Only allowing one domain
postmap /etc/postfix/transport
reload postfix
Now its working without any issue.
Hope this helps for someone.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:59 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|