[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "hostname" question during Debian installation



Tom H wrote:
> >> What I find somewhat weird is that when you install Debian,
> >> "/etc/hostname" and "/etc/mailname" are the same.
> >> So if it's "box.company.internal" and bob runs "mail tom", bob's
> >> address'll be "bob@box.company.internal".
> >
> > Yes. Seems reasonable to me. That is exactly what I want. It is
> > traditional BSD/Unix behavior.
> 
> But the address should be "bob@company.internal"!

If that is what you desire (it isn't what I want) then it is probably
easiest to set myorigin through /etc/mailname.  There are also a
number of other possibilities including masquading and various Postfix
addresses rewriting processes.

> > It would be perfectly nice if the package installation dialog were to
> > ask the user if they want to set up address masquerading and to do it
> > automatically. But for anyone who wants it the configuration is very
> > easily accomplished with one of the above. I prefer to leave
> > /etc/mailname along and to configure postfix explicitly. Then I can
> > control over masquerade_classes and local_header_rewrite_clients too.
> 
> IIUC, what you mean by masquerading is that if you send an email from
> "box.company.internal", the email address is "bob@company.internal"
> rather than "bob@box.company.internal".

Yes.  That is correct.  But not sure if we are poking at the "box"
removal part or the ".internal" part.  I guess pedantically I would
say yes to both if that is the hostname and fqdn.  But I would
probably have a different domain name and not be using an ".internal"
name.  If I were actually using a ".internal" name then I would
probably be wanting to do address rewriting.  But it is my turn to say
that I have never been in an environment that actually used that type
of name strategy.

> I've never worked in or set up an environment where the sender's
> address is "bob@box.company.internal". But this explains why you
> didn't think "bob@box.company.internal" above was wrong.

If company.internal is the name of the dns domain then that seems
a reasonable default to me.  Because 99.44% of the time it will be
something really reasonable such as example.com which is actually a
real domain name.  I figure anyone that is actually using a literal
".internal" domain name would also know what they are doing and set up
some type of address translation for it.  But if they are setting up a
box trouble.proulx.com for example then I would expect the mail to
come from user@trouble.proulx.com.  :-)

> Anyway, I don't think that their argument was about masquerading; it
> was about what the canonical form of "/etc/mailname" should be.

Whatever the result it is easy to change /etc/mailname to be correct.
But if it should be enhanced to have a specific question then an
enhancement request to exim and postfix both would probably be in
order since neither of them ask about it but just assume and set it.

> "dpkg-reconfigure postfix" doesn't change "myhostname" either with a
> prompt for a hostname or through a "hostname" call so if you change
> the box's hostname, you have to edit "/etc/postfix.main.cf" by hand.

It doesn't seem to.  I suppose it should.  But it does edit
/etc/mailname and that is probably enough.  I am sure that is what the
postfix maintainer is thinking.

> >> You can then change "/etc/hostname"
> Changing /etc/hostname has no effect for postfix.
> >> and "/etc/mailname", install postfix, and see what gets pulled in as
> >> "myhostname" into "/etc/postfix/main.cf".
> >
> > Changing mailname doesn't really have an effect on the
> > /etc/postfix/main.cf configuration. Because there is a Debian
> > specific patch to in enable reading myorigin from a file. So it has
> > an effect only through the patched code that pulls in the value
> > dynamically when postfix starts from /etc/mailname instead of needing
> > to specify myorigin in the main.cf file explicitly.
> 
> I don't follow. Changing "/etc/mailname" changes "myorigin" because of
> that patch.

Right.  But it doesn't cause the postinst script or any other process
to change main.cf.  So above you postulated that setting hostname and
mailname could possibly affect the settings in main.cf.  But they
don't.  The main.cf file won't be changed regardless of what is set in
mailname due to using the contents dynamically.

> (I usually change "myorigin = /etc/mailname" to its actual
> value on my boxes...)

I don't need to now but previously used to ensure that myhostname was
set and then remove the myorigin line.  Then it defaults to
myhostname.  But of course if you want to masquarade then myorigin
makes sense.

> Anyway, I was only suggesting the "mailname" change because on my
> boxes "hostname" and "mailname" are the same and I just wanted to
> ensure that they were different to trace what info the installer is
> picked up from where by the installer.

Good.  "A good pilot is always learning."  :-)

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: