pki.pl - Public Key Infrastructure Configuration
./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]
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:
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.
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:
This script requires the following modules and libraries:
sshpasswdcommand must be installed. See http://sourceforge.net/projects/sshpass/
Eduardo Segredo Gonzalez <firstname.lastname@example.org> and Casiano Rodriguez Leon <email@example.com>
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 (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.