Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make postfix only relay certain domain mail?

Status
Not open for further replies.

jimmyjiang

Programmer
Apr 20, 2008
2
US
hi,
I have a postfix server 2.2.10 in centSo5.1, 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 "intelligence.com" only, so only the email from 192.168.1.103 and from address is "xxx@intelligence.com" and "to address" is "xxx@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 = 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
thanks in advance!
 
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
 
I have the same question as you. I have a test server on my LAN and I want the mail sent through the server only to my domain only. I've tried the configuration you posted above without success. Here is my configuration:

root@JA: /etc/postfix # postconf mail_version
mail_version = 2.5.2

root@JA: /etc/postfix # postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = loopback-only
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = JA, localhost.localdomain, localhost
mydomain = joomsolutions.com
myhostname = joomsolutions.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access, reject
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/access, reject
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/access, reject
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

And the access file:

root@JA: /etc/postfix # cat access
joomsolutions.com OK
10.0.0.6 OK
127.0.0.1 OK

When I try to send mail through this server, it can send to all email addresses.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top