You are not logged in.

#1 2004-03-03 18:57:17

linuxfool
Member
Registered: 2004-02-17
Posts: 14

hostname, localhost, dhcp, postfix.

I have a few questions about setting 'hostname' - so that outgoing email through postfix is able to be recieved when the recieving mail server (sendmail in this case) is checking for valid domains in the 'from' field.... right now I get this error message. (modified slightly)

Mar  3 06:55:17 localhost postfix/smtp[4439]: D3291334069: to=<me@mydomain.com>, relay=mail.mydomain.com[111.22.333.44], delay=7618, status=deferred (host mail.mydomain.com[111.22.333.44] said: 451 4.0.0 <root@localhost.localhost>...
Sender domain unresolvable (in reply to MAIL FROM command))


The problem, I believe, is that with our dhcp / dns setup users get a 'real' IP address that is tied to a 'real' dns entry.... In my rc.conf I have:

#
# Networking
#
HOSTNAME="localhost"

and further down....
lo="lo 127.0.0.1"
eth0="dhcp"
INTERFACES=(lo eth0)

This works fine, except that it sets the hostname to 'localhost' and not to what is actually resolved when a lookup is done on my IP address. The IP that is assigned resolves to something like this (if one were to query it): dhcpxxx.mydomain.com where xxx is the last octet of the IP assigned by the dhcp server.

So my question is -- how do I set the hostname to be the same as what the dns servers report for a given IP....

I hope this mumble jumble makes some sense to somebody  lol

thanks,
ns

Offline

#2 2004-03-03 19:00:27

linuxfool
Member
Registered: 2004-02-17
Posts: 14

Re: hostname, localhost, dhcp, postfix.

The second part of the question, just to clarify a bit, is how do I make the rc init process set the correct hostname at each boot (since it
*might* get a new hostname every time).

Thanks,
ns

Offline

#3 2004-03-03 23:43:18

andy
Member
From: Germany
Registered: 2002-10-11
Posts: 374

Re: hostname, localhost, dhcp, postfix.

It seems the immediate answer to your question would be the -H flag for dhcpcd. dhcpcd is used in AL to do the DHCP IP-configuration. Unfortunately, AL currently has no way to give additinal parameters to dhcpcd by default (it came up quitre some time ago on the forum for other options, but with no result).

Anyways, you would need to edit /etc/rc.d/network and add the -H switch to the dhcpcd line. But first read the man page if this is really what you want ;-).

Alternatively, though, isn't it possible to do some magic with postfix ? Like masquearding ? ... hmm on second though, that probably won't help ;-) ... anyways, I'm not familar with postfix, so I better not suggest anything else.

Offline

#4 2004-03-04 01:30:26

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: hostname, localhost, dhcp, postfix.

I'm pretty sure you can't do that except for by hand.

Why would you receive mail to username@dhcpxxxx.mydomain.com?  Every time your IP changed, you'd have to tell everyone your "new" email address.

What you probably want is a dynamic nameserver service, like yi.org or darktech.net.  That way your email address will be imapoopyhead@silly.yi.org no matter what your SMTP server's IP address is.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#5 2004-03-04 01:31:39

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: hostname, localhost, dhcp, postfix.

Oh yeah, and you set what the local machine's hostname is with postfix in /etc/postfix/main.cf.  The myhostname variable and mydestination.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#6 2004-03-04 05:37:56

linuxfool
Member
Registered: 2004-02-17
Posts: 14

Re: hostname, localhost, dhcp, postfix.

Thanks all, I'll look into the suggestions.

I'm not recieving mail to this box, just sending it. The server (our main MX - which is where I'm sending mail off to) is configured to reject mail where the host in the 'From' is not a FQDN that resolves (anti-spam measure).

If all else fails I'll do it by hand, no bigie since the box has never been rebooted since it's been brought up and updated, I just fear I'll forget to set it one of these days if I opt for the manual method. I'll post my findings back in the next few days.

Take care,
ns

Offline

#7 2004-03-04 07:22:50

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: hostname, localhost, dhcp, postfix.

Set up your postfix to send to your ISP's relay.  I've had to do this as well.

The variable is relayhost.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#8 2004-03-04 11:15:31

andy
Member
From: Germany
Registered: 2002-10-11
Posts: 374

Re: hostname, localhost, dhcp, postfix.

As far as I understnad the problem : he is already sending via the mail relay. But the mail relay is very picky about who is allowed to relay. Apparently it is not sufficient to only have an IP-address from a predefined pool, but also the hostname in the From field needs to match this IP-address. If this is good or bad is, of course, debatable. And it is probably beyond the powers of the original poster to change that.

So, unles I totally misunderstood the situation, I would indeed go with my sugestion.

Hmm, you may also be able to write a shell script that is called, either from rc.local or after dhcpcd has completed. This shell script could then do a name lookup for the machines IP-address and adjust "myhostname" in /etc/postfix/main.cf and restart postfix. I wonder if postfix can do this by itself ...

Offline

Board footer

Powered by FluxBB