The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

pki.pl - Public Key Infrastructure Configuration

SYNOPSIS

  ./pki.pl -h
  ./pki.pl [-v] -c host_1,host_2,...,host_n
  ./pki.pl [-v] [-s 'ssh-keygen command'] [-k 'ssh-keygen arguments] [-p passphrase] [-t type] [-b bits] [-f key pair filename]
           [-g configuration filename] -c host_1,host_2,...,host_n [-c host1,host2,...,host_n]

DESCRIPTION

This script allows the generation of public/private key pairs, using the ssh-keygen command. Generated public key is copied to a list of remote machines. Specifically, the public key is added, if not exist, in the file $HOME/.ssh/authorized_keys of each remote machine.

The basic execution of the command is as follows:

  ./pki.pl [-v] -c host_1,host_2,...host_n

In this case, a public/private key pair is generated in the local directory $HOME/.ssh/, using the ssh-keygen command, which must be located in some directory included in $PATH. The filenames of the generated public and private keys are grid_cluster_rsa.pub and grid_cluster_rsa, respectively.

By default, generated keys have the following characteristics:

  • Type: RSA

  • Number of bits: 2048

  • No passphrase

Once the public/private key pair has been generated, the public key is copied to remote machines specified by the option -c. This option can be used several times to specify sets of machines with the same password to login. By this way, the copy process of the public key to remote machines is easier.

Each host specified with the option -c, must be configured in a configuration file (man ssh_config). By default, the configuration file is $HOME/.ssh/config. The basic syntax which this script needs is the following:

Host host_1 HostName myHost1.mydomain.com User myUser

Host host_2 HostName myHost2.mydomain.com User anotherUser . . . Host host_n HostName myHostn.mydomain.com User myUser

The behaviour of the script can be modified by the different supported options. These options are exposed in the following section.

OPTIONS

The options allowed by this script can take the same values of the ssh-keygen command (execute man ssh-keygen from shell for more information). The allowed options are the next ones:

  • -h Show the script help.

  • -v Verbose mode.

  • -s ssh-keygen command Provide the ssh-keygen command. By default, 'ssh-keygen'.

  • -k ssh-keygen string Provide an arguments string which is passed to the ssh-keygen command.

  • -p passphrase Provide a passphrase. By default, no passphrase is used.

  • -t type Specify type of key to create. By default, 'RSA' type is specified.

  • -b bits Number of bits in the key to create. By default, 2048 bits are used.

  • -f key pair filename Filename of the key file. By default, $HOME/.ssh/grid_cluster_rsa.

  • -g configuration filename Filename of the configuration file. By default, $HOME/.ssh/config.

  • -c host_1, host_2, ..., host_n Specify a set of machines where the public key has to be installed. This option can be used several times to specify sets of machines which need the same password to login.

DEPENDENCIES

This script requires the following modules and libraries:

AUTHORS

Eduardo Segredo Gonzalez <esegredo@ull.es> and Casiano Rodriguez Leon <casiano@ull.es>

AKNOWLEDGEMENTS

This work has been supported by the EC (FEDER) and the Spanish Ministry of Science and Innovation inside the 'Plan Nacional de I+D+i' with the contract number TIN2008-06491-C04-02.

Also, it has been supported by the Canary Government project number PI2007/015.

The work of Eduardo Segredo was funded by grant FPU-AP2009-0457.

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Eduardo Segredo Gonzalez and Casiano Rodriguez Leon. All rights reserved.

This software is free; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.2 or, at your option, any later version of Perl 5 you may have available.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.