LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   postfix and dns configuration (https://www.linuxquestions.org/questions/linux-server-73/postfix-and-dns-configuration-509116/)

Soynuts 12-10-2006 11:17 AM

postfix and dns configuration
 
I've been having problems the last week with setting up postfix to be able to send mail without it being flagged as spam or completely rejected by other mail servers. I believe it mainly involves with my DNS settings and how I have my hostname set up. Here are my configuration files:

main.cf
Code:

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/
html_directory = /usr/share/doc/postfix-2.2.10/html
inet_interfaces = all
local_destination_concurrency_limit = 2
local_recipient_maps =
mail_owner = postfix
mailbox_size_limit = 102400000
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
message_size_limit = 20480000
mydestination =
mydomain = mydomain.com
myhostname = MyBox.mydomain.com
mynetworks = xxx.xxx.193.0/24, 127.0.0.0/8, xxx.xxx.249.105, xxx.xxx.208.103
mynetworks_style = subnet
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.2.10/readme
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtp_tls_note_starttls_offer = yes
smtp_use_tls = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,      permit_mynetworks,      reject_unauth_destination,      check_policy_service unix:private/policy-spf        permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/postfix/newcert.pem
smtpd_tls_key_file = /etc/postfix/newreq.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
unknown_local_recipient_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:207
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 51200000
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 207
virtual_transport = virtual
virtual_uid_maps = static:207

DNS Zone:
Code:

$TTL 86400
mydomain.com.    IN      SOA    ns1.mydomain.com. root.mydomain.com. (
                        2006070816
                        21600
                        3600
                        1209600
                        3600 )

                TXT    "My Domain"

mydomain.com.    IN      NS      ns1.mydomain.com.        ; Hostname of nameserver
mydomain.com.    IN      NS      ns2.mydomain.com.        ; Slave nameserver

mydomain.com.    IN      TXT    "v=spfl a mx ptr -all"  ; SPF record

@              IN      A      xxx.xxx.193.34
ns1            IN      A      xxx.xxx.193.34 ; Nameserver 1
ns2            IN      A      xxx.xxx.193.35 ; Nameserver 2
mail            IN      A      xxx.xxx.193.34
Mybox          IN      A      xxx.xxx.193.34
www            IN      CNAME  @; IP of webserver

mydomain.com.  IN      MX      10 MyBox.mydomain.com.

Reverse Zone:
Code:

This is handled by my colo provider. This is what dnsstuff.com returns for my reverse zone.
34.193.xxx.xxx.in-addr.arpa mydomain.com [TTL=21600]

Hostname:
Code:

# hostname --short
MyBox
# hostname --fqdn
MyBox.mydomain.com

EHLO:
Code:

# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 MyBox.mydomain.com ESMTP Postfix
EHLO mydomain.com (replace with virtual domains as well and returns the below for all)
250-MyBox.mydomain.com
250-PIPELINING
250-SIZE 20480000
250-VRFY
250-ETRN
250-STARTTLS
250 8BITMIME
quit
221 Bye
Connection closed by foreign host.

Other notes. I am running on Gentoo and I am using postfixadmin with mysql. I also have 3 virtual domains I am managing and I would like to send email from them as well. I have their forward zones done the same as my main domain as above, but for the MX records I use mail.virtual-domain-x.com which points to xxx.xxx.193.34.

This problem has just been fustrating me for the past week and I've tried various things from google searches and the gentoo forums with no avail. It would be great if I can get to the point that my mail no longer gets flagged as spam by providers such as gmail.

trickykid 12-10-2006 12:43 PM

My question would be: Are you using a DHCP address with your broadband account with your ISP? This would be one reason you're being flagged as a spammer. Most ISP's and major mail servers with accounts like Yahoo, MSN and Gmail all reject mail servers that have DHCP connections as they are most likely an open relay for spammers.

Soynuts 12-10-2006 01:01 PM

The server is a colo box housed in a datacenter, so no I'm not using a DHCP address.

trickykid 12-10-2006 03:00 PM

Quote:

Originally Posted by Soynuts
The server is a colo box housed in a datacenter, so no I'm not using a DHCP address.

Check and make sure the IP you're using isn't on any existing spamhaus or spam lists. One site I know of is doing a search on http://whois.sc and look under Blacklist Status: in the results to see if it's clear or not.

Other lists are http://www.spamhaus.org/ and http://www.spamcop.com/ to name just a few.

Also if you can provide a few headers of returned mail, that might give some insight of the problem.

Soynuts 12-10-2006 03:24 PM

Just checked those out, I'm not on any of those lists. Here is a header from a message in gmail that ends up flagged as spam. This message was sent with the php mail() method from the webserver on the same box.

Code:

Delivered-To: myGmailAccount@gmail.com
Received: by 10.90.66.3 with SMTP id o3cs579455aga;
        Sun, 10 Dec 2006 13:14:31 -0800 (PST)
Received: by 10.64.241.3 with SMTP id o3mr9618223qbh.1165785271604;
        Sun, 10 Dec 2006 13:14:31 -0800 (PST)
Return-Path: <apache@mydomain.com>
Received: from MyBox.mydomain.com (mydomain.com [xxx.xxx.193.34])
        by mx.google.com with ESMTP id f17si5673723qba.2006.12.10.13.14.31;
        Sun, 10 Dec 2006 13:14:31 -0800 (PST)
Received-SPF: pass (google.com: best guess record for domain of apache@mydomain.com designates xxx.xxx.193.34 as permitted sender)
Received: by MyBox.mydomain.com (Postfix, from userid 81)
        id 28CB2E7C243; Sun, 10 Dec 2006 16:17:49 -0600 (CST)
To: myGmailAccount@gmail.com
Subject: Test
MIME-Version: 1.0
Content-type: text/html; charset=utf-8
From: User1 <user1@virtual-domain1.com>
Message-Id: <20061210221749.28CB2E7C243@MyBox.mydomain.com>
Date: Sun, 10 Dec 2006 16:17:49 -0600 (CST)

If you need me to post my real domain (and virtual domains) I will post it.

trickykid 12-10-2006 03:42 PM

Does any other service flag it? I'm sure with gmail you can flag a message as not being spam. Perhaps they've never seen this domain so that's why it's being flagged for some reason.

Soynuts 12-10-2006 07:02 PM

I got some friends to help out with it with their email addresses. All the gmail and hotmail people got it as spam. Yahoo did not flag it as spam. I don't have any "non-major" email accounts I can try it with.

trickykid 12-10-2006 07:21 PM

Quote:

Originally Posted by Soynuts
I got some friends to help out with it with their email addresses. All the gmail and hotmail people got it as spam. Yahoo did not flag it as spam. I don't have any "non-major" email accounts I can try it with.

If it Yahoo didn't flag it, most likely it's just settings on each ISP or email provider. Try sending an email to possibly some recipients that aren't a major provider that run their mail server for a business and see if their spam solutions if they have any block or flag it.

gani 12-11-2006 07:53 AM

Mail servers do perform reverse lookups to revalidate a sending MTA's domain or FQDN and it rejects those that
doesn't resolve properly.

If it doesn't resolve, this is what will be shown.

@webmaster:~$ host your.internet.ip.add
Host your.internet.ip.add.in-addr.arpa not found: 3(NXDOMAIN)

This one next is what should be expected.

@webmaster:~$ host your.internet.ip.add
your.internet.ip.add.in-addr.arpa domain name pointer your.domain.com.

----------
GANI

Soynuts 12-11-2006 08:23 AM

My DNS does resolve correctly when I use dnsstuff.com.

I was able to test it with a non major public email provider. I sent a test email to my work email, which has pretty tight spam protection and it arrived in my mail box just fine. So it seems that gmail and hotmail are the problems and not my smtp server. I would assume talking with hotmail/gmail would be the only way to get this resolved... if that's even possible.

chort 12-11-2006 12:24 PM

On thing is that your envelope sender does not match the body sender. The routing information (rfc2821) is for apache@mydomain.com, but your body sender (rfc2822) is user1@virtual-domain1.com. Some anti-spam techniques compare the envelope information with that in the body and give it a higher spam score if the addresses do not match.

Soynuts 12-11-2006 01:35 PM

I've tried it with both matching (apache@mydomain.com for the envelope and body) and it still ends up getting flagged as spam. I've run out of ideas I could try. Gmail and hotmail are the only ones I'm finding to have issues, no other mail server seems to flag it. I have no idea what other techniques hotmail and gmail could be using that other mail servers are not, such as yahoo. The SPF entry was newest addition which I added a week ago to my DNS zone.


All times are GMT -5. The time now is 03:18 PM.