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:

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:

February 6, 2005 - moznx 0.2 has now been released. Notable updates include:

Disclaimer

The current version of moznx is an Alpha release. Some important things to note:

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

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:

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.

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

  1. Download the Seamonkey source tree from mozilla.org and build it
  2. go to the following subdirectory: mozilla/modules/plugins/tools/sdk/samples
  3. unzip the source into that directory
  4. An nx subdirectory should be created
  5. build the nx/nxcompsh directory first, then the moznx subdirectory
  6. the end result is the libnpmoznx.so

For Windows

  1. Buy Visual C++ 6.0 :(
  2. unzip the source
  3. Get the expat libraries for windows from here and unzip them into the nx directory
  4. Get the pthread libraries for windows from here and unzip them into the nx directory
  5. Use the moznx workspace to build all the libraries. Only the debug target is set up correctly.
  6. 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:

email me if you have questions, or try the nxdeveloper or FreeNX mailing lists.