0

I need to be able to run a socks4 server (the best through ssh -D) I can't put together a config file for xinetd, can anyone give me a hand? Thanks!

1 Answer 1

1

It's pretty straighforward. Try this. If you have problems with privilege separation, you'll need to create a little script to make /var/run/sshd, and chmod 0755 it, then call ssh $*.

service ssh
{
   socket_type = stream
   protocol = tcp
   wait = no
   user = root
   server = /usr/sbin/sshd
   server_args = -i
   port = 22

}

EDIT. The first time around I completely misread the question, and assumed you just wanted sshd running in xinetd on the remote side of your tunnel, so it would just wake up when you needed your tunnel. Instead, what you're really looking for is a way to have the ssh client wake up when you need the proxy tunnel and automatically bring up the tunnel for use.

service socks-proxy
{
    disable         = no
    socket_type     = stream
    wait            = no
    user            = root
    server          = /usr/bin/ssh
    server_args     = -D 1234 -i /path/to/ssh-key -f remoteuser@remotehost 
    log_on_failure  += USERID
}

Then add the service-name 'socks-proxy' to /etc/services. Or change the service name to match an existing service from /etc/inetd with the port you'll be using. You'll need the ssh key to allow for paswordless authentication. The -f should fork the ssh to the background. You may have to tune the args a bit, but something like this should work.

3
  • I dont get it... how is this suppose to work? you didn't even specify -D
    – alexus
    Feb 15, 2011 at 20:03
  • Sorry, Alexus. Edited the answer. I think I'm understanding what you're really trying to do, now. Feb 15, 2011 at 21:45
  • Apr 18 13:15:52 wcmisdlin02 xinetd[22019]: START: socks pid=22021 from=::ffff:127.0.0.1 Apr 18 13:15:52 wcmisdlin02 xinetd[22019]: EXIT: socks status=255 pid=22021 duration=0(sec)
    – alexus
    Apr 18, 2012 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.