Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have RHEL 5.4 with Postfix running fine for local delivery. The machine is on a separate network and has no outside access apart from a punch in the firewall for SMTP. I'm trying to get nagios to send alerts to an outside email address. I look at the logs and everything goes through fine, but I never receive a test message.

If I change the nagios alert mail back to nagios@thismachine I get alerts. But when I set it to go outside the LAN to the email account created EG, alert.outside.somehwere.com it gets lost. Here is my main.cf file to digest and see what mistakes I've made.

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
myhostname = $mydomain
mydomain = localhost.thismachine.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

##
mynetworks = 127.0.0.0/8

## RELAY DOMAIN ##
relay_domain = 3.50.70.200

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/

debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
disable_dns_lookups = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =

EDIT: Now I'm getting the error listed below. BIND is not on this system. Like I said it's just on a LAN with 1 punch through the corporate firewall to allow nagios alerts to go out from this machine to an external address that was created.

Name service error for name = somedomain.com type=MX: Host not found, try again
share|improve this question
    
You're using multiple parameters in your main.cf Use postconf -n to show yourself what Postfix actually sees when you use the same key name more than once (e.g. relayhost). Secondly, paste the relevant log excerpts from your /var/log/maillog, /var/log/mail.log or equivalent –  Philip Reynolds Dec 17 '09 at 12:47

4 Answers 4

up vote 0 down vote accepted

There are a few ways to approach this.

The first method is to use a "mail hub" approach. Is there an "official" email server at the firewall edge that you could use instead? The idea is that any non-local addresses would be forwarded to the "hub", which would then do the heavy lifting of routing it to the outside for you. It also eliminates the need for the firewall punch-through. Local addresses deliver locally (on the same host), remote addresses go 'elsewhere' and everyone is happy. It also simplifies the setup somewhat, and makes the duty of getting the message to the outside not your responsibility.

If a "hub" is not available (or desirable), I would then look at getting your name resolution fixed. The error

Name service error for name = somedomain.com type=MX: Host not found, try again

...indicates that it is attempting delivery, but can't figure out who to deliver to (assuming that somedomain.com is where you are sending the message). Check your settings in /etc/resolv.conf and make sure that you are using DNS servers that can resolve names for the 'outside'; it could be the DNS you are currently using only supports names 'inside' your LAN, and won't resolve external names (usually for security reasons). In a pinch, you could always use OpenNIC DNS servers to temorarily give name resolution, although you should keep in mind that it is not "official" and may have its own issues. You'll eventually want to replace the settings with something a bit more (ahem) permanent.

If somedomain.com is actually the domain that your machine is hiding behind, and the error message is generated by the destination you're contacting, then the problem is that the server failing to be identified correctly via reverse-lookup.

share|improve this answer
    
That worked, thank you! –  Matt Chavez Dec 18 '09 at 19:02

Two things, postfix only sets config settings once, so you want only one setting for relayhost, if you want failover you need to use DNS and multiple A or MX records.

Also, relay_domain isn't a valid setting.

Otherwise, it's almost certainly some spam filtering on the path.

share|improve this answer

You should set relayhost

In logfile I see the mail is queued, not sent. In my setup mail recevies state sent. This is strange:

Dec 17 07:52:34 ivvi sendmail[31921]: nBHCqYV0031921: from=root, size=61, class=0, nrcpts=1, msgid=<200912171252.nBHCqYV0031921@ivvi.jango.com>, relay=root@localhost
Dec 17 07:52:34 ivvi sendmail[31921]: nBHCqYV0031921: to=ergy.visupport@someaddress.com, delay=00:00:00, mailer=esmtp, pri=30061, dsn=4.4.3, stat=queued

In my setup (postfix on CentOS 5.3) mail is delivered by smtp daemon, not sendmail. Are you sure that postfix is running, not sendmail?

share|improve this answer
    
Sendmail is not running just postfix, I seem to have got it almost working. Posting the new logfile from /var/mail/maillog –  Matt Chavez Dec 17 '09 at 14:50
  1. Run postconf -n to see what your config actually is. Consider replacing your main.cf with the output of this command, to get rid of misspelled entries and whatnot.

  2. I'm guessing that 3.50.70.200 is the server you're supposed to send mail to? If so, you want something like relayhost = [3.50.70.200] . Note the [], they're significant.

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.