in reply to Re: Run only if it the request is originating from a specific machine
in thread Run only if it the request is originating from a specific machine

Thanks everyone. Some more clarity on this...
It is not cgi. I will be executing the remote code using ssh for example : ssh oracle@dbhost1 "/opt/oracle/runroot.pl"
within runroot.pl I want to make sure that the request is originating from an authorized machine.
agreed that authorization etc is handled in a different way.
I tried to use getpeername. however it is not returning anything. looks like I have to open a socket first and sort of listen on the other end then I would be able to get the getperrname(SOCK)?
I guess ssh creates some sort of a socket right? Do I have to create explicit socket to find out the host on the other side? It is complicating things :(
At the peril of sounding foolish, can I just harness the socket created by ssh connection instead? Is it possible?
thanks a lot
  • Comment on Re^2: Run only if it the request is originating from a specific machine
  • Download Code

Replies are listed 'Best First'.
Re^3: Run only if it the request is originating from a specific machine
by ikegami (Patriarch) on Aug 25, 2011 at 19:30 UTC

    Request implies a server, and if it comes from another machine, it implies a socket. That's why I mentioned it.

    In fact, there is a socket involved, but it's not connected to STDOUT according to a test.

    $ ssh localhost 'perl -E'\''say getpeername(\*STDOUT) || die $!'\''' Socket operation on non-socket at -e line 1.

    Sorry, I don't know the solution to your problem.

      Thanks anyway for trying it...
      I am still on it, no light yet at the end of the tunnel yet... can't give up :(
      so will continue my work