Re: [nodejs] Re: full hostname

2012-06-09 Thread Ryan Schmidt
On Jun 9, 2012, at 13:35, Ben Noordhuis wrote: > Slightly OT, but it's not always a good idea to trust the value of the > Host header. It's a frequent source of 'confused deputy'-style > attacks. In a world where there are not enough available IPv4 addresses for every web site to have its own,

Re: [nodejs] Re: full hostname

2012-06-09 Thread Axel Kittenberger
> The simplest option is to usually set the expected host name in a > config file or something that your app loads And is usual a good option. I know of "solutions" that take the hostname resolve this forward into an IP and make a reverse-DNS lookup on that to get a full qualified name. I say as s

Re: [nodejs] Re: full hostname

2012-06-09 Thread Ben Noordhuis
On Sat, Jun 9, 2012 at 8:18 PM, Isaac Schlueter wrote: > The simplest option is to usually set the expected host name in a > config file or something that your app loads, or just look at > req.headers.host. Slightly OT, but it's not always a good idea to trust the value of the Host header. It's a

Re: [nodejs] Re: full hostname

2012-06-09 Thread Isaac Schlueter
The simplest option is to usually set the expected host name in a config file or something that your app loads, or just look at req.headers.host. I mean, at *some* point you know what it is, right? Just put that in a file or environment variable (or for very fancy cases, like a host-header routin

Re: [nodejs] Re: full hostname

2012-06-08 Thread Ben Noordhuis
On Fri, Jun 8, 2012 at 6:41 PM, Thomas Shinnick wrote: > Of course, not proof against badly configured machines. > > "hostname --fqdn" on "server setup by somebody else" bjsapps17 gives me the > 'long' answer, 'bjsapps17'   :-/ > > "host bjsapps17"  gives me "bjsapps17.example.com has address 10.3

[nodejs] Re: full hostname

2012-06-08 Thread Thomas Shinnick
Of course, not proof against badly configured machines. "hostname --fqdn" on "server setup by somebody else" bjsapps17 gives me the 'long' answer, 'bjsapps17' :-/ "host bjsapps17" gives me "bjsapps17.example.com has address 10.39.37.251". Maybe try multiple techniques and choose the longes

[nodejs] Re: full hostname

2012-06-08 Thread Chris Dew
var hostname = "unknown host"; spawn2('hostname', ['--fqdn'], function(err, stdout, stderr) { hostname = stdout; }); /* * This function augments the spawn function with: * 1. extra logging * 2. a timeout to kill the whole process, if a child does not return * 3. an optional callback to be e

[nodejs] Re: full hostname

2012-06-08 Thread Chris Dew
I'd like to know too. Thanks, Chris. On Friday, 25 February 2011 09:32:49 UTC, rolfn wrote: > > With > > os.hostname() > > I can ask for the name of my host. But how can I get the full > qualified hostname? > > Thanks in advance, > > Rolf > -- Job Board: http://jobs.nodejs.org/ Posting