moznx and nxrun
Important Note: moznx and nxrun are now part of the freenx project. For more information, see the freenx homepage here.
moznx is a plugin for mozilla that acts as a client for NX Server. The plugin client has several advantages over the standalone NXClient:
- It is open source
- It auto-installs with a couple of clicks
- It allows you to keep all the configuration files on the server
- It can be embedded into a portal or browser application
nxrun is a command line client for nx. It is open source, lightweight, and uses the same underlying library as nxrun.
nxrun-gui.py is a gui for nxrun. It is written using pygtk.
Latest News
August 16, 2005 - nxrun-gui.py has been released on the freenx website. It is a pygtk gui for nxrun. It implements the general and advanced tabs of nxclient. It requires pygtk 2.4.
May 13, 2005 - The download files have been moved to the freenx website. The source is also available there in cvs. The site can be found here. Also, nxconnect has been renamed nxrun and is also available. The demo program for moznx has been replaced by a much simpler test html page.
March 01, 2005 - The win32 plugin installer is now online. Thanks to Marius Albring for providing the webspace. See information below to download.
February 28, 2005 - nxconnect has now been released. This is equivalent to the old nxrun. It is a command line client. It uses the same library as mzonx. So far I have just released the linux version, but I will create a win32 version as well. Notably, this is the first client to support specifying a key file in the configuration. Source will be coming soon. See here for more details.
February 26, 2005 - moznx 0.3 has now been released. Notable updates include:
- Support for FreeNX
- New way of handling passwords
- Install package for Win32
- New documentation
- Protocol eliminates some old conventions from 1.3
February 6, 2005 - moznx 0.2 has now been released. Notable updates include:
- Support for restoring sessions
- Support for win32
- Support for 1.4.0 Encrypted sessions
- Source is now available
- Various tweaks to the protocol to make it more like the commercial client
Disclaimer
The current version of moznx is an Alpha release. Some important things to note:
- It embeds version 1.4.0 of the gpl executables for the client (linux only - see notes below)
- I have tested with various versions of Firefox and Mozilla
- I have tested with a few different linux distributions and on Windows 2000
- It has been tested with 1.4.0 NXServer
- It has a lot of debug information that spews out on the console.
- The linux plugin installs in the user's home directory. This means that if there are multiple user accounts on the client, each one will have to install its own plugin. This made the most sense because it would accomodate clients that have restrictive permissons. There is a way around this, but it requires some manual effort, which I will document on this site in the near future
- There are known issues with the way the shutdown code works if a session is interrupted. I will work on it in the future, but feel free to debug it and submit a patch
- I am not yet in compliant with the GPL, but I am releasing the source.
Moznx comes with a little demo web application. I have tested it with apache on linux but it should work with anything. It is CGI and perl. It is just intended to demonstrate how moznx works.
Note: The install that comes with the demo program is for linux only. See the Windows notes for details on installing for Windows.
nxrun is a command line client based on the same library as moznx.
You can download here
It assumes that you have either installed moznx or the nomachine client on the machine.
It has a new feature which is support for specifying a key file in the config file. You add the following to the .conf:
<group name="Login" >
<option key="KeyFile" value="client.id_dsa.key" />
</group>
the rest of the parameters are explained from the command line. Just download and type ./nxrun for help.
Download and Install
Download here. for the test page and plugins.
The test page can be edited to insert the proper path to your configuration file.
Configuration
Once the files are in place, you just have to set up the configuration files.
Use the NX client to create the configuration file the way you normally do. Get the configuration file from the ~/.nx/config/ directory.
There are a couple of changes you have to make to the configuration file to make it work. I could not get the NX Client to generate the password that the server expects, so it has to be done manually. You have 2 choices for how to set up the passwords in the config file.
Note: Nomachine has released the algorithm it uses to scramble passwords in the config files. It needs to be stripped of the Qt specific code and merged into moznx. I have not done it yet so I am looking for volunteers. The code is in the nomachine knowledge base. Once this is done, the nomachine config files will work with moznx without changes (other than VNC servers).
Option 1 - Clear passwords (required for FreeNX, compatible with Nomachine server):
To enter your password in clear text in the config file, you can add the ClearPassword tag in the config file as indicated below:
<group name="Login" >
<option key="ClearPassword" value="your password" />
<option key="User" value="the user" />
</group>
Option 2 - Hashed Passwords:
There is support in the nomachine server for hased passwords. I created the nxpassgen utility to generate it. Just execute the utility. It will ask for the NX username and password. In the configuration file, in the Login group, add an entry for the password. It should look like this:
<group name="Login" >
<option key="Password" value="password from nxpassgen" />
<option key="User" value="the user" />
</group>
One other thing is that the Server expects the VNC password to be in plaintext. NXClient encrypts it and I did not write the code into the plugin to decrypt it. So if you are setting up a vnc server, you have to write the password in plain text (obviously this is something I want to chage). It goes here:
<group name="VNC Session" >
<option key="Display" value=":0" />
<option key="Password" value=" replace the encrypted password with clear text password" />
<option key="Remember" value="true" />
<option key="Server" value="vnc server" />
</group>
Using moznx
To demonstrate how moznx works, you can use the test page:
- open mozilla and open test.html
- The page should contain an install link and a list of your configuration files. Click on the install link to install the plugin.
- Now you can click on a configuration. You should begin to see messages at the top of the screen indicating that the client is connecting to the server. If all goes well, the NX window will launch with your new session.
Windows
The windows install is also here. You can download it into the same directory with the moznx.xpi and access it from the test page.
Note: If you have already installed the nomachine client on your machine and you use the plugin installer, it will overwrite your nomachine binary files. This shouldn't really be a problem, but if you do not want to you can follow the instructions below.
- Follow the instructions above to install the demo application
- Install the nomachine client for Windows in the usual place
- download the windows plugin xpi file here
- Find the plugin directory for your browser (for example c:\Program Files\Mozilla Firefox\plugins) unzip the 2 dlls from the xpi file into this directory
Parameters
With version 0.2 and above, there are now optional parameters that will allow you to configure the way that moznx works. The parameters are set in the standard way:
<embed src='test.conf' type='application/x-nx' width='500' height='400' postback_session='postback.pl' postback_target='someframe' session_name='work server 1' restore_session_id='KJFHSJFSD9878957'>
The table below gives the definitions of the different parameters:
| Parameter |
Description |
| postback_url |
If you provide this parameter, this url will be called with a get to give you feedback on your session. The data is appended to your url. There are 3 scenarios where the callback is called:
- op=postsessionid&sessionid={the session id}. Once a session id is established, it will be sent to your url
- op=postconnected. The url will be called when the negotiation is completed successfully
- op=posterror&errordesc= {the error description}. If an error occurs it is sent to the url
I use these postbacks in the portal I am developing to keep track of the sessoin status. Note: A postback_target must also be specified for this parameter to work. |
| postback_target |
This is the name of a frame. When the postback_url is called, the output will be directed to this frame (I use a hidden frame). |
| session_name |
This parameter allows you to give a name to the session. If it is not set it will use the path to the temp file where the configuration file is stored. The session name is usually the same as the config file name in the commercial client. The name is important because the server will try and match up the name with suspended sessions and will restore the suspended session instead of giving you a new one if the session names match. |
| restore_session_id |
If this parameter is set to a valid session id, then the requested session will be restored |
Documentation
I have finally written out my notes and created some documentation on the NX Protocol. I have posted them to the FreeNX and NX Developers mailing lists, but I am posting them here as well. Hopefully this will be just the beginning of better documentation for this and other NX projects.
Source
The source for moznx can be downloaded here.
However, building it can be a little tricky. I will give some basic instructions, but feel free to contact me if you need help building.
For Linux
- Download the Seamonkey source tree from mozilla.org and build it
- go to the following subdirectory: mozilla/modules/plugins/tools/sdk/samples
- unzip the source into that directory
- An nx subdirectory should be created
- build the nx/nxcompsh directory first, then the moznx subdirectory
- the end result is the libnpmoznx.so
For Windows
- Buy Visual C++ 6.0 :(
- unzip the source
- Get the expat libraries for windows from here and unzip them into the nx directory
- Get the pthread libraries for windows from here and unzip them into the nx directory
- Use the moznx workspace to build all the libraries. Only the debug target is set up correctly.
- Because I was too lazy to figure out how to statically link the pthread library, you have to copy both the npmoznx.dll and the pthreadVC1.dll into the plugin directory for it to work
Troubleshooting
Here are a few things that may go wrong:
- The install fails or the plugin does not load correctly on linux. Go to your plugins directly (~/.mozilla/plugins) and type: ldd libnpmoznx.so. This will tell you if all of the dependencies are met and loading properly.
- The web application does not work right. Check the permissions on the moznxdemo.pl file and make sure it is executable. Also, check the web server log files for error messages. You can try and execute it directly from the console and see if it produces the expected output
- The list of configuration files does not show up. The program expects the html directory to be in cgi-bin/../html/. If this is not right, you have to change the $webdir variable in the moznxdemo.pl. From the cgi-bin, type ls ../html/nxconf/<nx user name>/*.conf. If nothing shows up, then the program will not be able to find the configuration files
- The puzzle piece shows up when you click on the configuration link. Some versions of the browser require a restart for the plugin to load. Try restarting. Also, review the browser's install log file to see if there is an error.
- The plugin appears to be installed correctly, but it displays some meaningless messages and never launches the server. In Linux, run the browser from the console so you can see the plugin's output. Note that some version of Mozilla send stdout to dev/null. Running mozilla -p default seems to work. In Windows, there will be a file in your mozilla or firefox program directory called output.txt. This has some slightly useful debug information in it
email me if you have questions, or try the nxdeveloper or FreeNX mailing lists.