klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Thu Sep 12, 2002 1:05 am Post subject: httptunnel init script |
|
|
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. 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 |
|