Wednesday, January 10, 2007

Using public keys for SSH authentication

Source taken from http://www.putty.nl/0.58/htmldoc/Chapter8.html#pubkey

Public key authentication - an introduction

Public key authentication is an alternative means of identifying yourself to a login server, instead of typing a password. It is more secure and more flexible, but more difficult to set up.

In conventional password authentication, you prove you are who you claim to be by proving that you know the correct password. The only way to prove you know the password is to tell the server what you think the password is. This means that if the server has been hacked, or spoofed (see section 2.2), an attacker can learn your password.

Public key authentication solves this problem. You generate a key pair, consisting of a public key (which everybody is allowed to know) and a private key (which you keep secret and do not give to anybody). The private key is able to generate signatures. A signature created using your private key cannot be forged by anybody who does not have that key; but anybody who has your public key can verify that a particular signature is genuine.

So you generate a key pair on your own computer, and you copy the public key to the server. Then, when the server asks you to prove who you are, PuTTY can generate a signature using your private key. The server can verify that signature (since it has your public key) and allow you to log in. Now if the server is hacked or spoofed, the attacker does not gain your private key or password; they only gain one signature. And signatures cannot be re-used, so they have gained nothing.

There is a problem with this: if your private key is stored unprotected on your own computer, then anybody who gains access to that will be able to generate signatures as if they were you. So they will be able to log in to your server under your account. For this reason, your private key is usually encrypted when it is stored on your local machine, using a passphrase of your choice. In order to generate a signature, PuTTY must decrypt the key, so you have to type your passphrase.

This can make public-key authentication less convenient than password authentication: every time you log in to the server, instead of typing a short password, you have to type a longer passphrase. One solution to this is to use an authentication agent, a separate program which holds decrypted private keys and generates signatures on request. PuTTY's authentication agent is called Pageant. When you begin a Windows session, you start Pageant and load your private key into it (typing your passphrase once). For the rest of your session, you can start PuTTY any number of times and Pageant will automatically generate signatures without you having to do anything. When you close your Windows session, Pageant shuts down, without ever having stored your decrypted private key on disk. Many people feel this is a good compromise between security and convenience. See chapter 9 for further details.

There is more than one public-key algorithm available. The most common is RSA, but others exist, notably DSA (otherwise known as DSS), the USA's federal Digital Signature Standard. The key types supported by PuTTY are described in section 8.2.2.

For Unix, what are ssh-agent and ssh-add, and how do I use them?

Source taken from http://kb.iu.edu/data/aeww.html

In Unix, ssh-agent is a background program that handles passwords for SSH private keys. The ssh-add command prompts the user for a private key password and adds it to the list maintained by ssh-agent. Once you add a password to ssh-agent, you will not be prompted for it when using SSH or scp to connect to hosts with your public key.

To use ssh-agent and ssh-add, follow the steps below:

  1. At the Unix prompt, enter: eval `ssh-agent` Note: Make sure you use the backquote ( ` ), located under the tilde ( ~ ), rather than the single quote ( ' ).

  2. Enter the command: ssh-add
  3. Enter your private key password.

  4. When you log out, enter the command: kill $SSH_AGENT_PID To run this command automatically when you log out, place it in your .logout file (if you are using csh or tcsh) or your .bash_logout file (if you are using bash).

Note: The versions of these programs for SSH2, ssh-agent2 and ssh-add2, are the same as outlined above. To use them, follow the instructions above, replacing all occurrences of ssh-agent with ssh-agent2 , and ssh-add with ssh-add2 . The SSH2 versions will only work if both your computer and the remote host are running SSH2.

Sunday, December 17, 2006

How to find the correct map between SAN's LUN and logical drive in AIX

Last week, I learned new command how to find the correct map between SAN's LUN and logical drive in the AIX system.

# fget_config -Av

It will shows Logical UNIT of SAN mapped to correct hdisk in the system. So, if we plan to rebuild the LUN, make sure remove all related hdisk / file system in the system, same as the replacing local disk procedures.

Sunday, December 10, 2006

Understanding Certificate Life Cycle and Key Management

I have completed learning on topic "Understanding Certificate Life Cycle and Key Management". Below are the summery of this topic:
  • The key life cycle of a certificate is broken into seven distinct stages: certificate enrollment, certificate distribution, certificate validation, certificate revocation, certificate renewal, certificate destruction, and certificate auditing.

  • During certificate enrollment, a user requests a certificate from a CA.

  • Once the CA is satisfied with the credentials presented by the user requesting the certificate, the CA distributes the certificate to the user.

  • If anything occurs before the expiration of the certificate that warrants the cancellation of the certificate, it is added to the CA's certificate revocation list (CRL).

  • If the certificate is not revoked and reaches the expiration date, it can be renewed.

  • To better manage and control certificates, CAs track various events, such as creations, revocations, renewals, and in some cases, successful usage.


Saturday, December 9, 2006

Fibre Channel Path check on AIX

I learned new command how to check SAN connectivity from UNIX box. The command is:

# datapath query device

It this command successfully execute, it will show the output something look like this:

Total Devices : 2


DEV#: 0 DEVICE NAME: vpath0 TYPE: 2105800 POLICY: Optimized
SERIAL: 07028305
==========================================================================
Path# Adapter/Hard Disk State Mode Select Errors
0 fscsi0/hdisk4 DEAD NORMAL 1336 0
1 fscsi0/hdisk6 OPEN NORMAL 3944 0

DEV#: 1 DEVICE NAME: vpath1 TYPE: 2105800 POLICY: Optimized
SERIAL: 50A28305
==========================================================================
Path# Adapter/Hard Disk State Mode Select Errors
0 fscsi0/hdisk5 DEAD NORMAL 29948 1
1 fscsi0/hdisk7 OPEN NORMAL 74165 0

Saturday, December 2, 2006

AIX tips

I learned how the fastest way to run concurrent diag on known specific device. Below is the example of the command:

# diag -d ent0

Then, select problem determination and it will start to examine the device.

Understanding CA Trust Models

Today, I just finished self-studying on topic "Understanding CA Trust Models" and below are lesson summary:

-To create a scalable solution, you have to design a CA architecture so that CAs can validate certificates issued by other CAs by establishing trusts between CAs.

-Trusts are established between CAs by having each CA issue a certificate to the other CA.

-With mesh trust architectures, all CAs issue certificates for all other CAs. This provides multiple trust paths that can be used for certificate validation.

-Hierarchical trusts establish a top-level CA known as a root CA. Subordinate CAs can be created below that. All users issued certificates in the hierarchy know the root CA, so certificate validation across multiple arms of the hierarchical structure validate through the root CA.

-Bridge CAs connect mesh and hierarchical architectures together. They do not issue certificates to end users, only to other CAs.