Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FQDN via DHCP, then used in exim4

19 views
Skip to first unread message

Klaus Doering

unread,
May 16, 2013, 9:40:03 AM5/16/13
to
Hi All, just joined this mailing list after years of lurking :-)

On my home network I run approx. 10 clients, mostly Debian powered (from
a fileserver and several laptops and
desktops to NSLU2s and a Raspberry PI). It is set-up such that the
router (Billion 7800N) also serves as a DHCP and as
the local DNS server. Most clients on the LAN are assigned a fixed IP
address, and I achieve that by providing a list of
MAC addresses, hostnames and corresponding IP address on the router.
Further, the router also knows and serves
my domain name (something like 'my-domain-name.me.uk'), and the DHCP
clients request all this info. Works a treat.
This is an example of a file in /var/lib/dhcp:

$ cat /var/lib/dhcp/dhclient.eth0.leases
lease {
interface "eth0";
fixed-address 192.168.0.77;
option subnet-mask 255.255.255.0;
option routers 192.168.0.1;
option dhcp-lease-time 86400;
option dhcp-message-type 5;
option domain-name-servers 192.168.0.1;
option dhcp-server-identifier 192.168.0.1;
option host-name "rpi";
option domain-name "my-domain-name.me.uk";
renew 4 2013/05/16 02:00:04;
rebind 4 2013/05/16 02:00:04;
expire 4 2013/05/16 02:00:04;
}
(...)


The RaspPi (running Raspbian, a version of Wheezy for the ARMHF
architecture) also acts as a mail server, talking
SMTP to the wider world using exim4. After I got an error message from
some strict server telling me

504 5.5.2<rpi>: Helo command rejected: need fully-qualified hostname


I noticed that exim does NOT use the DHCP-provided domain name.
The unqualified host name is set in /etc/hostname, and in /etc/hosts I
intentionally did not set the external IP or
domain name.

$cat /etc/hostname
rpi

$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 rpi

Now, I can make exim work by manually providing the domain name in
/etc/hosts and /etc/mailname,

$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 rpi.my-domain-name.me.uk rpi

but somehow I had hoped that the DHCP served domain name should suffice
for all services? And despite of what it
says in the comments inside the exim config file (
/etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs )


# Decide which domain to use to add to all unqualified addresses.
# If MAIN_PRIMARY_HOSTNAME_AS_QUALIFY_DOMAIN is defined, the primary
# hostname is used. If not, but MAIN_QUALIFY_DOMAIN is set, the value
# of MAIN_QUALIFY_DOMAIN is used. If both macros are not defined,
# the first line of /etc/mailname is used.
.ifndef MAIN_PRIMARY_HOSTNAME_AS_QUALIFY_DOMAIN
.ifndef MAIN_QUALIFY_DOMAIN
qualify_domain = ETC_MAILNAME
.else
qualify_domain = MAIN_QUALIFY_DOMAIN
.endif
.endif

it is not sufficient to set the domain in /etc/mailname, instead
/etc/hosts must contain the FQDN.

Sorry long post. Can anybody shine light on this, and maybe even know
how to make use of the DHCP provided
domain name in exim?

Thanks
Klaus


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/519492B1...@gmail.com

Stan Hoeppner

unread,
May 16, 2013, 10:20:02 AM5/16/13
to
On 5/16/2013 3:02 AM, Klaus Doering wrote:
...

> Sorry long post. Can anybody shine light on this, and maybe even know
> how to make use of the DHCP provided
> domain name in exim?

First, using a DHCP server, in a consumer broadband router or otherwise,
to assign -sticky static- addresses and hostnames is counterproductive
and counter intuitive. You're doing this because you've never been
taught not to. I'm teaching you now: Don't do this. Now you will ask
me why, and I will direct you to Google as I don't have time to write
you the many books you should already have read on the subject.

DHCP is for assigning resources to -client- computers, not -server-
computers. You will not find a server application (mail) developer who
codes for your DHCP situation. They all code assuming addresses and
hostnames are assigned within local UNIX files, or assuming you will
manually configure such things.

To answer your EXIM question, read this thread:
http://serverfault.com/questions/46545/how-do-i-change-exim4s-primary-hostname-on-a-debian-box

--
Stan


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/5194E6AD...@hardwarefreak.com

Joe

unread,
May 16, 2013, 3:00:02 PM5/16/13
to
On Thu, 16 May 2013 09:02:57 +0100
Klaus Doering <klaus.do...@gmail.com> wrote:


>
> The RaspPi (running Raspbian, a version of Wheezy for the ARMHF
> architecture) also acts as a mail server, talking
> SMTP to the wider world using exim4. After I got an error message
> from some strict server telling me
>
> 504 5.5.2<rpi>: Helo command rejected: need fully-qualified hostname
>
>
> I noticed that exim does NOT use the DHCP-provided domain name.
> The unqualified host name is set in /etc/hostname, and in /etc/hosts
> I intentionally did not set the external IP or
> domain name.
>

Apart from any other issue, please note that the HELO string provided
by your mailserver really needs to be a hostname which can be resolved
in *public* DNS. On the assumption that you're not running your own
public DNS server, then you will need an A record with your domain
host. It's easiest if you use the same A record your MX points to,
though it's not necessary.

Not all mail servers will require their senders to have a resolvable
HELO, but many will, including my exim4. It's disabled by default, I
think, but it's a useful spam reduction technique. Oddly, some of the
pickiest servers now seem to be Exchange installations.

--
Joe


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/20130516190...@jretrading.com

Klaus Doering

unread,
May 16, 2013, 3:20:02 PM5/16/13
to
Stan, Thank you for the teaching. Indeed, there are many books I should
have read already, alas, there are a great many subjects about which
important books are written. So, I go along and learn when things don't
work as expected. Like now.

The story about using DHCP to assign fixed addresses doesn't seem to be
as clear cut as might appear from your tone, either:

http://serverfault.com/questions/199104/dhcp-addressing-vs-static-addressing-for-servers

I do take your point about the developer's perspective, and if that's the
way things work, then I have no problem editing config files on
the server for IP, host name and domain name. Indeed, as I described
earlier, that's exactly what I'd done already.

It's just curious that some services seem to acknowledge the DHCP
assigned domain name, while others don't. And _that_ question is still
open.

Klaus

On 16/05/13 15:01, Stan Hoeppner wrote:
> On 5/16/2013 3:02 AM, Klaus Doering wrote:
> ...
>
>> Sorry long post. Can anybody shine light on this, and maybe even know
>> how to make use of the DHCP provided
>> domain name in exim?
> First, using a DHCP server, in a consumer broadband router or otherwise,
> to assign -sticky static- addresses and hostnames is counterproductive
> and counter intuitive. You're doing this because you've never been
> taught not to. I'm teaching you now: Don't do this. Now you will ask
> me why, and I will direct you to Google as I don't have time to write
> you the many books you should already have read on the subject.
>
> DHCP is for assigning resources to -client- computers, not -server-
> computers. You will not find a server application (mail) developer who
> codes for your DHCP situation. They all code assuming addresses and
> hostnames are assigned within local UNIX files, or assuming you will
> manually configure such things.
>
> To answer your EXIM question, read this thread:
> http://serverfault.com/questions/46545/how-do-i-change-exim4s-primary-hostname-on-a-debian-box
>


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/519530D7...@gmail.com

Klaus Doering

unread,
May 16, 2013, 3:30:02 PM5/16/13
to
Joe,

Yes, I've set the "A" and the "MX" record to the same FQDN, and that is
also the HELO string. (at least now that I adjusted the entry in the
hosts file.)

Thanks,
Klaus

On 16/05/13 19:06, Joe wrote:
> Apart from any other issue, please note that the HELO string provided
> by your mailserver really needs to be a hostname which can be resolved
> in *public* DNS. On the assumption that you're not running your own
> public DNS server, then you will need an A record with your domain
> host. It's easiest if you use the same A record your MX points to,
> though it's not necessary. Not all mail servers will require their
> senders to have a resolvable HELO, but many will, including my exim4.
> It's disabled by default, I think, but it's a useful spam reduction
> technique. Oddly, some of the pickiest servers now seem to be Exchange
> installations.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/519533...@gmail.com

Stan Hoeppner

unread,
May 17, 2013, 2:10:02 PM5/17/13
to
On 5/16/2013 2:17 PM, Klaus Doering wrote:
> Stan, Thank you for the teaching. Indeed, there are many books I should
> have read already, alas, there are a great many subjects about which
> important books are written. So, I go along and learn when things don't
> work as expected. Like now.
>
> The story about using DHCP to assign fixed addresses doesn't seem to be
> as clear cut as might appear from your tone, either:
>
> http://serverfault.com/questions/199104/dhcp-addressing-vs-static-addressing-for-servers

It's actually very clear. Has been forever. The problem is that the
experts who know why -not- to use DHCP here aren't writing about it.
It's common sense, rule of thumb, etc. Everyone knows it. Everyone
except the few folks such as yourself who ask "why not", then writing
something up showing how it 'might' work. Simply put, you're reading
things written by folks who don't know what they're doing, who don't
have long experience. Some food for thought:

1. When your DHCP server goes down or is unreachable this can wreak
havoc. When IPs and hostnames are configured in local UNIX files this
is never a problem. So you must create a failover DHCP server. Getting
this to work seamlessly is notoriously difficult. It's one thing in an
ISP setting when DHCP failover has a lengthy delay. It's quite another
when you can't receive email for you 10,000 person organization for many
minutes while the DHCP servers sink up and the MX MTA can't get its IP
and hostname again.

2. When you swap a defective server NIC udev rules can keep a local
static IP consistent on eth0, or require little reconfiguration after
the NIC swap. Using your DHCP scenario you must write down the MAC
address from the sticker on the card before inserting it, update the
record in the DHCP server with the new MAC, then power up the box. The
ethernet industry has been working for many years to -eliminate- the
need for direct anipulation of MAC addresses. In your scenario you're
relying on it. Etc, etc, etc.

While it may be possible, in most environments it is simply impractical,
and creates far more problems than it solves. If this was a great idea,
Rackspace et al would be doing it. And none of them are.

--
Stan


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/519671AD...@hardwarefreak.com

Klaus Doering

unread,
May 19, 2013, 4:50:02 AM5/19/13
to
Stan,

Thank you for taking the time to explain your perspective. Maybe it is
the tone of your teachings that tickle me, maybe it's just that I'm no
big fan of sweeping statements a la "Don't do it, ever". As I described
in my initial post, this thread concerns a small domestic setting. There
is very little redundancy in such a setup, and the
router+firewall+switch+ap is one of the single point of failures that
potentially bring down most of the installation. And that's quite
independent of whether or not it also acts a a dhcp server to hand out
ip info to -- say -- an email server. My way of dealing with this
inherent weakness is that I have an old router that can be swapped in
and configured to do most of the jobs, until the original one is
repaired or replaced. Good enough for me; your guess is as good as mine
about how many typical domestic installations even have a backup
router...

I agree that in a different setting, where there are many users,
hundreds of emails per minute and other mission-critical stuff is going
on, one needs to design the infrastructure a lot more carefully.

So, the initial question remains unanswered: what happens to the
information provided by the dhcp server as reported in the lease file in
/var/lib/dhcp, how is it accessed, and is there a way to make exim4 use
it?

Klaus
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/5198913F...@gmail.com

Arun Khan

unread,
May 19, 2013, 7:50:02 AM5/19/13
to
On Sun, May 19, 2013 at 2:15 PM, Klaus Doering
<klaus.do...@gmail.com> wrote:
>
> I agree that in a different setting, where there are many users,
> hundreds of emails per minute and other mission-critical stuff is going
> on, one needs to design the infrastructure a lot more carefully.
>

As a thumb rule, any system providing a service (e.g. email) ought to
be configured with static IP. With email, you also need a DNS with a
MX resolving to the hostname/IP number of your email server.

>
> So, the initial question remains unanswered: what happens to the
> information provided by the dhcp server as reported in the lease file in
> /var/lib/dhcp, how is it accessed, and is there a way to make exim4 use
> it?
>

I use postfix, so cannot comment about exim. In postfix, to the best
of my understanding, there is no provision to get network parameter
information from dhclient files. I suspect the same is the case with
exim.

--
Arun Khan
Sent from my non-iphone/non-android device


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAHhM8gC0cf3d-f724is5XHJiyr9QRMZ=4-TrQRw2s...@mail.gmail.com

Klaus Doering

unread,
May 19, 2013, 9:00:03 AM5/19/13
to

On 19/05/13 12:48, Arun Khan wrote:
> On Sun, May 19, 2013 at 2:15 PM, Klaus Doering
> <klaus.do...@gmail.com> wrote:
>> I agree that in a different setting, where there are many users,
>> hundreds of emails per minute and other mission-critical stuff is going
>> on, one needs to design the infrastructure a lot more carefully.
>>
> As a thumb rule, any system providing a service (e.g. email) ought to
> be configured with static IP. With email, you also need a DNS with a
> MX resolving to the hostname/IP number of your email server.
>
>> So, the initial question remains unanswered: what happens to the
>> information provided by the dhcp server as reported in the lease file in
>> /var/lib/dhcp, how is it accessed, and is there a way to make exim4 use
>> it?
>>
> I use postfix, so cannot comment about exim. In postfix, to the best
> of my understanding, there is no provision to get network parameter
> information from dhclient files. I suspect the same is the case with
> exim.
>
Thanks Arun,

This email server is not directly connected to the 'net, it sits behind
a router. Thus, there is one external IP for which I've registered an "A"
record and an "MX" record on a public DNS server, and then there is an
internal IP server on my LAN. The later one is fixed, but is not defined
in a config file on the server, but is "reserved" in the DHCP server and
assigned to the server. Same for the domain name, which internally
(i.e. on my LAN) is distributed by the DHCP server. In "dnsmasq" this
would be the "domain=" option. And it is this option that is not
acknowledged by exim.

Klaus


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/5198CAB5...@gmail.com

Andrei POPESCU

unread,
May 19, 2013, 10:30:02 AM5/19/13
to
On Du, 19 mai 13, 13:51:01, Klaus Doering wrote:
>
> This email server is not directly connected to the 'net, it sits behind
> a router. Thus, there is one external IP for which I've registered an "A"
> record and an "MX" record on a public DNS server, and then there is an
> internal IP server on my LAN. The later one is fixed, but is not defined
> in a config file on the server, but is "reserved" in the DHCP server and
> assigned to the server. Same for the domain name, which internally
> (i.e. on my LAN) is distributed by the DHCP server. In "dnsmasq" this
> would be the "domain=" option. And it is this option that is not
> acknowledged by exim.

Let me try to put it differently: because server software (including if
not especially mail servers) are usually on static IPs server software
does not need to reconfigure itself based on information from a DHCP
server. You would have to write your own scripts to achieve that.

Kind regards,
Andrei
--
http://wiki.debian.org/FAQsFromDebianUser
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
signature.asc

Arun Khan

unread,
May 19, 2013, 12:50:05 PM5/19/13
to
On Sun, May 19, 2013 at 6:21 PM, Klaus Doering
Whether a server sits on the WAN or an internal LAN (with no
visibility on the WAN), the principles of configuration are the
same. Instead of public route-able IPs you would be dealing with
private IPs.

The FQDN is extracted from /etc/hosts entry and hostname from /etc/hostname [a]

[a] <http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_domain_name>

IMO, you would be better off configuring the system with static ip and
FQDN in /etc/hosts.

As others have pointed out, this is the standard practice for server setup.

Alternately, you could query on the exim mailing list to resolve your
requirement.

--
Arun Khan
Sent from my non-iphone/non-android device


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/CAHhM8gAokWKOdOCUCs_F2Qwg...@mail.gmail.com

Stan Hoeppner

unread,
May 19, 2013, 3:30:01 PM5/19/13
to
On 5/19/2013 3:45 AM, Klaus Doering wrote:
> Stan,
>
> Thank you for taking the time to explain your perspective. Maybe it is
> the tone of your teachings that tickle me, maybe it's just that I'm no
> big fan of sweeping statements a la "Don't do it, ever". As I described

Many folks with long experience make forceful sweeping statements to
prevent others from wasting time and to avoid frustration.

> in my initial post, this thread concerns a small domestic setting.

Yes, I got that.
...
> I agree that in a different setting, where there are many users,
> hundreds of emails per minute and other mission-critical stuff is going
> on, one needs to design the infrastructure a lot more carefully.

And this is the crux of it. As I said, people who write MTAs and other
server applications, as well as OS maintainers, assume that static
addresses are assigned in the traditional UNIX way. They simply don't
consider that anyone would ever use DHCP to assign an address or
hostname, or an MX record, to an internet facing server.

> So, the initial question remains unanswered: what happens to the
> information provided by the dhcp server as reported in the lease file in
> /var/lib/dhcp, how is it accessed, and is there a way to make exim4 use
> it?

If there is a way I have no clue how to accomplish it. If you figure it
out you may want to write a detailed paper and publish it for others who
may want to follow in your footsteps.

Best of luck.

--
Stan
Archive: http://lists.debian.org/5199272F...@hardwarefreak.com

Klaus Doering

unread,
May 19, 2013, 4:20:02 PM5/19/13
to
Thanks All,

I fully accept that exim is as it is, and being an
(instrumentation-)developer
myself it's easy to see how we got here. As stated in my very first post,
I did make it all work by using "proper" ;-) entries in /etc/hosts,
hostname and mailname. This being my first email server installation,
I was simply surprised and wanted to understand the background.

So, thanks again for your explanations and your patience

Klaus
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/5199336D...@gmail.com
0 new messages