I have a CentOS box running exim, I am trying to restrict outbound emails only to one domain (lets say domain.com) and block mails to all other domains. I have added a specific rules to allow outbound mails to domain.com (line numbers 6,7 & 8) and the default action for output chain is block. But still mails are sent out to gmail, yahoo and other domains. What is wrong in my iptables rules?
Below are the outbound rules
root@host1 [/tmp/logd]# /sbin/iptables -L OUTPUT -n --line-number -v
Chain OUTPUT (policy DROP 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT tcp -- * * 0.0.0.0/0 192.x.x.x /* test */
2 3455 420K ACCEPT tcp -- * * 0.0.0.0/0 23.x.x.x tcp dpt:443
3 0 0 ACCEPT tcp -- * * 0.0.0.0/0 104.x.x.x tcp dpt:80
4 0 0 ACCEPT tcp -- * * 0.0.0.0/0 104.x.x.x tcp dpt:80
5 0 0 ACCEPT tcp -- * * 0.0.0.0/0 104.20.5.21 tcp dpt:80 /* www.spamhaus.org */
6 0 0 ACCEPT tcp -- * * 0.0.0.0/0 216.x.x.x tcp dpt:25 /* allow mails to domain.com */
7 69 16484 ACCEPT tcp -- * * 0.0.0.0/0 216.x.x.x tcp dpt:25 /* allow mails to domain.com */
8 68 10803 ACCEPT tcp -- * * 0.0.0.0/0 173.x.x.x tcp dpt:25 /* allow mails to domain.com */
9 800K 826M LOCALOUTPUT all -- * !lo 0.0.0.0/0 0.0.0.0/0
10 0 0 ACCEPT tcp -- * !lo 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
11 0 0 ACCEPT udp -- * !lo 0.0.0.0/0 0.0.0.0/0 udp dpt:53
12 9 536 ACCEPT tcp -- * !lo 0.0.0.0/0 0.0.0.0/0 tcp spt:53
13 2147 313K ACCEPT udp -- * !lo 0.0.0.0/0 0.0.0.0/0 udp spt:53
14 11324 17M ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0
15 797K 826M INVALID tcp -- * !lo 0.0.0.0/0 0.0.0.0/0
16 797K 826M ACCEPT all -- * !lo 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
17 0 0 ACCEPT icmp -- * !lo 0.0.0.0/0 0.0.0.0/0 icmp type 0
18 0 0 ACCEPT icmp -- * !lo 0.0.0.0/0 0.0.0.0/0 icmp type 8
29 0 0 ACCEPT icmp -- * !lo 0.0.0.0/0 0.0.0.0/0 icmp type 11
20 0 0 ACCEPT icmp -- * !lo 0.0.0.0/0 0.0.0.0/0 icmp type 3
21 372 25376 LOGDROPOUT all -- * !lo 0.0.0.0/0 0.0.0.0/0
sbin/iptables -L LOCALOUTPUT -n --line-number -v