Homegrown Remote Assistance

Back in 2004, we were looking for a cheap way of providing remote desktop support to our customers.

This would serve a few purposes:

  1. Reducing or eliminating trip charges to the customers.
  2. Providing instant support to our customers.
  3. Reducing the cost to my employer who was paying us mileage.

Using a ShuttleBox as a server, I set about installing FreeBSD and configuring vncserver to run in a sort of Terminal Services mode.

I used FVWM as the windows manager, since it is lightweight and simple to modify. Many projects use this for kiosks and the like because of it's ease of configuration.

I set up a fvwm2rc file that would be placed in /etc/skel/.fvwm2rc so that when each user account was set up, it would already be setup for use.

# this is a bare bones sample .fvwm2rc/system.fvwm2rc file for fvwm.
# It should be customized before install.  See other sample .fvwm2rc files
# for hints, as well as pointers from the various links on the official
# fvwm web page (see the FAQ).

EdgeResistance 250 10
EdgeScroll 0 0
ClickTime 750

DeskTopSize 1x1
Menustyle * fvwm, Font -adobe-times-bold-r-*-*-14-*-*-*-*-*-*-*
MenuStyle * Foreground blue, Background grey60, Greyed grey40

ColormapFocus FollowsMouse

Key Tab A M WindowList Root c c NoDeskSort

# default Styles:
# make sure these fonts exist on your system:
Style *           Font -adobe-times-bold-r-*-*-18-*-*-*-*-*-*-*
Style *           IconFont -adobe-times-bold-r-*-*-18-*-*-*-*-*-*-*
#Style *           HilightFore black, HilightBack palevioletred
Style *           HilightFore black, HilightBack firebrick
Style *           BorderWidth 7, HandleWidth 7
Style *           Icon unknown1.xpm, Color lightgrey/dimgrey
Style *           MWMFunctions, MWMDecor, HintOverride
Style *           DecorateTransient, NoPPosition
Style *           IconBox 0 -10 -280 -1
Style *           FocusFollowsMouse
Style *           TileCascadePlacement

# Styles for various Fvwm modules:
Style "Fvwm*"       NoTitle,  Sticky, WindowListSkip
Style "Fvwm*"       BorderWidth 2, CirculateSkipIcon, CirculateSkip
Style "FvwmPager"   StaysOnTop
Style "FvwmBanner"  StaysOnTop
Style "FvwmButtons" Icon toolbox.xpm, ClickToFocus

# Styles for your common terminal emulator programs:
Style "XTerm"       Icon xterm.xpm, SloppyFocus, IconBox -70 1 -1 -140
Style "rxvt"        Icon term.xpm, SloppyFocus, IconBox -70 1 -1 -140
Style "rxvt"        MWMBorder, MWMButtons

# Styles for various common programs:
Style "*lock"       NoTitle, NoHandles, Sticky, WindowListSkip, ClickToFocus
Style "xbiff"       NoTitle, Sticky, WindowListSkip, ClickToFocus
Style "xcalc"       Icon xcalc.xpm, NoButton 2,ClickToFocus
Style "xmh"         Icon mail1.xpm, NoIconTitle,StickyIcon
Style "xmh"        NoButton 2
Style "xman"        Icon xman.xpm, ClickToFocus
Style "xmag"        Icon mag_glass.xpm, ClickToFocus
Style "xgraph"      Icon graphs.xpm, ClickToFocus
Style "xmosaic"     Color Green/Yellow, ClickToFocus


# some simple default key bindings:
Key Next         A       SCM     Next (AcceptsFocus) Focus
Key Prior        A       SCM     Prev (AcceptsFocus) Focus

# some simple default mouse bindings:
#   for the root window:
Mouse 1    R       A       Menu RootMenu Nop
Mouse 2    R        A          Menu Window-Ops Nop
Mouse 3    R        A          WindowList

#   for the title bar buttons:
Mouse 0    1        A          Menu Window-Ops2 Close
Mouse 0    2        A         Maximize-Func
Mouse 0    4        A         Iconify

#   for other parts of the window/borders/icons:
Mouse 1    F    A    Resize-or-Raise
Mouse 1    TS    A    Move-or-Raise
Mouse 1    I    A    Move-or-Iconify
Mouse 2    I    A    Iconify
Mouse 2    FST    A    Menu Window-Ops2 Nop
Mouse 3    TSIF    A    RaiseLower

######################## Initialization Functions ############################
AddToFunc StartFunction
+ I Module FvwmButtons

AddToFunc InitFunction
# + I exec xseTroot -mod 2 2 -fg rgb:55/40/55 -bg rgb:70/50/70
+ I exec xv -root ~/myimage.tif -quit
+ I exec xterm -iconic -e vncviewer -listen

# For some SM-s (like gnome-session) there is an internal background setter.
AddToFunc SessionInitFunction
+ I Nop

######################## Menus ###################
AddToMenu RootMenu    "Virtual Technician"    Title
+            "XTerm"        Exec exec xterm -sb -bg black -fg white -rightbar
+                       "VNC Viewer"    Exec exec xterm -iconic -e vncviewer -listen
#+            "Rxvt"        Exec exec rxvt
#+            ""        Nop
#+            "Remote Logins"    Popup Remote-Logins
#+            ""        Nop
+                       "Utilities"     Popup Utilities
+            ""        Nop
#+            "Fvwm Modules"              Popup Module-Popup
#+                       "Fvwm Window Ops"         Popup Window-Ops
+                       "Fvwm Simple Config Ops"  Popup Misc-Ops
#+            ""        Nop
+                       "Refresh Screen"   Refresh
#+                       "Recapture Screen" Recapture
+            ""        Nop
+            "Exit Fvwm"    Popup Quit-Verify

AddToMenu Utilities     "Utilities" Title
+            "Top"        Exec exec xterm -T Top -n Top -e top
+            "Calculator"    Exec exec xcalc
+            "Xman"        Exec exec xman
+            "Xmag"        Exec exec xmag
+                       "Editres"       Exec exec editres
+            ""        Nop
+            "XEmacs"    Exec exec xemacs
+                       "Mail"          MailFunction xmh "-font fixed"
+            ""        Nop
+                       "XLock"         Exec exec xlock -mode random
+            ""        Nop
+                       "Reset X defaults" Exec xrdb -load $HOME/.Xdefaults

AddToMenu Misc-Ops "Misc Config Opts" Title
+                  "Sloppy Focus"        ChangeDefaultFocus SloppyFocus
+                  "Click To Focus"      ChangeDefaultFocus ClickToFocus
+                  "Focus Follows Mouse" ChangeDefaultFocus FocusFollowsMouse
+                  "" Nop
+                  "Colormap Follows Mouse" ColormapFocus FollowsMouse
+                  "Colormap Follows Focus" ColormapFocus FollowsFocus
+                  "" Nop
+                  "Full Paging ON"         EdgeScroll 100 100
+                  "All Paging OFF"         EdgeScroll 0 0
+                  "Horizontal Paging Only" EdgeScroll 100 0
+                  "Vertical Paging Only"   EdgeScroll 0 100
+                  "Partial Paging"         EdgeScroll 50 50
+                  "Full Paging && Edge Wrap" EdgeScroll 100000 100000

AddToMenu Window-Ops    "Window Ops"    Title
+            "Move"        Move
+            "Resize"    Resize
+            "Raise"        Raise
+            "Lower"        Lower
+             "(De)Iconify"    Iconify
+            "(Un)Stick"    Stick
+            "(Un)Maximize"    Maximize
+            ""        Nop
+            "Delete"    Delete
+            "Close"        Close
+            "Destroy"    Destroy
+            ""        Nop
+            "Refresh Window" RefreshWindow

AddToMenu Window-Ops2    "&Move"        Move
+            "&Resize"    Resize
+            "R&aise"    Raise
+            "&Lower"    Lower
+            "(De)&Iconify"    Iconify
+            "(Un)&Stick"    Stick
+                       "(Un)Ma&ximize" Maximize
+            ""        Nop
+            "&Delete"    Delete
+            "&Close"    Close
+            "Destroy"    Destroy
+            ""        Nop
+            "ScrollBar"     Module FvwmScroll 2 2
+            "Print"         PrintFunction
+                       "Print Reverse" PrintReverseFunction

# be sure to fill these in with your correct machine names:
AddToMenu Remote-Logins    "dopey"     Exec rsh dopey rxvt -display $HOSTDISPLAY &
+            "snoopy" Exec rsh snoopy rxvt -display $HOSTDISPLAY &
+            "grumpy" Exec rsh grumpy rxvt -display $HOSTDISPLAY &
+            "happy"     Exec rsh happy rxvt -display $HOSTDISPLAY &
+            "bailey" Exec rsh bailey rxvt -display $HOSTDISPLAY &
+            "barnum" Exec rsh barnum rxvt -display $HOSTDISPLAY &
+            "joker"     Exec rsh joker rxvt -display $HOSTDISPLAY &
+            "signal" Exec rxterm signal

AddToMenu Module-Popup    "FvwmModules"    Title
+            "Identify"    Module    FvwmIdent
+            "Talk"      Module    FvwmTalk
+            ""        Nop
+            "Button-Bar"    Module    FvwmButtons
+            "Pager"        Module  FvwmPager 0 0
+            "Pager (2 desks)" Module  FvwmPager 0 1
+            "WinList"    Module  FvwmWinList
+            ""        Nop
+            "Banner"    Module    FvwmBanner
+                       "ScrollBar"     Module  FvwmScroll 50 50
+            "Background"    Module  FvwmBacker
+                       "AutoRaise"     Module  FvwmAuto 200 Raise Nop
+                       "Stop AutoRaise" KillModule FvwmAuto
+            ""        Nop
+            "IconBox"    Module    FvwmIconBox
+                       "IconMan"       Module  FvwmIconMan
+            ""        Nop
+                       "Form - Rlogin"      Module FvwmForm Rlogin
+                       "Form - MyFvwmTalk"  Module FvwmForm MyFvwmTalk
+                       "Form - QuitVerify"  Module FvwmForm QuitVerify

AddToMenu Quit-Verify     "Really Quit Fvwm?" Title
+                  "Yes, Really Quit"  Quit
+                  ""            Nop
+                       "Restart Fvwm"      Restart
#+                  "Restart Fvwm 1.x"  Restart fvwm -s
#+                  ""            Nop
#+                  "Start twm"         Restart twm
#+                  "Start ctwm"        Restart ctwm
#+                "Start tvtwm"       Restart tvtwm
#+                "Start vtwm"        Restart vtwm
#+                  "Start mwm"            Restart mwm
#+                        "Start olwm"        Restart /usr/openwin/bin/olwm
#+                  ""            Nop
#+                  "Start dummy"       Restart xterm
+                  ""            Nop
+                  "No, Don't Quit"    Nop

######################## Sample Functions ##########################

AddToFunc MailFunction       I Next (AcceptsFocus $0) Iconify -1
+                   I Next (AcceptsFocus $0) Focus
+               I None (AcceptsFocus $0) Exec $0 $1

AddToFunc Move-or-Raise        I Raise
+                M Move
+                  D Lower

AddToFunc Move-or-Raise2    M Raise
+                M Move
+                  D Lower

AddToFunc Maximize-Func        M Maximize     0 100
+                C Maximize     0 80
+                D Maximize     100 100

AddToFunc Move-or-Iconify    I Raise
+                M Move
+                D Iconify

AddToFunc Resize-or-Raise    I Raise
+                M Resize
+                D Lower

AddToFunc Resize-or-Raise2    M Raise
+                M Resize
+                D Lower

AddToFunc PrintFunction        I Raise
+                I Exec xdpr -id $w

AddToFunc PrintReverseFunction  I Raise
+                               I Exec xdpr 1/2 -h -rv -id $w

AddToFunc Iconify-and-Raise     I Iconify
+                               I Raise

# RLOGIN machine fg bg
AddToFunc RLOGIN I Exec xterm -fg $1 -bg $2 -e rlogin $0 -8

# TELNET machine fg bg
AddToFunc TELNET I Exec xterm -fg $1 -bg $2 -e telnet $0

AddToFunc FocusAndWarp I Focus
+                      I WarpToWindow 2p 2p

AddToFunc DeiconifyFocusAndWarp I Iconify -1
+                               I FocusAndWarp

AddToFunc ChangeDefaultFocus I Style * $0
+                            I Recapture

################## FvwmButtons button-bar ################################
#*FvwmButtonsGeometry 420x100-1-1
#*FvwmButtonsBack bisque3
#*FvwmButtons(Frame 2 Padding 2 2 Container(Rows 2 Columns 5 Frame 1 \
                                        Padding 10 0))
#*FvwmButtons(3x2 Frame 2 Swallow "FvwmIconMan" "Module FvwmIconMan")
#*FvwmButtons(1x2 Frame 2 Swallow(UseOld) "FvwmPager" "Module FvwmPager 0 0")
#*FvwmButtons(1x2 Frame 0 Container(Rows 2 Columns 2 Frame 0))
#*FvwmButtons(Frame 2 Swallow(UseOld,NoHints,Respawn) "xbiff" `Exec exec xbiff -bg bisque3`)
#*FvwmButtons(Frame 3 Swallow(UseOld,NoHints,Respawn) "xclock" `Exec exec xclock -bg bisque3 -fg black -hd black -hl black -padding 0 -update 1`)
#*FvwmButtons(2x1 Frame 2 Swallow(UseOld,NoHints,Respawn) "xload" `Exec exec xload -bg bisque3 -fg black -update 5 -nolabel`)
#*FvwmButtons(End)
#*FvwmButtons(End)

########################## Icon Manager ####################################
# this FvwmIconMan setup is for swallowing in above button bar example
*FvwmIconMan*numManagers 1
*FvwmIconMan*Resolution  page
*FvwmIconMan*background  bisque3
*FvwmIconMan*foreground  black
*FvwmIconMan*font        7x13bold
*FvwmIconMan*format      "%t"
*FvwmIconMan*action      Mouse   1 N sendcommand Focus, sendcommand "Iconify"
*FvwmIconMan*action      Mouse   2 N sendcommand "Iconify 1"
*FvwmIconMan*action      Mouse   3 N sendcommand "FvwmIdent"
*FvwmIconMan*followfocus true
*FvwmIconMan*sort        name
*FvwmIconMan*plainbutton          up black bisque3
*FvwmIconMan*selectbutton         down black bisque3
*FvwmIconMan*focusbutton          up yellow firebrick
*FvwmIconMan*focusandselectButton down yellow firebrick
*FvwmIconMan*dontshow icon=Untitled title=Untitled
#*FvwmIconMan*drawicons true
*FvwmIconMan*buttongeometry  300x0
*FvwmIconMan*managergeometry 1x5

########################## Window-Identifier ###############################
# Just choose colors and a fonts
*FvwmIdentBack MidnightBlue
*FvwmIdentFore Yellow
*FvwmIdentFont -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*

########################### Pager #########################################
*FvwmPagerBack #908090
*FvwmPagerFore #484048
#*FvwmPagerFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
# turn off desktop names for swallowing in above button bar example:
*FvwmPagerFont none
*FvwmPagerHilight #cab3ca
*FvwmPagerGeometry -1-1
*FvwmPagerLabel 0 Misc
*FvwmPagerLabel 1 Maker
*FvwmPagerLabel 2 Mail
*FvwmPagerLabel 3 Matlab
*FvwmPagerSmallFont 5x8
*FvwmPagerBalloons            All
*FvwmPagerBalloonBack         Yellow
*FvwmPagerBalloonFore         Black
*FvwmPagerBalloonFont         lucidasanstypewriter-12
*FvwmPagerBalloonYOffset      +2
*FvwmPagerBalloonBorderWidth  1
*FvwmPagerBalloonBorderColor  Black

##########################FvwmWinList##################################
*FvwmWinListBack #908090
*FvwmWinListFore Black
*FvwmWinListFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
*FvwmWinListAction Click1 Iconify -1,Focus
*FvwmWinListAction Click2 Iconify
*FvwmWinListAction Click3 Module "FvwmIdent" FvwmIdent
*FvwmWinListUseSkipList
*FvwmWinListGeometry +0-1


*FvwmBackerDesk 0 -solid steelblue
*FvwmBackerDesk 1 -solid midnightblue

*FvwmScrollBack grey40
*FvwmScrollFore green

############################################################
############################################################
# Note that icons are shown in the module
#    only if NoIcon commnand is applied.
#Style     *  NoIcon

############################################################
*FvwmIconBoxIconBack    #cfcfcf
*FvwmIconBoxIconHiFore  black
*FvwmIconBoxIconHiBack  LightSkyBlue
*FvwmIconBoxBack        #5f9ea0
#*FvwmIconBoxFore       blue
*FvwmIconBoxGeometry    5x1+0+0
*FvwmIconBoxMaxIconSize 64x38
*FvwmIconBoxFont        -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
*FvwmIconBoxSortIcons   IconName
*FvwmIconBoxPadding     4
*FvwmIconBoxLines       10
*FvwmIconBoxSBWidth     11
*FvwmIconBoxPlacement   Left Top
*FvwmIconBoxPixmap      fvwm.xpm
#*FvwmIconBoxHideSC Horizontal
*FvwmIconBoxSetWMIconSize
*FvwmIconBoxHilightFocusWin
#*FvwmIconBoxResolution          Desk
*FvwmIconBoxMouse       1       Click           RaiseLower
*FvwmIconBoxMouse       1       DoubleClick     Iconify
*FvwmIconBoxMouse       2       Click           Iconify -1, Focus
*FvwmIconBoxMouse       3       Click           Module FvwmIdent
*FvwmIconBoxKey         r       RaiseLower
*FvwmIconBoxKey         space   Iconify
*FvwmIconBoxKey         d       Close
*FvwmIconBoxKey         n       Next
*FvwmIconBoxKey         p       Prev
*FvwmIconBoxKey         h       Left
*FvwmIconBoxKey         j       Down
*FvwmIconBoxKey         k       Up
*FvwmIconBoxKey         l       Right
#
# Icon file specifications
#
# Mostly, you don't have to specify icon files, as FvwmIconBox now
# reads icon files specified in Style commands.
#
*FvwmIconBox            "Fvwm*"         -

# FvwmForm alias - rlogin or telnet to host via xterm
*RloginWarpPointer
*RloginFont         *helvetica*m*r*n*12*
*RloginButtonFont   *helvetica*m*o*n*12*
*RloginInputFont    *cour*m*r*n*12*
*RloginFore         Black
*RloginBack         Light Gray
*RloginItemFore          Wheat
*RloginItemBack          Gray50
# begin items
*RloginLine         center
*RloginText         "Login to Remote Host"
*RloginLine         center
*RloginText         "Host:"
*RloginInput        HostName  30   ""
*RloginLine         center
*RloginSelection    meth single
*RloginChoice       TN TN off "telnet"
*RloginChoice       RL RL on "rlogin"
*RloginSelection    UserSel   single
#*RloginChoice       Default   Default   on   "same user"
#*RloginChoice       Custom    Custom    off  "user:"
*RloginText         "(Userid:"
*RloginInput        UserName  10   ""
*RloginText         ")"
*RloginLine         center
*RloginText         "FG:"
*RloginInput        FgColor 15 ""
*RloginText         "BG:"
*RloginInput        BgColor 15 ""
*RloginLine         expand
*RloginButton       quit "Login" ^M
*RloginCommand Exec xterm  $(FgColor?-fg $(FgColor)) $(BgColor?-bg $(BgColor)) -T xterm@$(HostName) -e $(RL?rlogin) $(TN?telnet) $(HostName) $(RL?-8 $(UserName?-l $(UserName)))
*RloginButton       restart   "Clear"
*RloginCommand Beep
*RloginButton       quit "Cancel"
*RloginCommand Nop

# FvwmForm alias - query exit ala mwm
*QuitVerifyGrabServer
*QuitVerifyWarpPointer
*QuitVerifyFont          *helvetica*m*r*n*14*
#*QuitVerifyButtonFont    *helvetica*m*o*n*14*
*QuitVerifyButtonFont    7x13bold
*QuitVerifyFore          Black
*QuitVerifyBack          Light Gray
*QuitVerifyItemFore Wheat
*QuitVerifyItemBack Gray50
# begin items
*QuitVerifyLine          center
*QuitVerifyText          "Do you really want to exit FVWM?"
*QuitVerifyLine          expand
*QuitVerifyButton   quit      " Exit "
*QuitVerifyCommand  Quit
*QuitVerifyButton   quit      "Cancel"
*QuitVerifyCommand  Nop

# MyTalk & MyFvwmTalk from Dave Goldberg
# MyTalk Form - dissappears after use
*MyTalkWarpPointer
*MyTalkFont *helvetica*m*r*n*14*
*MyTalkButtonFont *helvetica*m*o*n*14*
*MyTalkInputFont *cour*m*r*n*14*
*MyTalkFore Red
*MyTalkBack Gray
*MyTalkItemFore Blue
*MyTalkItemBack Gray
*MyTalkLine center
*MyTalkText "Fvwm Function"
*MyTalkInput Func 40 ""
*MyTalkLine expand
*MyTalkButton quit "Run" ^M
*MyTalkCommand $(Func)
*MyTalkButton restart "Clear" ^R
*MyTalkButton quit "Cancel" ^C
*MyTalkCommand Nop
# MyFvwmTalk Form - sticks around
*MyFvwmTalkWarpPointer
*MyFvwmTalkFont *helvetica*m*r*n*14*
*MyFvwmTalkButtonFont *helvetica*m*o*n*14*
*MyFvwmTalkInputFont *cour*m*r*n*14*
*MyFvwmTalkFore Red
*MyFvwmTalkBack Gray
*MyFvwmTalkItemFore Blue
*MyFvwmTalkItemBack Gray
*MyFvwmTalkLine center
*MyFvwmTalkText "Fvwm Function"
*MyFvwmTalkInput Func 40 ""
*MyFvwmTalkLine expand
*MyFvwmTalkButton restart "Run" ^M
*MyFvwmTalkCommand $(Func)
*MyFvwmTalkButton restart "Clear" ^R
*MyFvwmTalkCommand Nop
*MyFvwmTalkButton restart "Iconify" ^Z
*MyFvwmTalkCommand Next [MyFvwmTalk] Iconify
*MyFvwmTalkButton quit "Quit" ^C
*MyFvwmTalkCommand Nop

# to change banner pixmap
#*FvwmBannerPixmap fvwm3.xpm
#*FvwmBannerTimeout 2

I had added several users to the machine, and added this start script to /etc/inid.d and called it virtech:

#!/bin/sh
DEPTH="-depth 8"
GEOM="-geometry 1075x825"
FLAGS="-dontdisconnect"
su -l jcroson -c "vncserver :1 $DEPTH $GEOM $FLAGS"
su -l slongtine -c "vncserver :2 $DEPTH $GEOM $FLAGS"
su -l dmuehlbauer -c "vncserver :3 $DEPTH $GEOM $FLAGS"
su -l cnapiorkowski -c "vncserver :4 $DEPTH $GEOM $FLAGS"
su -l techworks -c "vncserver :5 -alwaysshared $DEPTH $GEOM $FLAGS"
su -l jreseburg -c "vncserver :6 $DEPTH $GEOM $FLAGS"
su -l jtaugher -c "vncserver :7 $DEPTH $GEOM $FLAGS"
su -l dwille -c "vncserver :8 $DEPTH $GEOM $FLAGS"
su -l jbeyerlein -c "vncserver :9 $DEPTH $GEOM $FLAGS"
su -l esindic -c "vncserver :10 $DEPTH $GEOM $FLAGS"
su -l pdolan -c "vncserver :11 $DEPTH $GEOM $FLAGS"
su -l jjackson -c "vncserver :12 $DEPTH $GEOM $FLAGS"
su -l rfiely -c "vncserver :13 $DEPTH $GEOM $FLAGS"
su -l rpaplham -c "vncserver :14 $DEPTH $GEOM $FLAGS"
su -l dthompson -c "vncserver :15 $DEPTH $GEOM $FLAGS"
su -l cbialozynski -c "vncserver :16 $DEPTH $GEOM $FLAGS"
su -l jperroni -c "vncserver :17 $DEPTH $GEOM $FLAGS"

Now I had my simulated Terminal Server. I then needed to create the proper xstartup to ensure fvwm2 is running the way I want for each user and deposit it into /etc/skel:

#!/bin/sh

xrdb $HOME/.Xresources
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop"
#xterm -e vncviewer -listen
fvwm2

Initially, I launched xterm and fire vncviewer in listen mode to wait for the customer to connect, but it proved to be problematic, so I commented it out, and let the engineer do it manually with this menu item in the above fvwm2rc

######################## Menus ###################
AddToMenu RootMenu    "Virtual Technician"    Title
+            "XTerm"        Exec exec xterm -sb -bg black -fg white -rightbar
+                       "VNC Viewer"    Exec exec xterm -iconic -e vncviewer -listen

Once the server was set up and proved to work, I set up an InnoSetup script with a few tools that would create our reverse VNC connection. First, I collected a modified winvnc.exe that had our company logo compiled into it which was renamed to virtech.exe. It also needed othread2.dll and vnchooks.dll supporting libraries. Here is the inno script for this bit:

[Setup]
AppName=Virtual Technician
AppVerName=Virtual Technician v3.3.6
DefaultDirName={sd}\VirtualTechnician
Uninstallable=no
Compression=lzma
SolidCompression=yes
DisableDirPage=yes
DisableFinishedPage=yes
DisableProgramGroupPage=yes
DisableReadyMemo=yes
DisableReadyPage=yes
DisableStartupPrompt=yes
WindowVisible=no
WizardImageFile=tw.bmp
AppMutex=WinVNC_Win32_Instance_Mutex

[Registry]
Root: HKCU; Subkey: Software\techworks\VirtualTechnician; ValueType: dword; ValueName: Password; ValueData: 0000000000
Root: HKCU; Subkey: Software\techworks\VirtualTechnician; ValueType: dword; ValueName: RemoveWallpaper; ValueData: 0

[Files]
Source: virtech.exe; DestDir: {app}; Flags: ignoreversion
Source: othread2.dll; DestDir: {app}; Flags: ignoreversion
Source: vnchooks.dll; DestDir: {app}; Flags: ignoreversion

[Run]
Filename: {app}\VIRTECH.EXE; Parameters: -connect vtech.myoldcompany.com::5510; Flags: hidewizard waituntilidle

The last line would then be modified for each users vncserver session on the FreeBSD box.

We also quickly found that if this was used at a customer's workstation and another attempt was made by the user to install our package, it would fail, since an instance of the programs mutex was found, and winvnc.exe would complain that it couldn't run again. That prompted me to whip up a quick hack that would wrap our first Inno package inside another, and issue a kill command with the free KILL.EXE utility if winvnc.exe could be found:

[Setup]
AppName=Virtual Technician
AppVerName=Virtual Technician v3.3.6
DefaultDirName={sd}\VirtualTechnician
Uninstallable=no
Compression=lzma
SolidCompression=yes
DisableDirPage=yes
DisableFinishedPage=yes
DisableProgramGroupPage=yes
DisableReadyMemo=yes
DisableReadyPage=yes
DisableStartupPrompt=yes
WindowVisible=no
WizardImageFile=..\tw.bmp

[Files]
Source: kill.exe; DestDir: {app}; Flags: ignoreversion
Source: ..\Output\setup.exe; DestDir: {app}; Flags: ignoreversion

[Run]
Filename: {app}\KILL.EXE; Parameters: /f winvnc.exe; Flags: hidewizard runhidden
Filename: {app}\KILL.EXE; Parameters: /f virtech.exe; Flags: hidewizard runhidden
Filename: {app}\setup.exe; Parameters: /VERYSILENT

Fun project, and done a long time ago, so most of this is from memory. Hopefully someone out there can benefit from this, but I'm likely to think that the free remote tools out there will greatly outweigh any decision to use a solution like this any longer.

Comments

Popular posts from this blog

NPI Search Redundancy

freeFTPD

Using ImageMagick and Tesseract to sort TIFFs on Windows