From: batrams on
I'm using Slack 12.0 as a firewall/router/mail relay for my home LAN.
Time Warner is the ISP and I have Sendmail set to send via their SMTP
server. It works ok from clients on the LAN, but I have trouble with
emails sent by the system (for example, Asterisk voicemail notices) not
getting sent because the "sender domain does not resolve".

I'd be happy to let Time Warner set my HOSTNAME via the dhcpcd request
which occurs when the system boots but I'm not sure how to do this. I
tried adding the -D option to the dhcpcd call in rc.inet1 but that did
not write anything to /etc/HOSTNAME

I'd think this would be a common problem but even after a fair amount of
Googling I'm not finding anything. Suggestions?

DB
From: Bit Twister on
On Mon, 26 Apr 2010 20:43:59 -0400, batrams wrote:
> I'm using Slack 12.0 as a firewall/router/mail relay for my home LAN.
> Time Warner is the ISP and I have Sendmail set to send via their SMTP
> server. It works ok from clients on the LAN,

Probably because they have set TW's smtp as their outbound server.

> but I have trouble with
> emails sent by the system (for example, Asterisk voicemail notices) not
> getting sent because the "sender domain does not resolve".
>
> I'd be happy to let Time Warner set my HOSTNAME via the dhcpcd request
> which occurs when the system boots

More correctly when network comes up or TW pushes you a new IP.

> but I'm not sure how to do this. I
> tried adding the -D option to the dhcpcd call in rc.inet1 but that did
> not write anything to /etc/HOSTNAME

As I misunderstand it, /etc/HOSTNAME is where you hard code hostname.
I would not expect your dhcp client to modify the file.

> I'd think this would be a common problem but even after a fair amount of
> Googling I'm not finding anything. Suggestions?

My solution is to use postfix as my MTA. I then set it up to use
/etc/postfix/generic(.db) which allows me to change from
bittwister(a)cooker.home.test into my_add(a)my.isp.
root(a)cooker.home.test into another_addy(a)hotmail.com

Has worked on
@home.com @comcast.com, @roadrunner and now @verizon.net.

My main.cf changes follow
$ dif main.cf main.cf_vorig
30,102d29
<
<
< #*****************************************************************
< # My changes appended to main.cf for my LAN nodes
< #
< # Modified aliases, generic
< # Do a tail -12 /etc/postfix/aliases
< # you need to change postfix to your login id
< # and create the .db file with the command
< #
< # postalias aliases
< #
< # Note: verizion wants you to use port 587 for smtp connection
< # leave off :587 to use standard SMTP port
< #
< #*****************************************************************
<
< # #*************************************************
< # #*
< # #* If you change this file be sure to change
< # #* /local/bin/postfix_changes
< # #*
< # #*************************************************
<
< default_destination_concurrency_limit = 1
<
< masquerade_exceptions = root
< mydestination = $myhostname localhost.$mydomain localhost $mydomain
< mynetworks = 127.0.0.0/8 192.168.1.0/24
< relayhost = outgoing.verizon.net:587
< relay_domains =
< inet_interfaces = all
< inet_protocols = ipv4
<
< unknown_local_recipient_reject_code = 550
< smtp_host_lookup = dns, native
<
< #*****************************************************************
< # Sending: swap out email addresses that appear inside messages (From:)
< # Recipients doing a reply, sends reply to second column.
< # Added a line like
< # bittwister(a)wm81.darkstar.test my_addy(a)sys_isp.net
< # to the generic file and create the .db file with the command
< #
< # postmap generic
< #
< #*****************************************************************
< smtp_generic_maps = hash:/etc/postfix/generic

From: batrams on
On 4/27/2010 12:12 AM, Bit Twister wrote:
> On Mon, 26 Apr 2010 20:43:59 -0400, batrams wrote:
>> I'm using Slack 12.0 as a firewall/router/mail relay for my home LAN.
>> Time Warner is the ISP and I have Sendmail set to send via their SMTP
>> server. It works ok from clients on the LAN,
>
> Probably because they have set TW's smtp as their outbound server.

This is not the case actually, but does give me a hint about the "from"
address of these system email triggering the problem. I'll see about
"spoofing" that - Thanks!

DB
From: Aaron W. Hsu on
batrams <nun(a)nowhere.com> writes:

>I'm using Slack 12.0 as a firewall/router/mail relay for my home LAN.
>Time Warner is the ISP and I have Sendmail set to send via their SMTP
>server. It works ok from clients on the LAN, but I have trouble with
>emails sent by the system (for example, Asterisk voicemail notices) not
>getting sent because the "sender domain does not resolve".

>I'd be happy to let Time Warner set my HOSTNAME via the dhcpcd request
>which occurs when the system boots but I'm not sure how to do this. I
>tried adding the -D option to the dhcpcd call in rc.inet1 but that did
>not write anything to /etc/HOSTNAME

>I'd think this would be a common problem but even after a fair amount of
>Googling I'm not finding anything. Suggestions?

So, I have dealt with this before, and it's fairly easy to fix in
Senmdail. I presume that you do not actually want to send email to
the outside with the invalid email address, so there are two
situations I think your email clients (sendmail) on the inside of the
network must do before they send email out via your ISP's SMTP server.

If the outbound email address or the recipient, IOW, is local, then
it's much easier and probably better to do no rewriting on the name
and just send it within your local network. If you don't want to do
this, then you still need to treat it like a non-local address heading
outside.

If the outbound recipients are non-local, you need to MASQUERADE or
rewrite your email headers and the envelope (not just your From
address) to match what your ISP expects.

In Sendmail, you can check the README file and modify the client
sendmail configuration m4 file. You will need to work with
MASQUERADE_AS, and the features masquerade_envelope and
no_local_masquerade, or whatever they are called.

There is also the option of using the generic rewrite rules feature in
sendmail, which is also documented in the README. Using this, you can
rewrite your email messages before you send them out, based on the
user who is sending them.

What I don't recommend is playing with the actual hostnames of your
machines. If your machines are local, and are not facing the outside
world, there is nothing wrong with having a domain name that is not a
fully-qualified domain. Just make sure that you rewrite the envelope
and the headers of your messages heading to the outside world to use
the domain names that you want to use when sending out.

Aaron W. Hsu
--
A professor is one who talks in someone else's sleep.