Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Setting up tunnels
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
pmatos
Veteran
Veteran


Joined: 06 Jun 2003
Posts: 1246
Location: Eckental, Germany

PostPosted: Thu Jun 21, 2007 8:11 am    Post subject: Setting up tunnels Reply with quote

Hi all,

I'd like to have a couple of ssh tunnels set up in my PC all the time. Is there any app to manage tunnels, start them when computer boots and keep them up (in case they go down for some reason)?

Cheers,

Paulo Matos
Back to top
View user's profile Send private message
di1bert
l33t
l33t


Joined: 16 May 2002
Posts: 963
Location: Oslo, Norway

PostPosted: Thu Jun 21, 2007 8:28 am    Post subject: Reply with quote

I've not come across anything like this, not for OpenSSH tunnels anyway. You could get clever and
write a little bash script to take care of starting the tunnels and just put it in /etc/conf.d/local.start

Here's a "template" file I use for my bash scripts....
Code:

#!/bin/bash

PIDFILE="/var/run/fork.pid"

function main {

        # print the pid of the forked daemon
        echo "forking to background ($[ $$ +1 ])"
        touch $PIDFILE
        echo $[ $$ +1 ] > $PIDFILE

        running="yes"
        while [ $running == "yes" ]; do

                echo Sample Code Here

        done

}

ARGV="$1"

# print program usage if no command line arguements are supplied
function usage {
        echo "Please run with "-d" to start the service in daemon mode"
        exit 0
}

# Check what was passed as an arguement and act accordingly
if [ "$ARGV" == "" ]; then
        usage
fi

if [ "$ARGV" == "-d" ]; then
        main &
fi


Hope this helps...

-m
Back to top
View user's profile Send private message
pmatos
Veteran
Veteran


Joined: 06 Jun 2003
Posts: 1246
Location: Eckental, Germany

PostPosted: Thu Jun 21, 2007 8:32 am    Post subject: Reply with quote

di1bert wrote:
I've not come across anything like this, not for OpenSSH tunnels anyway. You could get clever and
write a little bash script to take care of starting the tunnels and just put it in /etc/conf.d/local.start

Here's a "template" file I use for my bash scripts....
Code:

#!/bin/bash

PIDFILE="/var/run/fork.pid"

function main {

        # print the pid of the forked daemon
        echo "forking to background ($[ $$ +1 ])"
        touch $PIDFILE
        echo $[ $$ +1 ] > $PIDFILE

        running="yes"
        while [ $running == "yes" ]; do

                echo Sample Code Here

        done

}

ARGV="$1"

# print program usage if no command line arguements are supplied
function usage {
        echo "Please run with "-d" to start the service in daemon mode"
        exit 0
}

# Check what was passed as an arguement and act accordingly
if [ "$ARGV" == "" ]; then
        usage
fi

if [ "$ARGV" == "-d" ]; then
        main &
fi


Hope this helps...

-m


Thank you very much. In the meantime I also found autossh so joining your solution with autossh might be great! :D
Back to top
View user's profile Send private message
di1bert
l33t
l33t


Joined: 16 May 2002
Posts: 963
Location: Oslo, Norway

PostPosted: Thu Jun 21, 2007 8:35 am    Post subject: Reply with quote

Glad to help..I'd be interested to see the end result.

I think I tried autossh before and I'm not sure how well it worked....

Anyhoo...good luck :D

-m
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum