1 #!/bin/sh 2 # 3 # Copyright (c) 2006-2009 by Karl J. Runge <runge (at] karlrunge.com> 4 # 5 # ssvnc: 6 # 7 # A wrapper for ssvnc_cmd using a tcl/tk gui. 8 # 9 # See ssvnc_cmd for details. 10 # 11 if [ "X$1" = "X-help" -o "X$1" = "X-h" ]; then 12 cat << END 13 ssvnc - a GUI wrapper for SSL and SSH VNC connections. 14 15 SYNOPSIS 16 ssvnc 17 ssvnc [host][:display] 18 ssvnc [saved-profile-name] 19 ssvnc [options] [host-or-profile] 20 ssvnc -cmd [ssvnc_cmd-args] 21 ssvnc --help 22 23 DESCRIPTION 24 ssvnc is a tcl/tk gui wrapper that runs on Unix, MacOSX, and Windows. 25 It sets up an SSL or SSH tunnel to the remote VNC Server and then 26 launches the VNC viewer (either the one provided or another one that 27 you have specified) to use that encrypted tunnel to connect to the VNC 28 Server. The use of Proxies and Gateways to make the connections is 29 implemented. 30 31 OPTIONS 32 -help, -h Print this help. 33 34 --help Starts up the GUI as though the 'Help' button was pressed to 35 show the main Help panel. 36 37 -cmd [ssvnc_cmd-args] 38 Launch the ssvnc_cmd utility command directly (no GUI) with the 39 given arguments (for use when ssvnc_cmd is not in one's PATH.) 40 If neither ssvnc_cmd nor ssvncviewer is in PATH, one can launch 41 the viewer directly via: ssvnc -cmd -viewer [viewer-args] 42 43 -profiles 44 List the saved SSVNC profiles you have created. A profile is a 45 destination host with specific parameter settings. 46 47 -list Same as -profiles 48 49 -ssh Start in "SSH Only Mode". No SSL aspects are shown. Same as 50 running the command sshvnc 51 52 -ts Start in "Terminal Services Mode". This is like "SSH Only 53 Mode", but simpler and assumes x11vnc is available on the remote 54 side to start and manage X and VNC sessions. Same as running 55 the command tsvnc 56 57 -tso Same as -ts "Terminal Services Mode", however never let the user 58 leave this mode (no button to switch modes is provided.) Same 59 as SSVNC_TS_ALWAYS=1. 60 61 -ssl Force the full GUI Mode: both SSL and SSH. This is the default. 62 Same as -ss. 63 64 -nv Toggle the "Verify All Certs" button to be off at startup. 65 66 -nvb Never show the "Verify All Certs" button. Same as SSVNC_NO_VER- 67 IFY_ALL_BUTTON=1. 68 69 -bigger 70 Make the Profile Selection Dialog window bigger. Same as 71 SSVNC_BIGGER_DIALOG=1. 72 73 -noenc Start off in a mode where a 'No Encryption' check button is 74 present. You can toggle the mode with Ctrl-E. Same as 75 SSVNC_DISABLE_ENCRYPTION_BUTTON=1. Or noenc=1 in ~/.ssvncrc. 76 Selecting no encryption is the same as the vnc:// and Vnc:// 77 prefixes described below. The -noenc mode is now the default, 78 use -enc or noenc=0 for the opposite behavior. 79 80 -killstunnel 81 On Windows, automatically terminate the STUNNEL process when the 82 viewer exits instead of prompting you (same as killstunnel=1 in 83 ssvnc_rc or toggle in Options menu) 84 85 -nokillstunnel 86 On Windows, disable -killstunnel mode. Same as killstunnel=0 in 87 ssvnc_rc or toggle in Options menu. Note that -killstunnel mode 88 is now the default. 89 90 -mycert /path/to/mycert.pem 91 Set the default "MyCert" to be /path/to/mycert.pem. Same as 92 -cert. If the file does not exist, ~/.vnc/certs is prefixed and 93 tried. You can also set mycert=/path/to/mycert.pem in ~/.ssvncrc 94 95 -cacert /path/to/cacert.crt 96 Set the default "ServerCert" to be /path/to/cacert.crt. Same as 97 -ca. If the file does not exist, ~/.vnc/certs is prefixed and 98 tried. You can also set cacert=/path/to/cacert.crt in ~/.ssvncrc 99 100 -crl /path/to/mycrl.pem 101 Set the default Certificate Revocation List to be 102 /path/to/mycrl.pem. If the file does not exist, ~/.vnc/certs is 103 prefixed and tried. You can also set crl=/path/to/mycrl.pem in 104 ~/.ssvncrc. 105 END 106 exit 0 107 fi 108 if [ "X$1" = "X-ssh" ]; then 109 if [ "X$2" = "X-help" -o "X$2" = "X-h" ]; then 110 cat << END 111 sshvnc - a GUI wrapper for SSH VNC connections. 112 113 SYNOPSIS 114 sshvnc 115 sshvnc [host][:display] 116 sshvnc [saved-profile-name] 117 sshvnc [options] [host-or-profile] 118 sshvnc --help 119 120 See 'ssvnc $2' and 'ssvnc --help' for more information. 121 END 122 exit 0 123 fi 124 fi 125 126 if [ "X$1" = "X-ts" -o "X$1" = "X-tso" ]; then 127 if [ "X$2" = "X-help" -o "X$2" = "X-h" ]; then 128 cat << END 129 tsvnc - a GUI wrapper for SSH VNC connections using x11vnc Terminal Services. 130 131 SYNOPSIS 132 tsvnc 133 tsvnc [host][:display] 134 tsvnc [saved-profile-name] 135 tsvnc [options] [host-or-profile] 136 tsvnc --help 137 138 See 'ssvnc $2' and 'tsvnc --help' for more information. 139 END 140 exit 0 141 fi 142 fi 143 144 145 if [ "X$XTERM_PRINT" != "X" ]; then 146 XTERM_PRINT="" 147 cat > /dev/null 148 fi 149 if [ "X$1" = "X-bg" ]; then 150 shift 151 $0 "$@" & 152 exit 0 153 fi 154 155 156 PATH=$PATH:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin:/usr/sfw/bin:/usr/local/bin 157 export PATH 158 159 if [ "X$FULLNAME" = "XKarl J. Runge" ]; then 160 if [ "X$NOPOPUFIX" = "X" ]; then 161 VNCVIEWER_POPUP_FIX=1 162 export VNCVIEWER_POPUP_FIX 163 fi 164 PATH=`echo "$PATH" | sed -e 's,runge/bin/override,-------------,'` 165 fi 166 167 if [ "X$WISH" = "X" ]; then 168 WISH=wish 169 for try in wish8.4 wish wish8.3 wish8.5 wish8.6 170 do 171 if type $try > /dev/null 2>&1; then 172 WISH=$try 173 break 174 fi 175 done 176 export WISH 177 fi 178 179 180 SSVNC_GUI_CMD="$0 $*" 181 export SSVNC_GUI_CMD 182 SSVNC_LAUNCH=$SSVNC_GUI_CMD 183 export SSVNC_LAUNCH 184 185 # work out os.arch platform string and check for binaries: 186 # 187 name=$UNAME 188 if [ "X$name" = "X" ]; then 189 name=`uname -sm | sed -e 's/ /./g' -e 's,/.*,,' -e 's/Linux\.i.86/Linux.i686/'` 190 fi 191 192 dL="-L" 193 if uname -sr | egrep 'SunOS 5\.[5-8]' > /dev/null; then 194 dL="-h" 195 fi 196 197 f="$0" 198 for t in 1 2 3 4 5 199 do 200 if [ $dL "$f" ]; then 201 f0="$f" 202 f=`ls -l "$f" | sed -e 's/^.* -> //'` 203 if echo "$f" | grep '^/' > /dev/null; then 204 : 205 else 206 f="`dirname "$f0"`/$f" 207 fi 208 else 209 break 210 fi 211 done 212 dir=`dirname "$f"` 213 PATH="$dir:$PATH" 214 215 nearby=0 216 if [ -x "$dir/vncviewer" -a -x "$dir/stunnel" ]; then 217 nearby=1 218 fi 219 if [ "X$name" = "X." ]; then 220 : 221 #type vncviewer 222 #type stunnel 223 elif [ ! -d "$dir/$name" -a $nearby = 0 ]; then 224 echo 225 echo "Cannot find platform dir for your OS `uname -sm`:" 226 echo 227 echo " $dir/$name" 228 echo 229 PATH=$PATH:/usr/sbin:/usr/local/sbin:/dist/sbin 230 231 quit=0 232 if type vncviewer >/dev/null 2>/dev/null; then 233 : 234 else 235 echo "vncviewer not found in PATH." 236 quit=1 237 fi 238 if type stunnel >/dev/null 2>/dev/null; then 239 : 240 else 241 echo "stunnel not found in PATH." 242 quit=1 243 fi 244 echo 245 if [ "X$quit" = "X1" ]; then 246 echo "You can set the \$UNAME env. var. to override the OS setting." 247 echo "Or, if available, run the ./build.unix script to build it." 248 echo "Or install external \"vncviewer\" and \"stunnel\" packages." 249 exit 1 250 fi 251 echo "Using externel \"vncviewer\" and \"stunnel\" found in PATH." 252 else 253 STUNNEL=stunnel 254 #STUNNEL_EXTRA_OPTS=${STUNNEL_EXTRA_OPTS:-"maxconn = 1"} 255 #export STUNNEL STUNNEL_EXTRA_OPTS 256 SSVNC_VIEWER_INTERNAL=1 257 export SSVNC_VIEWER_INTERNAL 258 fi 259 260 261 # Put our os.arch and other utils dirs at head of PATH to be sure to 262 # pick them up: 263 # 264 PATH="$dir:$dir/$name:$dir/util:$PATH" 265 if echo "$dir" | grep '^/' > /dev/null; then 266 : 267 else 268 dir=`pwd`/$dir 269 PATH="$dir:$dir/$name:$dir/util:$PATH" 270 fi 271 272 SSVNC_BASEDIR="$dir" 273 export SSVNC_BASEDIR 274 SSVNC_BASEDIRNAME="$dir/$name" 275 export SSVNC_BASEDIRNAME 276 277 if [ -f "$dir/util/ultraftp.jar" ]; then 278 SSVNC_ULTRA_FTP_JAR="$dir/util/ultraftp.jar" 279 export SSVNC_ULTRA_FTP_JAR 280 fi 281 282 if [ "X$1" = "X-cmd" -o "X$1" = "X--cmd" ]; then 283 shift 284 exec ssvnc_cmd "$@" 285 elif [ "X$WISH" = "Xwish" ]; then 286 exec ssvnc.tcl "$@" 287 else 288 exec $WISH $dir/util/ssvnc.tcl "$@" 289 fi 290