Gerald Nunn's Blog

« OnTrack 2.5.1 release in the market | Main | OnTrack Updated to 2.5.3 in Market »

Linux alternative to NetMeeting

Thursday, July 08, 2010

I switched to Linux full time from Windows about eight months ago and haven't looked back, for the work I do and the software I use Linux has worked great. My Java based development tools are more responsive under Linux and generally everything feels snappier. I have found approriate alternatives to most of the software I used in Windows with a few notable exceptions. One exception for example is MS Office and Visio however an easy way to workaround that is to use Windows in VirtualBox to run MS Office and Visio. VitualBox starts so fast from a saved state that it doesn't bother me at all.

One piece of software I have been struggling to find an equivalent to is NetMeeting though. As a technical consultant I pretty much spend all my time at client sites working with their staff and 99.99% of the time the staff are running Windows. Fair enough, I have no issue with Windows however invariably the client will need to do some add-hoc desktop sharing over the network and usually the tool of choice for them is Netmeeting. When the client is hosting the meeting, for example when they want me to watch them perform an install of something, I usually just run Netmeeting in the VirtualBox Windows VM and it works great. The more problematic scenario is when they need me to host a meeting and share my desktop with multiple people.

It's not that Linux isn't capable of doing this, VNC can fill this need in a pinch but the issue I initially had is very few people in the Windows world have VNC clients installed on their machine or worse even know what VNC is. I needed a way to share my desktop with multiple people on the same LAN in way that works regardless of the platform the other folks have. One solution is to use a web conferencing product like Yugma or Webex which support sharing a Linux desktop. These are not slam dunks though, the problem with Webex is that it costs money and the company I work for won't cover it. Yugma on the other hand has a free account however it didn't work for me through the client's proxy. Finally the last issue is sometimes I deal with sensitive information and I'd prefer not to route the connection over the Internet, Netmeeting keeps everything on the client's corporate network.

I spent quite a bit of time thinking about this and cobbled together a solution based on a few open source projects that in my initial testing seems like it will fill the bill very well. The first part of the solution is the tried and true VNC, specifically the x11vnc project which allows you to share your current desktop easily to multiple people over a LAN. However as mentioned previously, my concern was that most people in the Windows world don't have a VNC client but after some additional research it turns out that there are a couple of ways to skin that cat and make things work.

First, after reading up on x11vnc and vncserver, I found that both products also start a simple http server in addition to the VNC server. This http server is used to serve a Java based VNC viewer, in the form of an applet, to a browser. This allows any browser with a Java plugin to access your desktop without having a VNC viewer installed previously. This is quite helpful however in testing some machines at my client I found that many of them didn't have Java enabled, therefore I needed something more ubiquitous.

For rich applications in the world of the web it doesn't get more universal then Flash and sure enough some kind hearted individual has a Flash based VNC viewer called Flashlight-VNC. If we combine Flashlight-VNC with x11vnc we get the winning combination, a netmeeting like experience served from the browser that should work for almost any client. All you need to do is send a URL to your machine to the people who wish to connect and they simply open it in a browser to view your desktop.

Here are the steps needed to get this working.

Download and install x11vnc

The first step is to download and install x11vnc on your machine. All Linux distributions should have this available in their repository so try downloading it from there first. We are using x11vnc over vncserver because vncserver does not allow you to easily share your current desktop, rather it exposes a different display to remote users.

Download Flashlight-VNC

Next download the Flashlight-VNC package from their website and extract all the files to a folder. At the time of this running 2.0.3 of Flashlight-VNC was available, I would recommend downloading the latest swf from here http://flashlight-vnc.sourceforge.net/swf/Flashlight.swf to avoid the issue described here.

Create Scripts

The next step is to create some scripts to start and stop the x11vnc server and the Flashlight-VNC policy server. I created my scripts in /home/gnunn/bin/x11vnc where /home/gnunn is my home directory, make sure to update the HOME_DIR variable in the script below to reflect your script's location. Here is the start.sh script:

#!/bin/bash

HOME_DIR="/home/gnunn/bin/x11vnc"

rm -rf ${HOME_DIR}/logs/*.out

IP="$(/sbin/ifconfig eth0 | sed -n '/inet /{s/.*addr://;s/ .*//;p}')"
HOST=$(hostname)

nohup x11vnc -forever -shared -viewonly -httpdir ${HOME_DIR}/classes -gui tray -desktop "Linux Main Desktop" -solid "#FFFFFF" -display :0 >${HOME_DIR}/logs/x11vnc.out &
nohup java -jar policyserver.jar >${HOME_DIR}/logs/policyserver.out &

echo "VNC is running on port 5900"
echo "PolicyServer is running on port 1234"
echo "Users can access client at http://${HOST}:5800 or http://${IP}:5800"
echo "Make sure your local firewall is stopped or has these ports open"

The key parameters that we pass to x11vnc are:

  • viewonly. This parameter prevents users from interacting with your desktop.
  • shared. This allows multiple clients to connect to the same desktop simultaneously.
  • forever. Keeps x11vnc running forwever instead of shutting down when the first client disconnects.

Here is the corresponding stop script:

#!/bin/bash

x11vnc -remote stop

Add Web Server Files

In this step we create the files that are going to be served by the x11vnc http server, these are the files that the user's browser will download when they connect to your machine. There are two files, index.vnc which is the default html page served by x11vnc and Flashlight.swf which is the Flash code for the VNC viewer. In the directory where you saved the scripts create two sub-directories, one called classes and one called logs.

In the classes directory, create a file called index.vnc with the following contents:

<html>
	<title>
	$USER's $DESKTOP desktop ($DISPLAY)
	</title>
	<body>
<script type="text/javascript">
document.writeln("<object id='Flashlight' width='100%' height='100%' type='application/x-shockwave-flash' data='Flashlight.swf'>");
document.writeln("<param name='movie' value='Flashlight.swf'/>");
document.writeln("<param name='allowScriptAccess' value='always'/>");
document.writeln("<param name='wmode' value='opaque'/>");
document.writeln("<param name='FlashVars' value='host=" + window.location.hostname + "&port=$PORT&viewOnly=true&shared=true&autoConnect=true'>");
document.writeln("</object>");
</script>			
	</body>
</html>

Next copy the Flashlight.swf file from the Flashlight-VNC download into the classes directory.

Copy policyserver.jar

In this step we need to copy the policyserver.jar file from the Flashlight download to the directory where we created the start.sh and stop.sh scripts. This policy server is required by Flash in order that it can retrieve a security policy that allows Flashlight-VNC to make a VNC connection to your machine.

Start the Server

We are now ready to start the server, open a terminal windows and run start.sh. If everything worked correctly you should see the x11vnc tray icon appear in your system tray and a small floating window sating that the Policy server is now running on port 1234.

To test the connection, open a browser on a different machine and connect to the URL given by the script. If the host name doesn't work try the IP instead. If it is still not working make sure firewalls are turned off on both machines

Conclusion

There is a lot of room for improvement in this setup but hopefully that is enough to get you started and thinking about the possibilities. Some areas for improvement, should you be so inclined include:

  • Give the user a choice of Flash or Java connection options by modifying index.vnc
  • Eliminate the policy server by having the x11vnc http server return the policy
  • Alternatively, improve the policy server so it doesn't display a window on the desktop and supports being stopped remotely like x11vnc.

Posted by Gerald Nunn at 10:26 PM | Categories: Linux | Permalink