On Tue, 18 Sep 2001 09:55:06 PDT, "Jeremy C. Reed" writes: >On Tue, 18 Sep 2001, Marcel Hicking wrote: > >> I have a script invoked via inetd. >> How can I let the script know of the IP of the client >> connecting (remote IP)? >> I need to do some additional security checks not >> possible with hosts.access|deny >> >> Any hints? > >getpeername(2) is the C library function to get the remote IP. This works >for me: > <snip> > >Then compile it with "gcc -o getpeername getpeername.c". Then use the >getpeername executable in your script. Hmm, this doesn´t work for me. If I invoke it via inetd.conf: sunrpc stream tcp nowait nobody /usr/local/bin/test.sh test.sh test.sh: #!/bin/bash /usr/local/bin/getpeername >>/tmp/peer.ip exit only a \n is logged to the file (so permissions et al are ok ;-) ). However, if I do inetd.conf: sunrpc stream tcp nowait nobody /usr/local/bin/getpeername getpeername waldner@st:~$ telnet ka 111 Trying 4.3.2.1... Connected to ka. Escape character is '^]'. 1.2.3.4Connection closed by foreign host. (IPs obfuscated) What am I doing wrong? cheers+tia, &rw -- / Ing. Robert Waldner | <r.waldner@xsoft.at> \ \ Xsoft GmbH | T: +43 1 796 36 36 692 /
Attachment:
pgpVItuNiwX5H.pgp
Description: PGP signature