Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am testing the handling of mail bouncing. When I send a test email to a bad domain, for example: eric@blahblahfail.org, I get the following error in my log:

SYSERR(root): blahblahfail.org.mydomain.org. config error: mail loops back to me (MX problem?)

It seems that if dns fails on the destination domain, sendmail will append my domain to the bad domain.

Why does this happen? And should I expect mail to bounce if the domain is bad? The Unknown-user @ good-domains type of bounces do work for me.

Possible relevant sendmail config lines:

FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl

Notes: I have tried removing the always_add_domain Feature. I have my domains listed in /etc/mail/local_host/names

share|improve this question
    
Sounds like you are missing a final dot in your Sendmail config; or perhaps the recipient domain's MX record is missing the final dot. In DNS zone files, you need example.com. with a trailing dot to make it absolute; just example.com is relative. –  tripleee Feb 3 '13 at 17:12
1  
I think the problem is that there was a wildcard in my dns A records. I discovered that if I ssh to a bad.domainname, it resolves to my own ip address. That led me to believe this isn't a sendmail problem, but a dns type problem. Seems if a hostname doesn't resolve, then my system appends my domainname to the unresolveable domainname. With a wildcard in the dns, that crazy domainname resolves to my ip address. –  onefiftyfour Feb 4 '13 at 17:14

2 Answers 2

see this question

This was not a sendmail problem. It was caused by a wildcard (*) in my dns A records.

I don't know why, but if a name doesn't get resolved, then my domain gets appended to the name, then the dns lookup resolves to my ip address because of the wildcard.

This effects mail, curl, ssh.

If I ssh to badbadfailfail.com, I ssh back to my ip.

I'm removing the wildcard in the dns records.

Adding this into /etc/resolv.conf also works:

search .
share|improve this answer
    
Adding search . to the resolv.conf appears to do the trick on its own –  mobiusnz Jan 27 '14 at 20:24

Been doing this on both BSD/SYSTEM 5 systems for 20 years +

edit /etc/nsswitch.conf

hosts:          files myhostname dns
networks:       files

edit /etc/hostname

#your hostname.domainname
127.0.0.1 ns1.local localhost.local ns1 localhost

thats it, don't get creative here. keep the loopback to localhost as 127.0.0.1 as well, you don't you'll break stuff here depending on your 'nix

192.168.0.200 ns1.local localhost.local ns1 localhost

edit your sendmail.cf -- yes I know what it says, but I'm right go ahead

/etc/mail/sendmail.cf
Fw/etc/mail/local-host-names %[^\#]
Cwns1 # your hostname alone
Dj$w.local # your domainname alone

Edit your file that you tell sendmail to check for relay, or hosts that will use sendmail.Name it however you want to so long as it matches the cf i.e. /etc/mail/local-host-names -- that is the default for sendmail latest I think

localhost  # Depending on your flavour of 'nix, BSD/SYSTEM 5, you NEED  
#this or you'll break something trying to fix a "small" problem
ns1.local
localhost.local # Same as above, I compile code all the time that calls 
#the loopback or 127.0.0.1

iptables, way too much to cover here however there are front ends, not so much. Written with the knowledge of whoever wrote them, I write code also. Lets ensure we allow port 25, our local network, 53 UDP IF DNS cache server, and 931 to our loopback unless we want to break our other critical services.

ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
DROP       all  --  0.0.0.0/0            0.0.0.0/0            ctstate INVALID
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
ACCEPT     all  --  192.168.0.0/24       0.0.0.0/0           
DROP       icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 8 ctstate NEW
LOG        icmp --  0.0.0.0/0            0.0.0.0/0            icmptype 8 ctstate NEW LOG flags 0 level 4
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:123
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:931
DROP       udp  --  0.0.0.0/0            0.0.0.0/0           
LOG        udp  --  0.0.0.0/0            0.0.0.0/0            LOG flags 0 level 4
DROP       tcp  --  0.0.0.0/0            0.0.0.0/0           
LOG        tcp  --  0.0.0.0/0            0.0.0.0/0            LOG flags 0 level 4
DROP       all  --  0.0.0.0/0            0.0.0.0/0           
LOG        all  --  0.0.0.0/0            0.0.0.0/0            LOG flags 0 level 4

Example above depends very much on YOUR configuration, network (I'm 192.168.0.0/24), figure this out on your own because this is NOT a "quid pro quo". I have a PIX in front of me and other "stuff" on my network. Delete localhost.local or your loopback at your own risk -- lots of OS folks hard code this into mandatory services I've seen other answers that will have you do away with this, don't do that.

# /etc/hosts
192.168.0.200 ns1.local localhost.local localhost
127.0.0.1 ns1.local localhost.local  ns1 localhost

Alright, let's restart everything and NO, no reboot we are 'nix sysadmins only thing that won't work is uname -a until we reload the kernel, can't do that from the command line. Become root or sudo whatever you are comfortable with. New guys stick to sudo for your own good.

service hostname restart
ifdown eth0
/etc/init.d/sendmail stop
iptables -F
iptables -nL # should be clean, no rulez
ifup eth0
iptables-restore "file" # wherever you told iptables to 
#iptables-save > "file" to write. Me, well 
#iptables-save > /etc/fw/iptables.rulez
iptables-restore /etc/fw/iptables.rulez # Thats me, pay attention 
#here or get whacked, firewalls are important and why we use 'nix
service hostname stop
service hostname start
/etc/init.d/sendmail start
hostname # should be hostname alone i.e. ns1
hostname -f # full host.domainname i.e. host.domainname for me it's ns1.local
service hostname status
/etc/init.d/sendmail start # tail -f /var/log/syslog or /var/log/messages
iptables-restore /etc/fw/iptables.rulez
tail -f /var/log/syslog or /var/log/messages # Again, depends on your 'nix

In closing I likely missed a step or two, off the top of my head do this and everything will work. Want to become very smart, forget forums and man or info you'll get smart a lot faster than forums. May take all night, but invaluable experience trust that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.