* $HOST on OS X
[not found] <A31BDCF6-D2C6-4674-B4D5-86B60347A0B2@chemistry.ucsc.edu>
@ 2010-06-05 14:24 ` William G. Scott
2010-06-05 15:37 ` Benjamin R. Haskell
0 siblings, 1 reply; 7+ messages in thread
From: William G. Scott @ 2010-06-05 14:24 UTC (permalink / raw)
To: zsh-users
Dear citizens:
I just noticed odd behavior for how $HOST is getting set on OS X v. 10.6.3.
One one home machine connected to a wireless router and ADSL modem:
% print $HOST
internalcheck.apple.com
On another -- This one worries me more:
% print $HOST
e3191.c.akamaiedge.net
The manual says $HOST is automatically set by the shell, but I wonder how this is happening? I don't have anything weird in /etc/hosts for example...
Thanks in advance for any advice.
Bill
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: $HOST on OS X
2010-06-05 14:24 ` $HOST on OS X William G. Scott
@ 2010-06-05 15:37 ` Benjamin R. Haskell
2010-06-05 15:45 ` Benjamin R. Haskell
0 siblings, 1 reply; 7+ messages in thread
From: Benjamin R. Haskell @ 2010-06-05 15:37 UTC (permalink / raw)
To: William G. Scott; +Cc: zsh-users
On Sat, 5 Jun 2010, William G. Scott wrote:
> Dear citizens:
>
> I just noticed odd behavior for how $HOST is getting set on OS X v.
> 10.6.3.
>
> One one home machine connected to a wireless router and ADSL modem:
>
> % print $HOST
> internalcheck.apple.com
>
> On another -- This one worries me more:
>
> % print $HOST
> e3191.c.akamaiedge.net
>
> The manual says $HOST is automatically set by the shell, but I wonder
> how this is happening? I don't have anything weird in /etc/hosts for
> example...
$HOST is set by the following lines in Src/params.c:
682 hostnam = (char *)zalloc(256);
683 gethostname(hostnam, 256);
684 setsparam("HOST", ztrdup(hostnam));
If gethostname is defined in unistd.h, it's a standard library call that
fills its char* first parameter with your hostname. Otherwise, there's
a compatibility replacement in Src/compat.c that basically gets the node
name via uname. Omitting error-checking, it's:
int gethostname(char*name, size_t namelen) {
struct utsname uts;
uname(&uts);
strcpy(name,uts.nodename);
}
So, either way, it follows a pretty standard path to getting a hostname.
I'm not sure whether OS X would have gethostname, but what does `uname
-n` return? Or `hostname`?
--
Best,
Ben
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: $HOST on OS X
2010-06-05 15:37 ` Benjamin R. Haskell
@ 2010-06-05 15:45 ` Benjamin R. Haskell
2010-06-05 16:55 ` François Revol
0 siblings, 1 reply; 7+ messages in thread
From: Benjamin R. Haskell @ 2010-06-05 15:45 UTC (permalink / raw)
To: William G. Scott; +Cc: zsh-users
On Sat, 5 Jun 2010, Benjamin R. Haskell wrote:
> On Sat, 5 Jun 2010, William G. Scott wrote:
>
> > Dear citizens:
> >
> > I just noticed odd behavior for how $HOST is getting set on OS X v.
> > 10.6.3.
> >
> > One one home machine connected to a wireless router and ADSL modem:
> >
> > % print $HOST
> > internalcheck.apple.com
> >
> > On another -- This one worries me more:
> >
> > % print $HOST
> > e3191.c.akamaiedge.net
> >
> > The manual says $HOST is automatically set by the shell, but I wonder
> > how this is happening? I don't have anything weird in /etc/hosts for
> > example...
>
> $HOST is set by the following lines in Src/params.c:
>
> 682 hostnam = (char *)zalloc(256);
> 683 gethostname(hostnam, 256);
> 684 setsparam("HOST", ztrdup(hostnam));
>
> If gethostname is defined in unistd.h, it's a standard library call that
> fills its char* first parameter with your hostname. Otherwise, there's
> a compatibility replacement in Src/compat.c that basically gets the node
> name via uname. Omitting error-checking, it's:
>
> int gethostname(char*name, size_t namelen) {
> struct utsname uts;
> uname(&uts);
> strcpy(name,uts.nodename);
> }
>
> So, either way, it follows a pretty standard path to getting a hostname.
>
> I'm not sure whether OS X would have gethostname, but what does `uname
> -n` return? Or `hostname`?
I also neglected to mention that $HOST can be inherited from the
environment.
e.g.:
$ HOST=whatever zsh -c 'echo $HOST'
whatever
$
So, maybe there was some script you/someone ran that set
HOST=e3191.c.akamaiedge.net, for convenience. (For uploading things to
Akamai's CDN, maybe? Seems a bit of a stretch.)
--
Best,
Ben
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: $HOST on OS X
2010-06-05 15:45 ` Benjamin R. Haskell
@ 2010-06-05 16:55 ` François Revol
2010-06-05 18:52 ` Benjamin R. Haskell
0 siblings, 1 reply; 7+ messages in thread
From: François Revol @ 2010-06-05 16:55 UTC (permalink / raw)
To: zsh-users
Le 5 juin 2010 à 17:45, Benjamin R. Haskell a écrit :
> So, maybe there was some script you/someone ran that set
> HOST=e3191.c.akamaiedge.net, for convenience. (For uploading things to
> Akamai's CDN, maybe? Seems a bit of a stretch.)
No it's only a bad habit of OSX to update hostname depending on the joined network, I often noticed this when using wifi or an unusual LAN. So when you open a Terminal at that point it shows this in the prompt and other stuff...
IMO it's a security risk though...
François.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: $HOST on OS X
2010-06-05 16:55 ` François Revol
@ 2010-06-05 18:52 ` Benjamin R. Haskell
2010-06-05 19:46 ` François Revol
2010-06-06 15:34 ` Vincent Lefevre
0 siblings, 2 replies; 7+ messages in thread
From: Benjamin R. Haskell @ 2010-06-05 18:52 UTC (permalink / raw)
To: François Revol; +Cc: zsh-users
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1474 bytes --]
On Sat, 5 Jun 2010, François Revol wrote:
> Le 5 juin 2010 à 17:45, Benjamin R. Haskell a écrit :
>
> > So, maybe there was some script you/someone ran that set
> > HOST=e3191.c.akamaiedge.net, for convenience. (For uploading things
> > to Akamai's CDN, maybe? Seems a bit of a stretch.)
>
> No it's only a bad habit of OSX to update hostname depending on the
> joined network, I often noticed this when using wifi or an unusual
> LAN. So when you open a Terminal at that point it shows this in the
> prompt and other stuff...
If that's the case, I might expect a hostname like
pool-68-162-167-80.pitt.east.verizon.net (something from a DHCP pool
assigned by an ISP). Not something on akamaiedge.net, which is
certainly not an ISP. Unless someone's playing weird games with routing
via Amazon-EC2. (More likely, that one in particular seems like some
upstream DNS misconfiguration, akin to the bad PTR record for an RFC
1918 address in this post[1].)
Regardless, OS X is far from the only O/S that'll update hostnames when
you join a network. And especially on a laptop, it often makes sense.
For instance, after associating with a university's wireless network,
your host probably has a different name assigned to it. Why would it be
bad to update it?
> IMO it's a security risk though...
What part, and how so?
--
Best,
Ben
[1] http://www.techsupportforum.com/networking-forum/networking-support/407794-strange-hostname-private-ip.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: $HOST on OS X
2010-06-05 18:52 ` Benjamin R. Haskell
@ 2010-06-05 19:46 ` François Revol
2010-06-06 15:34 ` Vincent Lefevre
1 sibling, 0 replies; 7+ messages in thread
From: François Revol @ 2010-06-05 19:46 UTC (permalink / raw)
To: zsh-users
Le 5 juin 2010 à 20:52, Benjamin R. Haskell a écrit :
> Regardless, OS X is far from the only O/S that'll update hostnames when
> you join a network. And especially on a laptop, it often makes sense.
> For instance, after associating with a university's wireless network,
> your host probably has a different name assigned to it. Why would it be
> bad to update it?
Right, makes some sense.
>> IMO it's a security risk though...
>
> What part, and how so?
Dunno, didn't think much about it, but I suppose it could be a problem when inadvertently joining a network you didn't want to.
In any case it should be possible to disable it, but I've yet to find the setting on OSX.
François.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: $HOST on OS X
2010-06-05 18:52 ` Benjamin R. Haskell
2010-06-05 19:46 ` François Revol
@ 2010-06-06 15:34 ` Vincent Lefevre
1 sibling, 0 replies; 7+ messages in thread
From: Vincent Lefevre @ 2010-06-06 15:34 UTC (permalink / raw)
To: zsh-users
On 2010-06-05 14:52:33 -0400, Benjamin R. Haskell wrote:
> Regardless, OS X is far from the only O/S that'll update hostnames when
> you join a network. And especially on a laptop, it often makes sense.
Changing the host may confuse software that expects it not to change,
may break user configuration (for instance, I use the same config
files on various machines, and test the FQDN when a difference is
needed), and so on.
> For instance, after associating with a university's wireless network,
> your host probably has a different name assigned to it. Why would it be
> bad to update it?
There's a host name associated with the IP address, but this doesn't
mean that it should be the same as $HOST. Otherwise what would you do
if you wanted to connect to 2 networks (wireless or not) at the same
time?
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-06-06 15:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <A31BDCF6-D2C6-4674-B4D5-86B60347A0B2@chemistry.ucsc.edu>
2010-06-05 14:24 ` $HOST on OS X William G. Scott
2010-06-05 15:37 ` Benjamin R. Haskell
2010-06-05 15:45 ` Benjamin R. Haskell
2010-06-05 16:55 ` François Revol
2010-06-05 18:52 ` Benjamin R. Haskell
2010-06-05 19:46 ` François Revol
2010-06-06 15:34 ` Vincent Lefevre
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).