I run a desktop Linux system at home. My network connection is thru Time-Warner Roadrunner. They provide an smtp server that I can send email out to the net thru. I have a script that runs twice a day, gathers up information from my machine and emails it to hotmail.com, so that I can read it at work on an iPad. This all worked fine until two days ago. The only thing on my end that happened about then was a power outage that caused my machine to reboot, so I assume that Time-warner has changed how they react to me e-mailing thru their smtp server.
My script basically creates an entire mail message, complete with From: and To: lines, and then uses
/usr/sbin/sendmail -t < /tmp/Xmail.$$
to mail it out.
If I try to do this by hand, with a minimal mail file that just says
To:
james.lyle.peterson@hotmail.com
From: James Peterson <lyle@austin.rr.com>
and add a "-v" flag to the sendmail command, I can see that the smtp server is complaining
>>> MAIL From:<crazylyle@austin.rr.com> AUTH=crazylyle@localhost.localdomain
550 Invalid sender address rejected NSA [R0107006]
which makes sense to me. On my local machine, I am "crazylyle" (I tried to choose an ID that no one else in the world would want), but to my ISP I am
lyle@austin.rr.com.
To get this to work, I clearly need to translate my local ID "crazylyle" to "lyle@austin.rr.com".
sendmail, when it is sending outgoing mail, uses /etc/mail/submit.cf to control how it works. There are two types of mappings that can be defined to map a local user ID to a remote user ID. The first of those, that most of the documentation talks about, is aliases and masquerading, but that really only affects incoming mail. None the less, I have turned on masquerading and alias:
define(`ALIAS_FILE', `/etc/aliases')dnl
MASQUERADE_AS(`austin.rr.com')dnl
FEATURE(`allmasquerade')dnl
FEATURE(`local_no_masquerade')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(always_add_domain)dnl
in my submit.mc. This seems to do nothing (as expected).
For outgoing mail, as I understand it, the important part is the Generics table, and I have that turned on too:
FEATURE(`genericstable')dnl
GENERICS_DOMAIN(`localhost.localdomain austin.rr.com')dnl
and my generics table file is:
crazylyle
lyle@austin.rr.com
crazylyle@austin.rr.com lyle@austin.rr.com
crazylyle@localhost.localdomain
lyle@austin.rr.com
trying to say that if you ever see crazylyle, under any circumstances, convert it to
lyle@austin.rr.com
But still when I run sendmail -v, it does the same:
>>> MAIL From:<crazylyle@austin.rr.com> AUTH=crazylyle@localhost.localdomain
550 Invalid sender address rejected NSA [R0107006]
I found a page that listed debug flags for sendmail and have tried
sendmail -v -d0.12 -d1.12 -d11.12 -d12.12 -d13.12 -d14.12 -d16.12 -d19.12 -d21.12 -d27.12 -d28.12 -d30.12 -d31.12 -d36.12 -d37.12 -d45.12 -d47.12 -d60.12 -d95.12 -t < /tmp/outgoing
and looking at the log, I can see that "crazylyle" is not being translated to "lyle@austin.rr.com".
I found a page that explained how you can run sendmail by hand, and ask it to do translations:
# sendmail -v -bt -Csubmit.cf
> tryflags HS
> /try esmtp crazylyle
There are 4 types of flags, that affect what tables are used to do the translation: H (Header), E (Envelope), S (Sender), or R (Recipient). When I do this, and then change the flags, try it again, change the flags, try it again, ... It fails to do the translation for awhile, and then some combination of the flags, or some sequence of them, will cause it to start translating correctly, at least for some of the flags (even some that it failed to work with before). My best explanation of this was initialized memory, but running this under valgrind does not show any issues with memory or pointers.
This can't be that hard. Clearly, there must be lots of people who have ISPs and their local IDs are different from their IDs at the ISP, and some of them must try to email out. The web pages I have found that suggest how it is done all seem to indicate that what I have done should work. But it doesn't.
I don't even understand how it knows that I am crazylyle. I have "su -" to root, then to another user, then back to root, so that I am running as root, from another user. There is nothing left in an env variable that says that I am "crazylyle". The message I am trying to send out only says "from
lyle@austin.rr.com" to "james.lyle.peterson@hotmail.com", but still the first (and most common) translation that shows up in the logs is:
rewrite: ruleset canonify input: crazylyle
...
rewrite: ruleset canonify returns: crazylyle
That's the first occurrence of "crazylyle" in the log, and there is no suggestion of where it comes from.
I've worked all day on this, and got nowhere. Any suggestions of where I'm going wrong?