Remote IP to script over inetd

Radek Krejča radek.krejca at starnet.cz
Mon Mar 25 11:09:28 UTC 2013


Hello,

I need to get remote ip of client who is runnig script over inetd. A
found that on linux is possible to use environment variable REMOTEHOST.
But if I try it on FreeBSD it doesnt work well. There is stored
something host but not actual. I thing that this variable is taken from
root environment and not show actual ip of client connected over port
serviced by inetd .

So question is - how I can get client ip addres to my script serviced by
inetd?

I am starting inetd only with inetd_enable in rc.conf, no other
attribues, so inetd i running:

/usr/sbin/inetd -wW -C 60

Its freebsd 9.1 amd64 and script looks like:

#!/bin/sh
echo $REMOTEHOST

I runs it on port 9000 serviced by inetd and started in inetd.conf

redirect       stream  tcp     nowait  root    /root/redirects.sh
redirects.sh

Thank you
Radek


More information about the freebsd-questions mailing list