On Wed, 2006-08-09 at 08:14 +1000, Peter Miller wrote:
> Is it possible to have a DHCP server tell a DHCP client what the
> appropriate HELO string will be for the other side of the NAT?
> If not, is it possible to figure this out from everything else the
> client is given by the DHCP server?

Debian has packages like switchconf and whereami to change settings for
different environments. I've never actually used one of these, but it's
worth investigating a few of them to see if they can help manage mail
config as well.

> OR is this all wrong, and I should just have my laptop's sendmail
> forward stuff to a mail server inside of the NAT firewall, a server that
> DHCP tells me?  Can it tell me?

First of all, I think the best way to do this is to have an external,
public mail server you can authenticate to and relay through. Might need
to rejig it to also listen on a non-standard port, but it's by far the
most flexible solution.

DHCP does have a standard option for specifying SMTP servers[1], and
doing this is a much more elegant solution than trying to rejig the
client with custom HELO strings. For the ISC DHCP daemon, you'd add

  option smtp-server 10.1.1.2;

to your subnet declaration in your dhcpd.conf (yeah, it needs to be an
IP address, and not a hostname).

On the client end it gets a little trickier (note, I haven't actually
tried this, so YMMV :-). First of all, you should add smtp-server to the
request line in your dhclient.conf file, and including a default line
for networks that don't actually specify a server is probably a good
idea as well.

Now, when dhclient gets a lease, it runs /etc/dhcp3/dhclient-script ,
which among other things runs anything it finds
in /etc/dhcp3/dhclient-enter-hooks.d/ . In the environment
dhclient-script gets should be $new_smtp_server , and there may also be
$old_smtp_server depending on what dhclient is doing when it runs the
script. So you'll want to put a script
in /etc/dhcp3/dhclient-enter-hooks.d/ that will update your sendmail.mc
as described elsewhere in this thread, remake the sendmail config and
kick the server in the guts. Later debian and ubuntu boxes will probably
have an /etc/dhcp3/dhclient-enter-hooks.d/samba script for updating WINS
servers and domain info, which should be a good base for a mail server
script.

More info on how dhcp does its thing is in dhclient.conf(5),
dhclient-script(8) and dhcpd.conf(5).

Good luck!

[1] ftp://ftp.rfc-editor.org/in-notes/rfc2132.txt , section 8.14.
-- 
Pete

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to