![]() |
|
|||||||||||||||
|
||||||||||||||||
|
| CVS via OpenSSH tunneling | ||||
| For WebSphere Developers on the Microsoft Windows Platform
SSH tunneling provides a secure manner to access CVS repositories. Learn how to install the Cygwin open source OpenSSH provides a secure mechanism for WebSphere Application Server developers on the Microsoft Windows platform. Introduction Solving these challenges, without spending a fortune on expensive hardware or software, was the next step. Obviously this meant taking a good long look at available open technologies. This paper on our solution to the problem: Setting up an OpenSSH tunnel using the open source Cygwin package for secure, remote access of a CVS repository. Installing the Cygwin distribution The Cygwin setup (see Figure 1) window provides a list of the various packages that can be installed. First, you want to click on the "View" button in the upper right hand corner until you see the "Full" view that is shown here. Each package that you want to include requires that you click on the yellow highlighted area until the version number appears. Unfortunately in this screen shot I already have the OpenSSH package installed and it is showing the previous version as a candidate for installation. At any rate, you want to keep clicking in this area of the window until the latest version number appears. Additionally, if you click on the box to the right of the version number you will also download the source for that package. A nice thing about the Cygwin install is that any package dependencies are automatically installed too. While you will not need all the Cygwin packages to run OpenSSH here are the ones I recommend to install:
Leave any dependency packages that Cygwin automatically selects. System environment variables
System environment variables are on the LOWER half of the window. Make sure to add/change variable values there, and not in the top half, which only apply to the logged in user. Once the packages are installed you want to set the following system environment variables. Be sure to set these up as global system environment variables and not as user variables.
By specifying To the PATH system variable add User environment variables Server side configuration
Answer the prompts, keep the default answers unless you have a reason to change them (you probably will not), and make sure that you answer Yes to install as an NT service -- otherwise it will not install as a service and defeat the purpose of having the server configured. Setting up users
Make sure that anytime you create or delete users that you run these commands again -- otherwise you will be out of synch with Windows. Also, you will need to restart the Cygwin Double check that the passwd file contains each user's home directory. Otherwise OpenSSH will complain that it is not able to switch to the user's home directory when they try to run any commands through the OpenSSH tunnel. It's more of an annoyance than anything else.
Note: The Fire up the OpenSSH server Figure 2. Windows 2000 services control panel One problem I had during the installation was that the Cygwin sshd service could not find the Cygwin dll files it needed. This was because the PATH variable, even though I had updated it, had somehow not taken effect. Rebooting the machine solved that problem. Client side configuration System environment variables
Note: There is a whole explanation why the variable is called CVS_RSH and not CVS_SSH and searching www.google.com will satisfy the curiosity of those people. Notwithstanding, this variable is defining that all CVS commands will be run via the OpenSSH tunnel. You should also set the user's environment variable HOME for your local user. Passphrase
These are basically pairs of private/public keys. The public keys have the .pub extension whereas the private keys (in bold) are the same file names without the .pub extension. You need to make sure that you keep your private keys safe otherwise with your private key and your passphrase anyone could masquerade as you through the OpenSSH tunnel to the server. The known_hosts file is generated after you connect for the first time to an OpenSSH server. ssh will download the server's public key the first time you connect through the OpenSSH tunnel. This way, on subsequent connects, the OpenSSH tunnel can ensure that the server you are connected to is indeed the same server and not someone else masquerading as that server. If you ever change the private/public key pairs on the server then all the clients will have to download the public key again before they can connect to your server. This is where a security question arises. During the passphrase prompts if you do not enter a passphrase then the OpenSSH server will use only the certificate files to validate the user. This is handy because you can tunnel pretty seamlessly through the server. You need to make a judgment call on whether users accessing your server require a passphrase for access. So why did I generate all the other private/public key pairs? I don't know -- but I figured it's easier to do it one time than to do it over and over again. Configuring the OpenSSH client
Answer Yes (completely typed out) at Yes/No prompts and enter the passphrase (if you are using one) when prompted. You will generate all the possible private/public key pairs this way. Once that is done you need to move some files to the OpenSSH server. Learning some basic ssh commands
Note: The first time you access an OpenSSH server you will be prompted to get the server's RSA key. Do this so that you automatically verify the server you are connecting to is truly the same server. Therefore to access my server, polozoff.userv.ibm.com, with my username, alex, and list out the root subdirectory I type the following command line:
Since this is the first time I am accessing the OpenSSH server I am prompted for my password. Type that in and the output of the ls / command is displayed. An interesting ssh command for debugging purposes is to use the double -v as such:
which outputs a tremendous amount of interesting trace information of the ssh session. Using the ssh commands you just learned
The actual example of what I typed to run the same commands on hostname=polozoff.userv.ibm.com and username=alex
Make sure to type the last command in correctly, otherwise nothing will work properly. The last command securely copies the authorized_keys2 file to the OpenSSH server. Now, when you execute any ssh commands you should not be queried for your password. Instead, if you defined a passphrase, you will be queried for the passphrase. If you entered a blank passphrase then the server will use the public key files to verify your identification without any user interaction. One thing to note, do not use the authorized_keys file. There are reports of security problems with this file. You will notice that the authorized_keys file is identical to the identity.pub file. They are one and the same. Accessing the same OpenSSH server from multiple client machines
Using CVS
The CVS_RSH variable I discussed earlier on tells CVS that all the CVS commands are to use the ssh tunnel you have set up. The CVSROOT variable is dependent on your particular CVS installation but I have included mine as an example of what to use. Adding VI
Conclusion
| ||||||||||||||||||||||||||||||
| About IBM | Privacy | Terms of use | Contact |