LINUXsecure_LOGO
Issues on Linux and Security
 
-->
 
 
 
 
 
 
 
home
button Protection --> SSH
 

Just under construction, version 0.1, last update 2003/01/20

Secure Shell (SSH)

Contents
  1. What is Secure Shell?
  2. Basic Client Usage
  3. Public-Key Authentication
  4. Portforwarding

What is Secure Shell?

SSH (Secure Shell) is a low-cost, software based solution to network security. It can solve some of the privacy and security problems arising, when transfering data (data, commands etc.) through a network. Additionally, it can be seen as a secure replacement for telnet, ftp, and the R-commands, services that are often used for remote administration of active network components (routers, switches, firewalls, etc.) and servers.

The main features of SSH are:

  • A secure, client-server protocol for encrypting and transmitting data over a network.
  • Authentification of users by password, host, or public key, and optional integration with other popular authetification systems like Kerberos etc.
  • The SSH protocol garantees, that the data, traveling over the network, arrives unaltered.
  • Tunneling of most other popular, TCP/IP based services, that are insecure. This is called port forwarding.

There are two SSH protocols in use. Namely SSH protocol version 1 and 2. The second version offers an enhancement in security, so it is better to use SSH version 2, if possible.

Basic Client Usage

For Windows you can get graphical clients. Under Linux you will normally use a shell, and so you will make a SSH connection from there. To connect to a server via SSH, you have to type:

ssh -l <username> <server name or ip adress>

Example 1 shows an successful connection and login to linuxsecure.de

Example 1: Using ssh
$ ssh -l nikolei linuxsecure.de
nikolei@linuxsecure.de's password:
Last login: Mon Jan 20 12:39:01 2003 from 168.1.1.10
[nikolei@linuxsecure nikolei]$

If you have not exanged a public key with the server, then you will be asked for a password. After a successful login, a shell is offered to you.

It is also possible to use ssh as a secure replacement for ftp. Uder Windows you have a graphical Explorer-like interface with drag and drop abilities. Under linux you can use the command line program scp, offering a higher flexibility. To use scp under linux type:

scp [options] <user>@<server name or ip adress>:<source> <user>@<server name or ip adress>:<destination>

Example 2 shows how to copy a file foo in the current directory on your machine (the machine you are logged in) to a server called linuxsecure.de into the directory bar in your home directory.

Example 2: Using scp
$ scp foo nikolei@linuxsecure.de:/home/nikolei/bar
nikolei@linuxsecure.de's password:
foo 100% |*****************************| 100 00:01
$

You will be prompted for a password. If the password is correct, the file will be copied to the server. By using wildcards or the option -r you can copy several files at once or hole directories recoursively to an other server. The option -C enables compression.

If you want to use ssh in the same way as the command line ftp for file transfer, then sftp may be of interest for you. It is, like ftp, interaktive. This means, that you have to log in to a remote machine. A command line then accepts, after successful login, commands for file transfer. For example:

sftp <user>@<host>

The username is optional. If no username is given (then you also have to remove the @ sign), your username (on the machine you are working on, is assumed). As an example to log into the machine linuxsecure.de with username nikolei see Example 3.

Example 3: Using sftp
$ sftp nikolei@linuxsecure.de
Connecting to linuxsecure.de...
nikolei@linuxsecure.de's password:
sftp>

Then you can use the well known commands get and put for filetransfer.

These are the basics you need to work with ssh. There are much more options, but I will only present some of them I find most useful.

Public-Key Authentication

Instead of password-authentication you can use public-key authentication that is more secure and - in use with an SSH-agent - also more comfortable, if you have to manage a lot of servers via SSH. The idea is to generate two cryptographic keys, a public one and a private one. The public key can be stored on the ssh-servers and the private one is helt by the user. If you want to use public key authentication, it is best to disable all other authentication mechanisms in order to provide best security. The key-pair that is used should be long enough and stored in a way, so that others do not have access to it. Otherwise the authentication-mechanism can not said to be secure any more.

So what we need first is a sshd configuration, allowing only public-key authetication. In the following exaple I am using a configuration file for OpenSSH:

Example 4: OpenSSH Config
Port 61524
Protocol 2
ListenAddress 126.15.160.52
AllowUsers nikolei
PermitRootLogin no
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys2
# override default of no subsystems
Subsystem sftp /usr/lib/misc/sftp-server

To explain the configuration line by line:

  1. Port 61524: The ssh server will listen on port 61524. Because that is not the default port of SSH, it will be harder to detect by portscanners.
  2. Protocol 2: Here I chose the more secure version 2 of the SSH protocol.
  3. ListenAddress 126.15.160.52: The ip-address, the server is listen on (relevant if more than one interface exists).
  4. AllowUsers nikolei: Allow only login of user nikolei.
  5. PermitRootLogin no: Root will not be allowed to login.
  6. RSAAuthentication yes: Use of RSA-keys.
  7. PubkeyAuthentication yes: Use of public-key authentication.
  8. AuthorizedKeysFile .ssh/authorized_keys2: Location of the file containing the public-key (in the home directory of every user).
  9. Subsystem sftp /usr/lib/misc/sftp-server: Our nice sftp-facility.

The next thing we have to do is to generate our RSA-keys (in this example 2048 bit keys):

Example 5: Generating RSA-Keys
$ ssh-keygen -t rsa -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/nikolei/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /nikolei/.ssh/id_rsa.
Your public key has been saved in /nikolei/.ssh/id_rsa.pub.
The key fingerprint is:
8e:c6:3f:de:b7:5e:9a:4c:6d:b9:6b:9d:c7:a8:6f:27 nikolei@linux
$

The private key ist stored in id_rsa and public one inb id_rsa.pub. The last thing that is left is to copy the file containing the public key (~/.ssh/id_rsa.pub) to the file ~/.ssh/autherized_keys2 on the server you want to login. Because you have used another than the standard port for SSH, you have to tell your ssh-client to use the non-standard port.

If you have provided a password during RSA-key generation (this password sould be different from your system password!), then your private key is secured, but you are ask for it, when using ssh. And don't forget to make your private key only readable for you using chmod!

Portforwarding

One of SSH's major benefits is transparency.A terminal session secured by SSH behaves like an ordinary, insecure one, once it has been established. Behind the scenes, SSH keeps the session secire via strong authentification, encryption, and integrity checking.

If you are using SSH Portforwarding to secure another application, then SSH intercepts the service request from this application, sends it across the encrypted connection, and delivers it to the intendet recipient on the other side.

To be continued ...


back to top

button Whats New
[2005-02-18] mp3riot version 1.3 released
[2004-10-08] mp3riot version 1.2 is out.
[2004-04-30] Added section Bridging
[2004-01-09] working progress on mp3riot version 1.2
The LWN.net Weekly Edition for September 9, 2010 is available.
[$] LWN.net Weekly Edition for September 9, 2010

The Mozilla project has released firefox 3.6.9 and 3.5.12and SeaMonkey 2.0.7. These updates fix a relatively long list of scary security problems; the firefox 3.6.9 update also add support for X-Frame-Options, which can be used by web sites to prevent their content from being trapped inside another site's frames.
Firefox and SeaMonkey updates released

Debianhas updated typo3-src(fix regression from previous update), freetype(multiple vulnerabilities), and xulrunner(multiple vulnerabilities). Gentoohas updated sarg(buffer overflows - vulnerability from 2008), acroread(multiple vulnerabilities), and clamav(multiple vulnerabilities). openSUSEhas updated kernel(multiple vulnerabilities) and sudo(local privilege escalation). Red Hathas updated seamonkey(RHEL3-4: multiple vulnerabilities), firefox(RHEL4-5: multiple vulnerabilities), and thunderbird(RHEL4-5: multiple vulnerabilities). SUSEhas updated kernel(multiple vulnerabilities). Ubuntuhas updated lftp(remote file creation).
Wednesday's security updates

The second alpha version of the revised Mozilla Public Licensehas been posted; the text has been annotated to make it relatively easy to see what has been changed. "The most significant change in this draft is the patent language. We have made it easier to read but also, we hope, better at protecting communities who choose to use the MPL. It should also have the side effect of making the license Apache-compatible, allowing projects licensed under the next MPL release to include Apache-licensed code in their code bases."
Mozilla Public License Alpha 2

The Mozilla Labs Gaming project has announced its existence. "Modern Open Web technologies introduced a complete stack of technologies such as Open Video, audio, WebGL, touch events, device orientation, geo location, and fast JavaScript engines which make it possible to build complex (and not so complex) games on the Web. With these technologies being delivered through modern browsers today, the time is ripe for pushing the platform. And what better way than through games?"The project is starting with a competitionto see who can build the best web-based game.
Mozilla Labs Gaming launches

Microsoft's CodePlex foundationCodePlex.com has announcedthe donation of $25,000 to support the development of the Mercurial source code management system. "While Team Foundation Server is still the most used version control system on CodePlex, our users are clearly benefiting from having access to Mercurial for their open source projects. The CodePlex team is happy to be able to offer our community of more than 17,000 projects a choice. With Mercurial as an important feature of CodePlex, we are excited to be making this donation to help support the Mercurial project."
CodePlex.com donates $25,000 to Mercurial project

Mozilla has released Thunderbird 3.1.3 and Thunderbird 3.0.7 with security and stability updates. See the release notes for details (3.1.3and 3.0.7).
Thunderbird 3.1.3 and 3.0.7 security updates now available

Watching Ubuntu and Fedora development is something like watching episodes of Iron Chef: Given roughly the same ingredients and the same amount of time, the two projects produce vastly different dishes. The Fedora 14 and Ubuntu 10.10 release cycle is particularly pronounced in this regard, with Ubuntu's focus largely on refining improvements from 10.04 and Fedora introducing major changes to the infrastructure. Subscribers can click below for the full story from this week's Distributions page.
[$] Looking at Fedora 14 and Ubuntu 10.10

Debianhas updated quagga(denial of service). Gentoohas updated maildrop(privilege escalation) and sudo(privilege escalation). openSUSEhas updated xorg-x11-server(privilege escalation). Red Hathas updated sudo(privilege escalation), kernel(RHEL 4, RHEL 4.7: privilege escalation), and rpm(RHEL 4, RHEL 5: privilege escalation). Ubuntuhas updated sudo(privilege escalation).
Security advisories for Tuesday

Your editor had the good fortune to be able to attend the first LinuxCon Brazil event, held in São Paulo. There were a number of interesting talks to be seen, presented by speakers from Brazil and far beyond. This article will cover three in particular (by Jane Silber, Vinod Kutty, and Jon 'Maddog' Hall) which were interesting as a result of the very different views they gave on how Linux users work with their systems.
[$] LC Brazil: Consumers, experts, or admins?

The 1.10.0 release of the Cairo graphics library has finally been released. "One of the more interesting departures for cairo for this release is the inclusion of a tracing utility, cairo-trace. cairo-trace generates a human-readable, replayable, compact representation of the sequences of drawing commands made by an application. This can be used to inspecting applications to understand issues and as a means for profiling real-world usage of cairo."The profiling feature has evidently been used to improve performance in a number of areas. There is also improved printing support, better 16-bit buffer support, and better use of hardware acceleration.
Cairo 1.10.0 available

Martin Graesslin looksat problems with the interaction between KWin and some graphics drivers. "Now that I have explained all our checks we did to ensure a smooth user experience, I want to explain how it could happen that there are regressions in 4.5. In 4.5 we introduced two new features which require OpenGL Shaders: the blur effect and the lanczos filter. Both are not hard requirements. Blur effect can easily be turned off by disabling the effect and the lanczos filter is controlled by the general effect level settings which is also used for Plasma and Oxygen animations. Both new features check for the required extensions and get only activated iff the driver claims support for it. So everything should be fine, shouldn't it? Apparently not when it comes to the free graphics drivers (please note and remember: we do not see such problems with the proprietary NVIDIA driver!)."(Thanks to Jos Poortvliet)
Graesslin: Driver dilemma in KDE workspaces 4.5

Debianhas updated smbind(sql injection). Fedorahas updated pam_mount(F13, F12: arbitrary code execution), libhx(F13, F12: arbitrary code execution), F13: python(multiple vulnerabilities), and F12: sblim-sfcb(arbitrary code execution). Mandrivahas updated lvm2(privilege escalation). Pardushas updated phpmyadmin(cross-site scripting) and mysql(multiple vulnerabilities).
Monday's security updates

Fedora will be holding a Systemd test dayon September 7, 2010. "This week's Test Day, which will take place on Tuesday 2010/09/07 rather than the more usual Thursday, is on systemd, so it's a very important one! It will also serve at least two functions: as usual, the testing will help us to improve the code so that if it does go into the final Fedora 14 release it will work as well as possible, but the Fedora steering committee will also be using the results of the Test Day to help inform their final decision as to whether to go ahead with systemd for the Beta and final release, or whether to revert to upstart. So there's a lot riding on this Test Day."
Systemd Test Day on Tuesday 2010/09/07

Version 7.2 of the GDB debugger is out. New features include support for the D language, some C++ improvements, better Python support, better tracepoint support, and more; see the announcement for the details.
GDB 7.2 released

Linux Kernel 'snd_seq_oss_open()' Multiple Local Memory Corruption Vulnerabilities
Vuln: Linux Kernel 'snd_seq_oss_open()' Multiple Local Memory Corruption Vulnerabilities

EMC Celerra Unified Storage Platform NAS Security Bypass Vulnerability
Vuln: EMC Celerra Unified Storage Platform NAS Security Bypass Vulnerability

Wireshark 0.8.20 through 1.2.8 Multiple Vulnerabilities
Vuln: Wireshark 0.8.20 through 1.2.8 Multiple Vulnerabilities

Wireshark DOCSIS Dissector Denial of Service Vulnerability
Vuln: Wireshark DOCSIS Dissector Denial of Service Vulnerability

ESA-2010-015: EMC Celerra NFS authentication bypass vulnerability using IP spoofing.
Bugtraq: ESA-2010-015: EMC Celerra NFS authentication bypass vulnerability using IP spoofing.

[USN-985-1] mountall vulnerability
Bugtraq: [USN-985-1] mountall vulnerability

ESA-2010-016: RSA, The Security Division of EMC, releases security hot fix for a potential vulnerability in RSAŽ Access Manager Agent when working with RSAŽ Adaptive Authentication.
Bugtraq: ESA-2010-016: RSA, The Security Division of EMC, releases security hot fix for a potential vulnerability in RSAŽ Access Manager Agent when working with RSAŽ Adaptive Authentication.

ESA-2010-014: RSA, The Security Division of EMC, releases security hot fixes for potential vulnerability in RSAŽ Access Manager Server under certain conditions.
Bugtraq: ESA-2010-014: RSA, The Security Division of EMC, releases security hot fixes for potential vulnerability in RSAŽ Access Manager Server under certain conditions.

News, Infocus, Columns, Vulnerabilities, Bugtraq ...
More rss feeds from SecurityFocus

-->