App-Validation-Automation

 view release on metacpan or  search on metacpan

lib/App/Validation/Automation.pm  view on Meta::CPAN

            }
            else {
                $self->log($msg.$self->unix_msg);
                confess $msg.$self->unix_msg;
            }
        },
        AUTHENTICATION_FAILURE => sub {
            $self->log(
                $self->web_msg."Incorrect Credentials... Exiting!"
            );
            confess $self->web_msg."Incorrect Credentials... Exiting!";
        },
        MISSDIRECTED           => sub {
            $msg = $url." : Inaccessible\nError : ".$self->web_msg;
            $self->log( $msg );
            $self->clear_web_msg;
        },
        SUCCESS                => sub { $self->log("$url : OK"); },
    };

    return $actions;

}


sub _trim_spaces {

    my $self = shift;
    my $line = shift;

    $line    =~ s/^\s+//;
    $line    =~ s/\s+$//;

    return $line;

}

=head1 HOWTO

=head2 Generate Public/Private key pairs for SSH

ssh-keygen is used to generate that Public/Private key pair:

user@localhost>ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/user/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/user/.ssh/id_rsa.

Your public key has been saved in /home/user/.ssh/id_rsa.pub.

The key fingerprint is:
f6:61:a8:27:35:cf:4c:6d:13:22:70:cf:4c:c8:a0:23 user@localhost

The command ssh-keygen -t rsa initiated the creation of the key pair.Adding a passphrase is not required so just press enter.The private key gets saved in .ssh/id_rsa. This file is read-only and only for you. No one else must see the content of that ...

Create .ssh dir on remote host(The dir may already exist,No issues):

user@localhost>ssh user@remotehost mkdir -p .ssh
user@remotehost's password: 

Append user's new public key to user@remotehost : .ssh/authorized_keys and enter user's password:

user@localhost>cat .ssh/id_rsa.pub | ssh user@remotehost 'cat >> .ssh/authorized_keys'
user@remotehost's password:

Test login without password:

user@localhost>ssh user@remotehost
user@remotehost>hostname

remotehost

=head2 Use configuration file

App::Validation::Automation is driven by a tunable configuration file.The configuration file is in Windows .ini format.The wrapper script using App::Validation::Automation needs to either read the configuration file or build the configuration itself....

Example:

[COMMON]

#User to login into Web links

USER = web_user           

#Common User to login into remote host

REMOTE_USER = user        

#Post link MAX_REQ no of times, used while testing Load
#Balancing and DNS round robin functionality

MAX_REQ = 10              
                         
#Minimum distinct redirected uris to ascertain Load Balancing
#and DNS round robin is working fine

MIN_UNQ = 2

#Log file extension

LOG_EXTN = log            

#Print SSH debugging info to STDOUT

DEBUG_SSH  = 1        

#Try SSH2 protocol first and then SSH1

SSH_PROTO  = '2,1'

#Private keys for each server(AA,KA...) used for SSH

ID_RSA = /home/user/.ssh/id_rsa_AA,/home/user/.ssh/id_rsa_KA



( run in 1.987 second using v1.01-cache-2.11-cpan-6aa56a78535 )