Pages

Kamis, 17 Mei 2012

Set up a free and secure Terminal Server with Linux


Takeaway: Jack Wallen suggests ditching the Windows Terminal Server and migrating to using a Linux box. Learn how to set up and use NX Free, a tool that can help with this task.
I have worked with a lot of clients who require Terminal Server. Many of these clients use the Terminal Server as a way to centralize application and file hosting. Many of them wind up paying a lot of money for Windows Terminal Server (and the necessary licensing) to see their users only firing up email, office suites, and maybe on occasion a specialized piece of software or financial software. A quick way to save your company cash is to ditch the Windows Terminal Server and migrate to using a Linux box.
On some levels, this is an incredibly easy task. Linux is already a multi-user operating system that allows for more than one user to be logged in at a time, so any user who has an account on a machine can have access to that machine. Although most modern Linux desktops make it a breeze to share out a desktop, that’s not the route we want to take — what we want is a system that will allow any user on a system to log in remotely and securely. If you’ve done any admin work with Linux, you know you can tunnel X11 (graphical applications) through secure shell. This is a secure method, but not a method you can take advantage of for everyday users. Fortunately, there’s a free tool by NoMachine called NX Free that can connect to a complete remote desktop session through ssh (secure shell).
Note: The free version of the application used here for the vnc server has a limitation of only two users. If you have a need for more than two users, you can purchase the premium edition of the software or look to other options such as TightVNCxrdp, or vncserver. Although these servers aren’t as easy to set up as NXFree, you will enjoy unlimited users at no cost.

Software and users

Before we get into the setup and usage of NX Free, let’s discuss the server’s setup. The first thing you should know is remote users will be able to use any user-level software on the machine. So, if there is software you don’t want remote users to access (such as games), remove it. Since we are dealing with a different platform, there might be software that doesn’t run natively. For those applications, I recommend running them with the help of Wine. The software capable of running under this tool is fairly significant.
Although ssh is a very secure protocol, when dealing with multiple users logging on and with the possibility of critical or sensitive data involved, you will want an added layer of security on the remote connections. I recommend installing Fail2ban; this will block IP addresses that show signs of malicious activity (such as too many unsuccessful login attempts or exploits).
You should make sure that every user who needs to get onto the machine has an account, a home directory, and a strong password. Setting up the user accounts is simple — and is also where I veer away from the traditional school of thought with UNIX/Linux terminal servers. I recommend setting up your Terminal Server with a graphical front end because every aspect of the Terminal Server will be much easier to maintain. You will have all the GUI tools you need to set up users, software, security, printing, etc.

Installing NX Free Server and Client

Download the NX Free server for Linux that matches your package management system (.rpm or .deb), and then install it with the following command (I will demonstrate on a Ubuntu machine — the installation on an .rpm-based machine will be different):
sudo dpkg -i nxserver_XXX_ZZZ.deb
XXX is the release number, and ZZZ is the architecture (i386 or x64).
If you’re installing on an .rpm-based machine, the command (to be run as the root user) is:
rpm -ivh nxserver_XXX_ZZZ.rpm
XXX is the release number, and ZZZ is the architecture (i386 or x64).
Once installed, the server will be up and running and ready for connections. All that is left is to install the client and connect.
Let’s connect to the new Linux Terminal Server from a Windows 7 machine. To do this, you must install the NX Client for Windows. After the client is installed, you can start it up by going to Start | All Programs | NX Client For Windows | NX Connection Wizard. When this tool starts up, you are ready to set up the connection.

Setting up the connection

This step should be done on all client machines that need to connect to the Terminal Server. When you fire up the Connection Wizard, you will be able to define the options necessary to connect to the server. I will assume you have the server set up on a static IP address.
The first screen of the wizard is the welcome screen. Click Next to move to the first interactive screen (Figure A).
Figure A
You can select the speed of your connection by dragging the slider to the associated type.
In the first screen, enter a human readable name for the Session and the address of the Terminal Server in the host. Leave the port set at the default and click Next.
The next screen allows you to specify the desktop settings (Figure B). From here, you can select:
  • Platform type: You’ll want to select Unix
  • Desktop type: KDE, GNOME, CDE, XDM, or Custom
  • Size of the desktop: This will depend upon your screen size
Figure B
You can disable encryption, but that would defeat the security of the system.
If you select Custom for the desktop type, you will need to configure the following (Figure C):
  • Application: Console, Default X script, or custom script
  • Options: Floating window or new virtual desktop
Figure C
Some configurations will not allow you to customize the size of the remote desktop.
Click the Next button to continue to the final screen.
The last step asks if you want a desktop icon for the connection and if you want to set up the advanced configuration dialog. The advanced configuration allows you to set up the following:
  • Network options (such as proxy)
  • System settings (such as grabbing the keyboard when client has focus)
  • Printing (enable local printing)
  • Environment (such as the mapping the local directory and font server)
You will be presented with the login window (Figure D). Enter a user’s credentials and once authentication has succeeded you will presented with the Terminal Server window. The user can now perform their duties as if they were logged on directly to the remote machine.
Figure D
You can have multiple sessions set up and then select which one you want to connect to (allowing you to use one NX Client for multiple connections).

Bottom line

This Terminal Server might not offer you everything you need (if you need QuickBooks, you better look the other way), but it is a solution that can work in many situations. Give this a try before you spend money on Microsoft Terminal Server and the necessary CALS.