2 # this script makes a tunnel for SMTP traffic and others. a remote ssh server
3 # is required. this is especially useful for routing around firewalls using
4 # a web proxy like squid. when used for SMTP, it ensures that none of the
5 # text is seen on whatever network one is on before it's sent from the remote
8 #hmmm: none of the user info below will work for others: parameterize it.
10 #hmmm: maybe we need a base function that takes all the disparate values,
11 # and this script could call it with known feisty meow settings.
15 # these variables are configurable from plug-ins.
17 soundfile=$FEISTY_MEOW_DIR/database/sounds/woouoo.wav
18 if [ ! -z "$1" ]; then
24 # provides a list of properly formatted tunnels for ssh to create. if this list
25 # is empty, then we do nothing.
28 # set this to the hostname that will be providing the tunnel. this is
29 # usually a remote system.
32 # set this to your key file, plus the -i flag, such as:
33 # SECURITY_KEY="-i $HOME/.ssh/id_rsa"
38 #hmmm:move to fred configs!
39 TUNNEL_LIST+=(-L 14008:localhost:25)
40 USER_PLUS_HOST="fred@serene.feistymeow.org"
41 SECURITY_KEY="-i $HOME/.ssh/id_dsa_fred"
45 # how often to play sounds when reconnecting.
48 # when we last played a sound.
51 play_sound_periodically()
53 CURRENT_TIME=$(date +"%s")
54 if (( $CURRENT_TIME - $LAST_SOUND_TIME >= $NOISE_PERIOD )); then
55 echo playing sound now.
56 bash $FEISTY_MEOW_SCRIPTS/multimedia/sound_play.sh $soundfile &>/dev/null </dev/null &
57 #hmmm: parameterize this for the sound to be played. doofus.
58 LAST_SOUND_TIME=$CURRENT_TIME
65 echo Connecting sendmail to serenely zooty.
66 ssh -2 -N -v ${TUNNEL_LIST[*]} "$USER_PLUS_HOST"
67 echo "Got dumped from tunnels; re-establishing connection."
68 play_sound_periodically
69 echo "Note: if you're being asked for a password, you haven't set up an RSA key yet."
73 #-L 8028:localhost:3128
75 #-L 8043:localhost:443
77 # ports sometimes used:
78 # 25 is the sendmail tunnel.
79 # 3128 is the squid proxy server.
80 # 443 is the https version of squid.
82 # ssh flags in use sometimes:
83 # -f go into the background once connected.
84 # -2 enforce ssh version 2.
85 # -N don't execute any command; just forward data between the ports.
86 # -L (port:host:hostport) connect the local machine's "port" to the
87 # remote port "hostport" on the "host" specified. the local "port"
88 # becomes an alias for the remote port. note that the connection
89 # being made to host and hostport is from the perspective of the ssh
90 # server, not the local host.