0

I am trying to configure my RHEL6.5 server to send all emails addressed to root or apache to go to my external email address. I have found many guides on doing this and tried all of the suggestions I could find, including using Virtual Domain Redirection... But I believe the "right" way is to use the alias file. However, nothing works! At the moment I have my /etc/aliases file configured with the lines :

root:    my@email.com
apache:  my@email.com

However, when I run "newaliases", restart sendmail/postfix, then send a test email it still tries to send to root@localhost or apache@localhost, and fails.

The most complete/clear guide I've come across for what I'm doing is here : http://blog.bobbyallen.me/2013/02/03/how-to-redirect-local-root-mail-to-an-external-email-address-on-linux/

Please let me know if you have any ideas.

The output to sendmail -d27.2 -bv root and sendmail -d27.2 -d44.4 -bv root is...

Please note that I did modify some of the output paramaters to be generic rather than using my actual information. (Such as my hostname and whatnot)

            [root@domain-sys ~]# sendmail -d27.2 -bv root
            alias(root)
            root (, root) aliased to my@email.com
            self_reference(my@email.com)
                    ... no self ref
            my@email.com... deliverable: mailer esmtp, host email.com., user my@email.com
            [root@domain-sys ~]#
            [root@domain-sys ~]# sendmail -d27.2 -d44.4 -bv root
            safefile(/etc/mail/service.switch, uid=0, gid=0, flags=6480, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
                    [dir /etc/mail] OK
                    No such file or directory
            safefile(/etc/mail/service.switch, uid=0, gid=0, flags=6480, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
                    [dir /etc/mail] OK
                    No such file or directory
            safefile(/etc/mail/sendmail.cf, uid=0, gid=0, flags=6000, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=6000, level=0, offset=0):
                    [dir /etc/mail] OK
                    [uid 0, nlink 1, stat 100644, mode 400]         OK
            safefile(/etc/mail/local-host-names, uid=0, gid=0, flags=6580, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
                    [dir /etc/mail] OK
                    [uid 0, nlink 1, stat 100644, mode 400]         OK
            safefile(/etc/mail/relay-domains, uid=0, gid=0, flags=6580, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
                    [dir /etc/mail] OK
                    No such file or directory
            safefile(/etc/mail/trusted-users, uid=0, gid=0, flags=6580, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
                    [dir /etc/mail] OK
                    [uid 0, nlink 1, stat 100644, mode 400]         OK
            safefile(/etc/mail/service.switch, uid=0, gid=0, flags=6480, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
                    [dir /etc/mail] OK
                    No such file or directory
            safefile(/etc/mail/service.switch, uid=0, gid=0, flags=6480, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
                    [dir /etc/mail] OK
                    No such file or directory
            safedirpath(/var/spool/mqueue, uid=0, gid=0, flags=4, level=0, offset=0):
                    [dir /var/spool/mqueue] OK
            alias(root)
            safefile(/etc/mail/service.switch, uid=0, gid=0, flags=6480, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=6580, level=0, offset=0):
                    [dir /etc/mail] OK
                    No such file or directory
            safefile(/etc/aliases.db, uid=0, gid=0, flags=584, mode=400):
            safedirpath(/etc, uid=0, gid=0, flags=584, level=0, offset=0):
                    [dir /etc] OK
                    [uid 0, nlink 1, stat 100644, mode 400]         OK
            root (, root) aliased to my@email.com
            safefile(/etc/mail/mailertable.db, uid=0, gid=0, flags=584, mode=400):
            safedirpath(/etc/mail, uid=0, gid=0, flags=584, level=0, offset=0):
                    [dir /etc/mail] OK
                    [uid 0, nlink 1, stat 100640, mode 400]         OK
            self_reference(my@email.com)
                    ... no self ref
            my@email.com... deliverable: mailer esmtp, host email.com., user my@email.com
Ethan
  • 101
  • 2

1 Answers1

1

Step 1 - testing aliases processing:
As root execute the following test commands
(Use the second one only if the first ones shows some problems):

sendmail -d27.2 -bv root
sendmail -d27.2 -d44.4 -bv root

It should allow you to rule out or locate a few most likely causes such as:

  • sendmail looking for alias file in different location (e.g. /etc/mail/aliases )
  • sendmail ignoring aliases file due to broad write permissions

Step 2 - testing external delivery:
As root execute the following test command to send a test message in verbose mode:

(echo Subject: test; echo) | sendmail -v root

It should allow you to rule out or locate a few most likely causes such as:

  • invalid sender domain (Rejected "MAIL FROM:")
  • rejects due to host being listed by public or private DNSBL
AnFi
  • 6,103
  • 1
  • 14
  • 27
  • Interestingly enought that seems to be aliasing correctly (adding output to post to see if you catch something I missed.) – Ethan Sep 12 '14 at 15:40