Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
httptunnel init script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
klieber
Bodhisattva
Bodhisattva


Joined: 17 Apr 2002
Posts: 3657
Location: San Francisco, CA

PostPosted: Thu Sep 12, 2002 1:05 am    Post subject: httptunnel init script Reply with quote

For those of you who are behind a restrictive firewall (at work, etc.), httptunnel is a way of poking a hole through that firewall to run TCP-based apps like ssh, telnet, etc. httptunnel, as the name suggests, takes the application commands and tunnels them through normal HTTP get/post commands. If you can view web sites at work, you can probably use httptunnel.

Anyway, I wrote a very, very simple init script for the server-side part httptunnel to ensure my server will always create a tunnel on boot. Yes, it would have been easier to simply write a single line in /etc/conf.d/local.start. :P This is a bit easier to configure, however, and fits in more with the "Gentoo" way of doing things. Mostly, I just wanted to get more familiar with writing Gentoo-ized rc scripts. Enjoy.

/etc/conf.d/hts
Code:
# Config file for /etc/init.d/hts

# Server name (localhost, etc.)
SERVER_NAME="your.server.com"

# TCP port that we want to forward (this is what the client connects to)
TCP_FORWARD_PORT="80"

# TCP port that we want to forward to (this is what actually answers
# on the server)
# ex. 22 for ssh, 23 for telnet
TCP_LISTEN_PORT="22"

# Any extra miscellaneous options we want to pass to hts
# Make sure to include the - or -- before each option
HTS_OPTIONS=""


/etc/init.d/hts
Code:
#!/sbin/runscript
# Written by klieber (klieber@_DIESPAMMERDIE_gentoo.org)
# Distributed under the terms of the GNU General Public License, v2 or later

depend() {
        after net
}

start() {
        ebegin "Starting httptunnel server tunnel"
        hts ${HTS_OPTIONS} -p /var/run/hts.pid -F ${SERVER_NAME}:${TCP_LISTEN_PORT} ${TCP_FORWARD_PORT}
        eend $? "Failed to create httptunnel"
}

stop()  {
        ebegin "Stopping httptunnel server tunnel"
        kill $(cat /var/run/hts.pid)
        eend $? "Failed to stop httptunnel"
}


--kurt
_________________
The problem with political jokes is that they get elected
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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