[CentOS] xinetd custom service - perl - remote address

Thu May 28 15:55:50 UTC 2020
Jonathan Billings <billings at negate.org>

On Thu, May 28, 2020 at 04:46:34PM +0100, Gary Stainburn wrote:
>
> Hi all,
> 
> I can't believe that I can't find the answer to this one.  I have a
> perl script which is called by xinetd. 
> 
> I want that perl script to be able to detect the remote IP address
> of the caller. 
> 
> I presumed that it would be an environment variable but I could be
> wrong.  I've found reference to the ENV and PASSENV arguments for
> xinetd.conf but no examples, and no indication of what auguments to
> use. 
> 
> In my script I have the following code:
> 
> foreach (keys %ENV) { print "$_=$ENV{$_}\n";}
> 
> 
> but the only line I get back is:
> 
> XINETD_LANG=en_US

I don't believe that xinetd tells the underlying processes anything
about IPs, since xinetd handles the network connection and as far as
the process is concerned, it's just filehandles.  

-- 
Jonathan Billings <billings at negate.org>