# Change log
#
# 7.6 Fixed bugs in Java GUI.s This moved vncv and sshpfg to version 2.0.
# Java changes.
# - Fix a bug which used up CPU while running.
# viewer.buttonPanel.getButtonPanelConfig().autoHideButtonPanelPeriodMS=0;
# in VncCanvas changed to
# viewer.buttonPanel.getButtonPanelConfig().autoHideButtonPanelPeriodMS=100;
# - Fix bug that broke the ability to set the VNCV look and feel (dialog failed to display).
# - Use the same program version for the VNCV and SSHPFG SW.
#
# 7.5 Add 'New Window' option in Unity launcher, although user could have used centre mouse button
# to launch another window previously.
#
# 7.4 Remove depends on python-paramiko from deb packaging although the package requires paramiko.
# This is because paramiko can be installed 'apt-get install python-paramiko' bit I hiot a problem
# where the latest paramiko was needed to fix an issue. To do this I installed paramiko with pip.
# This broke the dependancy of sshpf and sshpf would not run from icon in unity launcher and
# reinstall failed due to dependancy issue. Therefore removed from packaging dependancy and
# accept runtime errors if paramiko not installed.
#
# 7.3 Add unity (debian installation) icons.
#
# 7.2 -Change to the vnc viewer/connection manager (sshpfg v1.90).
# - Be a little cleverer when providing default command lines to launch ssh terminals and web browsers
# from the sshpfg connection GUI. On windows a default putty command line is provided for ssh
# sessions. The user must enter the path to the putty.exe file. For other OS's we check for
# the /usr/bin/terminator and /usr/bin/gnome-terminal programs. If neither of these are found then
# the user must enter the ssh terminal program that they wish to use.
# For http connections the user must enter the abs path of the web browser program to launch.
# - Bug when launching a terminal or web browser and no saved command existed we would not use
# the default command. Now we do, although if the terminal or web browser programs (terminator,
# gnome-terminal, putty, firefox or google chrome) do not exist then the program will fail to
# start. In this case the user must right click the connection and enter the command line manually.
#
# 7.1
# - Change to the vnc viewer (sshpfg).
# - When stretch across all screens option was selected the desktop window would not
# always open on the left most screen so that the maximum remote desktop area was
# visible. This has been fixed.
#
# 7.0
# - Previously when the source client connected to the ssh server it
# would setup port forwarding from a local server port to the respective port on the server.
# If when a client connected to the local server port the connection is then forwarded to
# the dest client service.
# A problem with this exists if, after the src client has connected to the server, the dest
# client disconnects from the ssh server and reconnects sometime later using a different port.
# In this case the src client attempts to connect to the old forwarding port and fails.
#
# To over come this problem when a connection is made to the local server port we lookup
# the associated dest client service port from the list of dest clients that the src
# client periodically pulls from the ssh server. Thus we always try to connect to the
# most current list of the available dest clients.
#
# - Introduced persistent state on the source clients to store all the dest clients that have
# ever been reachable from this source client. This stores the loal (to source client)
# server port number in an attempt to ensure that the port number for a particular
# destination client does not move around (unless the port number is in use.
#
# As this is a fairly major change the version has been bumped to 7.0
#
# 6.06
# - Server port allocation could cause duplicate server ports which meant that the
# server port failed to be created. Added code to check for duplicated ports when
# some low order (E.G 27000, 27001 etc) ports are unused.
# - sshpfg changes
# 1.88
# - When refreshing the displayed destination list, change to a waiting cursor until
# data is available to update the table.
# - Disable the automatic memory usage reports in vncv and sshpfg.
# - Add command line option to enable memory usage report in the status bar for vncv
# and sshpfg.
# - Add command line option usage test to vncv and sshpfg.
#
# 6.05
# - Removed unused imports
# - Extend _LOCK_UPDATE_TIMEOUT from 15 to 60 seconds to allow contention of more clients
# - Don't attempt to release the server access lock unless it has bee gained
# - If empty line in the local dest client config file then ignore it
# - Added debug statement to indicate when dest connection setup is complete
#
# 6.04
# - Updated sshpfg.jar to fix right click on row not selecting row issue.
#
# 6.03
# - Print memory usage stats in the status bar for the java GUI.
#
# 6.02
# - Another attempt to pick server port allocation.
#
# 6.01
# - Another attempt to pick server port allocation.
#
# 6.0
# - Another fix to the server port allocation, _getServerPort().
#
# 5.99
# - Added debug messages when a cmd is executed on the server.
#
# 5.98
# - Update _getServerPort() so that we either use the last allocated port (from file in the server
# for the current client, or we use the nect free port. The previous code could get stuck in a
# loop, trying to connect to the server, failing (due to port in use) and repeating the process
# in definatley.
#
# 5.97
# - The TKInter GUI now accepts input when the Text widget is in focus.
# - Updated the manual to include details of the latest sshpf features and the
# sshpfg program.
#
# 5.96
# sshpf would not install as a service under Windows XP due to the getpass.getUser()
# method failing. This has been fixed.
#
# 5.95
# sshpfg change
# * 1.85
# * - Add ability to execute the sshpfg on windows platform as well as Linux.
#
# 5.94
# Fixed automatic vnc server detection and startup for windows platforms.
# Added 32 bit windows build.
#
# 5.93
# - Move sshpfg to 1.83
# sshpfg 1.84 change
# - Add -d (debug) command line option. If this is used when external commands are launched
# debugging is printed on stdout.
# - Added a better command line argument parser to the ShellCmd class.
#
# 5.92
# - Move sshpfg to 1.83
# sshpfg 1.83 change
# - For non vnc services the cmd line to execute when a table row is double clicked can be entered
# directly if the user selects a row and right clicks on it. On this cmd line $h=hostname and $p
# is the TCP port. If no cmd line text is found then for ssh and http services default cmd lines
# are provided when the cmd line dialog is opened.
#
# 5.91
# - When an ssh tunnel shuts down don't throw an error in the thread
# - When checking for a VNC server show the greeting on stdout.
#
# 5.90
# Add sshpfg 1.82.
# - sshpfg would not start ssh sessions as the wrong host was used. Should have
# been localhost. Fixed.
#
# 5.89
# Add sshpfg 1.81.
# - VNCV load config was not working. Fixed.
#
# 5.88
# Add sshpfg 1.80.
# - Change default encoding in dialog to ZRLE as its the fastest in testing.
#
# 5.87
# Add sshpfg 1.79.
# - VNC config file will now be saved encrypted although the key is obvious in the code, just obfuscate slightly.
#
# 5.86
# Add sshpfg 1.78.
# - Store VNC config option in a VNC config option class file. This fixes problems where previously config would get lost
# if the sshpf src client (local) TCP IP ports changed. We now save the config files with the hostname and the service
# name in the filename.
# - The desktop name is updated and if no resize strategy is selected the previous VNC desktop size and location is used.
#
# 5.85
# - Add sshpfg 1.77 that has a menu option to restart local clients.
#
# 5.84
# sshpfg 1.76 change, When user selects refresh, remove the table as an indication
# to the user that a new connection list is being read.
#
# 5.83
# - Updated the server access locking code to be more robust. Previously multiple dest
# clients could get lock at the same time and cause merry hell.
# - Force src/dest client shutdown rather than attempting to shutdown gracefully when
# the user select the menu option to shutdown all src/dest clients.
#
# 5.82
# - When shutting down a src client from the menu the prompt indicated that the dest
# client was being shutdown. Fixed prompt.
#
#
# 5.81
# - When -a cmd line used only add clients if the have a src port != -1
#
# 5.8
# - Shutting down and disconnecting src and dest clients could occur on startup
# The code associated with shutting down and disconnecting src/dest clients has been
# re written and when starting src and dest clients we remove local and remote
# shutdown and disconnect file. To stop a src/dest client starting up and immediately
# shutting down or disconnecting because a shutdown or disconnect file is left lying
# around from a previous session.
#
# 5.79
# - Updated sshpfg to show the time that the dest client has been connected.
#
# 5.78
# - Updated sshpfg to version 1.74 to add a refresh icon to the refresh menu item.
#
# 5.77
# - Update sshpfg GUI to version 1.73. This allows the user to refresh the list of dest
# clients.
#
# 5.76
# - Set an ssh transport keep alive period
# - Increased the keepalive time from 60 to 15 seconds as this defines the time period
# the user has to wait for connections to build and 60 seconds was a bit slow.
# - If user selectes enable auto start and src or dest clients are found running print
# a message indicating that it is better to shut them down before restarting rather
# than restarting them.
#
# 5.75
# Slow down keep alives so as not to load the server.
#
# 5.74
# Changed the server access lock. Each client acquires lock and while it is in use
# the client updates a file in the lock dir. Other clients can check this file and
# if it has not been updated for a period of time they can remove the lock and
# acquire it themselves. This will hopefully overcome the long standing server access
# lock issues.
# We no do not check for longer and longer periods on the source client for available
# connections but check every SOURCE_CLIENT_CONNECTION_LIST_UPDATE_PERIOD_SECONDS.
# We can do this because of the new server access lock code.
#
# 5.73
# Add sshpfg.jar (1.72) which adds the connection table to the status window.
#
# 5.72
# Added sshpfg.jar 1.71 which fixes vncv startup failure when no existing vncv
# config is found.
#
# 5.71
# Added sshpfg.jar 1.7 which adds a direct vnc viewer GUI.
# sshpfg change
# * - Allow user to configure the time period that the vnc control panel (along top edge of VNC window is hidden when the
# * mouse moves back over the desktop window. The use can now configure this time period to be 0 so that when the mouse
# * moves over the desktop the control panel is immediately hidden.
#
# 5.70
# Add sshpfg v1.5
#
# 5.69
# sshpfg 1.4 changes.
# * - Automatically copy the remote copy buffer to the local one when the remote copy
# * buffer is changed.
#
# 5.68
# sshpfg 1.3 changes.
# * - Added Fit To Desktop a frame resize strategy.
# * - If the vnc button panel is set to auto hide and the user moves the mouse
# * away from the vnc window, keep the panel visible while the mouse stays
# * away from the vnc viewer window.
#
# 5.67
# Update to include latest sshpfg application with built in VNC viewer.
#
# 5.66
# sshpfg change. When ssh sessions are launched used -X option.
#
# 5.65
# Added sshpfg Java based application launcher. Only currently supported on Linux platforms.
#
# 5.64
# Add -a argument to generate a client list file in order that the sshpfg Java
# can use this to determine what clients are reachable.
#
# 5.63
# Add ability to disable/enable syslog while the program is running. From the
# mgmt menu it is possible to disable/enable syslog output for all instances
# of sshpf running on the local machine.
#
# 5.62
# Stop _) characters being used in filenames. # _ characters cannot be used as
# they are used to separate attributes in filenames.
#
# 5.61
# If _ characters were in the service name then the dest clients would not be
# displayed when Show client connections. was selected. Fixed.
#
# 5.60
# Added ability to auto start VNC server if the user configures a service on
# Windows (ultravnc 1_1_8_0) and Linux (Debian remote desktop)
#
# 5.59
# - When setting up dest client connections ask if the servie is local after
# the servcie port has been entered.
#
# 5.58
# - Add the ability to forward dest client connection to other computers in
# the network where the sshpf dest client is running.
# - When configuring dest clients check that the service is reachable from the
# dest client. I.E a socket connection can be made to the socket.
#
# 5.57
# - Src client if internet connection dropped the client would not reconnect
# to ssh server. Fixed.
# - Reinstate the code that attempts to free TCP server ports on the ssh server.
#
# 5.56
# Skipped this version.
#
# 5.55
# - Add option to enable syslog. Previously syslog was enabled by default.
# - When entering the service name the user can use the @ character in the
# service name. The text following this character is used as the dest
# service host address. By default (if @ character is not used then the
# dest service host then local host is used).
# - Src client if internet connection dropped the client would not reconnect
# to ssh server. Fixed.
#
# - 5.54
# When shutting down the src client ensure all steps are attempted.
#
# - 5.53
# If the src client disconnects _shutdown() can throw exception which
# stops the src client reconnecting. Wrapped in try/except to fix.
#
# - 5.52
# Clean up the code that sets the local config path
#
# - 5.51
# - When '16 : Enable src/dest client auto-start.' mgmt menu option is selected
# is selected and the user elects to startup src/dest clients don't stop all
# src and dest clients and then start only those clients selected.
# Now we only stop and then start the src or dest client selected. If both
# src and dest client is selected then both will be stopped and restarted as
# they were previously.
#
# - 5.50
# - src_connected.XX files can build up in the ssh server .config/sshpf path.
# Purge old files when src clients connect to stop this occuring.
# - When an error occurs always log a stack trace to syslog. This allows
# errors that occur only occasionally to be traced even when debugging is
# off.
#
# - 5.49
# Peviously the connected time displayed HH:MM:SS and hours rolled over from
# 23 to 0. Therefore it was not possible to see how long a client had been
# connected if longer than 1 day. Now the connected time includes days.
#
# - 5.48
# Problems have been found when the ssh server does not free up ports when a
# dest client disconnects. This appears to be an issue in the ssh server code.
# This causes failures to connect port forwarded connections. Now, when a dest
# client connects to the ssh server it checks that the server port is not in
# use by the server before starting the port forwarding connection.
#
# 5.47
# - The server dest connections list file (sshpf.py.avail_connections.txt) is
# now updated in one cmd transaction to speed up it's creation.
#
# 5.46
# - We now wait a maximum of twice as long (previously it was always twice as
# long, up to a max value) for the next connection update.
# We randomise this time period to spread out src client
# attempts to gain server lock between self._keepAliveSeconds and
# SrcClient.MAX_UPDATE_CONNECTIONS_SECONDS which spreads out the
# contentions.
#
# 5.45
# - Fix allocation of server ports. Previously if a dest client was not
# connected the port could be reallocated to another dest client as it
# connected. Ports should be reserved so that if a dest client connects
# again it uses the same server port as last time it connected.
# - Added check for duplicate ssh server ports.
#
# 5.44
# - The src client checked for conneciton updates (new destination clients
# connected to the ssh server every 5 seconds. In order to do this server lock
# is required. With many source clients connected it could take a long time to
# obtain server lock and then lock attempt timeouts which made connectivity
# unstable.
# Therfore after the keepalive period has elapsed after initial connection to
# the server a check is made for connected dest clients. The next time around
# 2* the keeplaice period must elapse before a check is made for connected
# dest clients. This check period keeps doubling up to a max of 3600 seconds.
# This reduces significantley the requirement for the src client to obtain
# server lock and so should stop the above condition occuring but also has the
# side effect that it could take up to 1 hour for the src client to be aware
# of a newly connected dest client although the user could always disconnect
# the src client and reconnect to the server to obtain an up to date list
# of available dest client connections.
#
# 5.43
# - Obtain and release server access lock when the ClientMgmt class deletes the
# sshpf.py.avail_connections.txt file. This will hopefully overcome situations
# where more dest clients are connected than are listed in this file.
#
# 5.4
# - Syslog messages now have the following components
# 0 = time/date stamp
# 1 = hostname
# 2 = main python file name
# 3 = PID
# 4 = username under which the program is being executed
# 5 = The syslog message
# - syslog messages can be disabled if the 'uio_syslog_off' file exists in
# the users home directory.
#
# 5.3
# - Added ability to auto generate private/public ssh keys.
#
# 5.2
# - authorized keys backup files now roll around after 10 files have been
# created.
#
# 5.1
# - Src client now attempts to reconnect to the server if the ssh server cannot
# be reached.
# - Changed autostart startup times from 30/50 seconds to 10/15 seconds to allow
# quicker activation of sshpf services after Linux PC startup.
#
# 5.0
# - Added check for -u command line argument in list of argsa that may be
# present on a single run.
# - Install now installs sshpf.py into the python site packages directory
# so that import sshpf can be used if required to access module functionality
# from other programs.
# - In quiet mode no text is output to stdout, previously the version was shown
# on stdout.
#
# 4.91
# - Rationalise the use of absoloute server paths.
# - When autostarting clients don't allow auto start if a src client appears to
# be running.
#
# 4.9
# - Set src client reconnect delay failed because server path was not included
# in filename. Fixed
#
# 4.8
# - Removed the option to set the reconnect period on the command line.
# - Added the ability to et the reconnect time when forcing a dest client and
# src client to disconnect from the ssh server.
#
# 4.7
# - SERVER_PORT_SCRIPT_FILENAME_V1 and TCP_CONNECT_SCRIPT_FILENAME_V1 python
# scripts created on server were not being updated with the port number
# and so giving incorrect results. Replaced with
# SERVER_PORT_SCRIPT_FILENAME_V2 and TCP_CONNECT_SCRIPT_FILENAME_V2
# which take the port number as a command line argument.
#
# 4.6
# - Shutdown dest client during initialisation if requested to do so.
#
# 4.5
# - Use src and dest, rather than source and destination when identifying
# clients. Previously there was a mix of terms src and source , dest
# and destination
#
# 4.4
# - When disabling auto start ask the user if they wish to proceed as previously
# autostart was disabled if the menu option was selected.
#
# 4.3
# - On the dest client before setting up forwarding we attempt to build a
# connection to the server port as the ssh server may not have released
# the port from a previous port forwarding attempt and the action of
# attempting to connect to it causes the ssh server to release the port.
#
# 4.2
# - Mgmt menu now prints a blank line to make it eaiser to see the results of
# the previous command.
# - When displaying connection table do not limit table width to 80 characters.
#
# 4.1
# - getSrcClientForwardingConnections(), updated to check that the available
# connections file exists.
#
# 4.0
# - Major re-arch to fix reliability and usability issues.
#
# 3.93
# - Randomize poll period between attempts to obtain server lock.
#
# 3.91
# - Provide implementation of disconnectAllSrcClients().
# - Disable port remap option when disconnecting all dest clients as it breaks
# all dest client connections.
#
# 3.9
# - Added command line arguments to disaconnect src clients and view how many
# src clients are connected.
#
# 3.8
# - Get a list of the files created by dest clients from the server under server
# lock. This fixes a problem where the connected client list (when using the
# --srccc command line argument) did not return a consitent list of connected
# dest clients.
#
# 3.7
# - Changed the way src client listen ports are defines. We now attempt to make
# them the same as the ssh server listen port. This fixes the problem when
# disconnecting clients and remapping port usage.
#
# 3.6
# - Fixed server access lock as server access was broken and causing atomicity
# problems when clients were accessing the ssh server (E.G when creating *.py
# files on the ssh server)
# - EnsureConfigDirExists now has server access control.
# - --enable_autostart was creating files named 1 in config dir. Fixing stderr
# redirection fixed this.
# - When --disable_autostart is used do not prompt for host and username.
# - If clearing the src or dest lock files then do this befgore running any
# other actions requested on the command line.
# - --disable_autostart command line option does not shutdown src/dest client
# correctly. Fixed
# - Add code to shutdown dest clients if user presses control C after dest
# client has been started from the command line.
# - Add src client shutdown server lock remove code to src client.
# - Return server lock timeout to 60 seconds.
#
# 3.5
# - Added a delay to the auto start script as the ethernet interface may not be
# up as the computer starts.
# - Change the disconnect dest client mechanism as the atomicity issues occured
# with the previous mechanism. Now we create a file, the dest client sees it
# deletes it and disconnects.
# - Add a command line option to disconnect all connected dest clients.
#
# 3.4
# - When using the --srccc to get a list of the connected dest clients
# display the time that each dest client connection has been connected.
# - When configuring dest client check for duplicate computer/service port pairs
# Need to build connection with ssh server for this.
# - Add cmd line option to uninstall sshpf from a Linux PC.
# - Provide command line option to disbale ssh server auto login. This allows
# the user to remove an entry from the ~/.ssh/authorized_keys file. Backups of
# all previous changes to this file are kept as ~/.ssh/authorized_keys.1,
# ~/.ssh/authorized_keys.2 etc.
#
# 3.3
# - Added command line option to disonnect a single dest client.
# - Added --install option to install itself onto Linux platforms.
#
# 3.2
# - -srccc command line argument did not work. Fixed.
#
# 3.1
#
# - Dest client change.When the dest client connects to the ssh server it
# creates the <computer name>_<service name>_<service port>.dest_connected.0
# file. With each keepalive attempt (every 5 sefconds) this suffix number
# increments. If this file is removed while the dest client is connected then
# the dest client will disconnect and reconnect to the ssh server.
#
# - Src client change. Ensure the entries in the
# local sshpf.py.saved_connections.txt allways match those detailed in the
# remote (ssh server) .sshpf.py.avail_connections.txt file.
#
# - Src client change.
# When the src client connects to the ssh server and when it updates the
# local ssh connection list, if it finds a computer name in
# its local .sshpf.py.saved_connections.txt file that is not in the server
# .sshpf.py.avail_connections.txt file then it will be removed from the local
# file.
#
# - Add cmd line option to delete a dest client connection from the ssh server.
# - ssh to server
# - Get dest client list from the server
# - Show this list to the user
# - User enters index of the dest client they wish to delete
# - Prompt user that the dest client will be disconnected and as if it is ok to proceed
# - Check (poll every second) if the dest_connected file is incrementing. If it is
# - Delete the dest_conected file
# - Delete the entry from the server ~/.sshpf.py.avail_connections.txt file.
# - Use the incrementing dest_connected file to determine which dest
# clients are connected rather than checking for the server ports that are in use.
# - GetDestConnectedFilename now identifies the connection by the computer name
# and local port only as the service name is not relevant to the service
# identity and is only a label for the user.
# - getUserHome() removed and all reference to local config files now use the
# Client.LOCAL_CONFIG_DIR attribute.
#
# 3.0
# - Updated the command line help text to make it cleared what each argument does.
# - Warn useer of command line iotions that should not be used at the same time.
# - Change --user argument to --username
# - If the --host or --usernamne arguments are not supplied then prompt the user
# to enter them. This should improve usability.
#
# 2.9
# When using autostart ensure that the startup script users the correct hostname.
#
# 2.8
# When the --noautostart option is used check if src or dest clients are running
# and give the user the option to stop them running.
#
# 2.7
# Added a --srccc command line option to show available dest client connections.
# This has to connect to the ssh server an so is a bit slow. Therefore the
# previous command line option can still be used (--srcc) to quickly read a
# local (to the src client) list of all the possible dest client
# connections.
#
# 2.6
# When the --srcc command line argument ius used we now show a table of
# connections that is easier to read.
#
# 2.5
# - Remove the startup delay option when the --autostart command line option is
# used.
#
# 2.4
# - Fix for the previous change to ensure all previous sshpf threads were
# terminated correctly.
#
# 2.3
# - Require the user to enter the --user command line argument to define thre ssh
# username.
# - Remove the command line password argument as autologin must be configured.
# - Ensure all sshpf processes are stopped before being restarted when using
# the --autostart argument.
#
# 2.2
# Changed the way server ports are allocated by the dest and src clients.
# We now search the saved configuration files on the ssh server (dest client)
# or src client machine for the next available port.
# Add a chedck for an unknown username and instruct user to user the --user
# command line argument if no username can be determined.
#
# 2.1
# dest client forwarded port start ports listening on the ssh server. These
# are controlled by the ssh server and do not get disocnnected (stay listening
# ports) when the ssh connectin drops. Therefore after an ssh connection is
# dropped we no make an attempt to connect to the port on the server that was
# previously used. This attempt causes the ssh server to release the socket
# bind so that the subsequent attempt to setup port forwarding succeeds.
#
# 2.0
# Attempt to cleanup dest client port forwarded connections in an attempt to
# ensure ports are not left hanging around at the server.
#
# 1.9
# Attempt to close port forwarding sessions when shutting down the dest client.
#
# 1.8
# Add dest client ID to the messages generated so that problems can be traced
# using syslog data.
#
# 1.7
# Change startup delay default presented to user from 30 to 60 seconds.
# Change order of startup configuration optiions.
#
# 1.6
# Added ability to configured the autostartup delay. When configuring sshpf to
# run when the computer startsup a delay may be performed to allow the network
# interface to come up. This was previously fixed at 10 seconds but may be
# variable now as different computers may take different time periods before
# the network interface is available.
# Also when configuring autostart allow the user to startup the sshpf clients
# imediatley if required, rather than requiring a reboot.
#
# 1.5
# Added GNU GPL banner to this src file.
#
# 1.4
# The src clioent local lock file was expected to be in the user dir. This
# is incorrect, it should be in the user home folder. Fixed.
#
# 1.3
# Added ability to reconnect to ssh server even if initial connect fails.
# When a src or dest client thread raises an error and debug mode is off
# a stack trace is not longer printed, just an error message containing the
# exception text. If debug mode is not set off then a stack trace will
# be raised.
#
# 1.2
# Added the ability to remove the above startup configuration.
#
# 1.1
# Added ability to configure auto start on linux systems.
#
# 1.0
# Initial release
#
Initial release