Brian Kelly > Net-FullAuto > Net::FullAuto

Download:
Net-FullAuto-0.9999999999.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.9999999999   Source  

NAME ^

Net::FullAuto - Perl Based Secure Distributed Computing Network Process Automation Utility

NOTE TO USERS ^

Please contact me at my email address -

and let me know of ANY and ALL bugs, issues, problems, questions as well as suggestions for improvements to both the documentation and module itself. I will make every effort to get back to you quickly.

Update the module from CPAN *often* - as I anticipate adding documentation and fixing bugs and making improvements often.

THANKS - and GOOD LUCK with your Net::FullAuto project(s)!

Brian Kelly, August 31, 2012

DISCLAIMER ^

 Beware that this software is provided "as is", and comes
 with no warranty of any kind, either express or implied.
 If you use the contents of this distribution, you do so
 at your own risk, and you agree to free the author(s) of
 any consequences arising from such use, either intended
 or otherwise.

SYNOPSIS ^

use Net::FullAuto;

see METHODS section below

DESCRIPTION ^

Net::FullAuto is a Perl based Secure Distributed Computing Network Process Automation Utility. It's a MOUTHFUL - and it IS everything implied in it's description. Net::FullAuto is a command environent based implementation that truly embodies the term "The Network **IS** the Computer!!"

Net::FullAuto utilizes ssh and sftp (can also use telnet and ftp, though for security reasons, this is NOT recommended) to bring the command enviroments of any number of remote computers (OS of remote computer does not matter), together in **ONE** convenient scripting space. With Net::FullAuto, you write code once, on one computer, and have it execute on multiple computers simultaneously, in an interactive dynamic fashion, AS IF the many computers were truly ONE.

Net::FullAuto is POWERFUL. Net::FullAuto can be run by a user in a Menu driven, interactive mode (using the Term::Menus module - also written by Brian Kelly), OR via UNIX or Windows/Cygwin cron in a fully automated (and secure) fashion.

Example: A user needs to pull data from a database, put it in text file, zip and encrypt it, and then transfer that file to another computer on the other side of the world via the internet - in ONE step, and in a SECURE fashion.

Net::FullAuto is the ANSWER! Assume Net::FullAuto is installed on computer one, the database is on computer two, and the remote computer in China is computer three. When the user types the script using Net::FullAutoNet::FullAuto will connect via ssh AND sftp (simultaneously) to computer two, and via sftp to computer three. Using an sql command utility on computer two, data can be extracted and piped to a text file on computer two. Then, Net::FullAuto will run a command for a zip utility over ssh on computer two to zip the file. Next (assume the encryption software is on computer one) Net::FullAuto will transfer this file to computer one, where it can be encrypted with licensed encryption software, and then finally, the encrypted file can be transferred to computer three via sftp. Email and pager software can be used for automated notification as well.

Example: The same process above needs to run at 2:00am unattended.

No Problem! A script using Net::FullAuto can be run via cron to perform the same actions above without user involvement.

Net::FullAuto is RELIABLE and FAULT TOLERANT. Each individual command run on a remote computer returns to Net::FullAuto BOTH stdout (output) and stderr (error messages). With this feature, users and programmers can write code to essentially trap remote errors "locally" and respond with a host of error recovery approaches. Everything from sending an e-mail, to re-running the command, to switching remote computers and much more is available as error handling options. The only limits are the skills and ingenuity of the programmers and administrators using Net::FullAuto. If Net::FullAuto loses a connection to a remote host, automatic attempts will be made to re-connect seemlessly - with errors reported when the specified number of attempts fail.

Net::FullAuto is EASY. Net::FullAuto uses a mix of traditional and object-oriented features to maximize ease of use and maintenance. Due to the unique nature of distributed computing, combined with the need for ease of maintaining a lot of configuration information (i.e. ip addresses, host names, login ID's, passwords, etc), along with any number of *routines* or *processes*, as well as the need for robust security, Net::FullAuto has a unique layout and architechture. Normally in perl, programmers segregate functional code in separate script files or perl modules or packages. Net::FullAuto supports this as well, but advocates keeping *process* code confined to a single routine in a kind of "process library" file. This is in order that Net::FullAuto can provide additional built-in features like a command-handle to the local machine without having to explicitly create it. Or, being able to connect to a remote host with syntax as simple as:

 $computer_one=connect_ssh('COMPUTER_ONE');

IT REALLY IS THAT EASY!

Commands also are easy:

 ($stdout,$stderr)=$computer_one->cmd('ls -l');

And NO CLEANUP is necessary - Net::FullAuto handles this AUTOMATICALLY.

This is a COMPLETE *routine* or *process*:

 sub ls_one {

    my ($computer_one,$stdout,$stderr);             # Scope Variables

    $computer_one=connect_ssh('COMPUTER_ONE');      # Connect to Remote Host

    ($stdout,$stderr)=$computer_one->cmd('ls -l');  # Run Command

    if ($stderr) {                                  # Check Results
       print "We Have and ERROR! : $stderr\n";
    } else {
       print "Output of ls command from Computer One:\n\n$stdout\n\n";
    }
 }                                                  # DONE!! 

AGAIN - IT REALLY IS THAT EASY!

As with most things in life, what many or most consider a blessing, others consider a curse. Perl's motto is "There's more than one way to do it." (TIMTOWTDI) Not everyone thinks this is utopia. Perl also attempts "to make easy tasks easy and difficult tasks possible." Net::FullAuto - written in perl - *IS* PERL. It is essentially a perl extension and therefore adheres to the same goals as perl itself: i.e. - there's no "one" correct way to use Net::FullAuto.

Net::FullAuto is SECURE. It uses ssh and sftp for communication accross computers, and uses powerful encryption to store passwords to remote resources. When running Net::FullAuto, a user on the first iteration of a process will be prompted to enter a password for each and every remote resource (or even local resource, since Net::FullAuto can and does use ssh to acquire enhanced user-rights on the local computer.) Every following iteration will then prompt for a password ONLY ONCE (or a password can even be passed in via command or method arguement) with every other needed password retrieved from an encrypted datafile which utilizes the user's main login password as the "salt".

For added security, and enhanced user functionality, Net::FullAuto can be installed on UNIX computers to use setuid. (Windows/Cygwin does not support "setuid" - so this feature is not available on Windows computers. This is the ONLY Windows limitation.) With Net::FullAuto setup to use setuid, users can be configured to run complex distributed processes in a secure fashion without the permissions ACTUALLY needed by the remote (or even local) resources. On top of that, it is possible to create a process administered by numerous individuals such that NO ONE PERSON KNOWS OR HAS ACCESS TO ALL THE PASSWORDS. For example, a database administrator on a remote computer can "loan" his username and password to drop a table (for instance) for a process that will be run by another user remotely. During the first iteration, after the user enters her/his password, the DB can then (when prompted), enter his/her password which will then be encrypted LOCALLY with the user's password as the salt. With the encrypted datafile and perl code protected from user write (or even read) access via setuid on UNIX computers (setup and administered by yet another individual or group - such as the root user), there is no way for either the DB to discover the user's password, or the user to discover the DB's password! Even the root user of the local computer runningNet::FullAuto will not be able to discover these passwords! (When setuid is setup and used PROPERLY). This setup will allow users to run FullAuto processes WITHOUT access to the passwords controlling remote access, or for that matter, the CODE running those processes!

Reasons to use this module are:

SETUP ^

Net::FullAuto requires some preliminary setup before it can be used.

Setup Checklist

Setup Components

              BEGIN { our $fa_hosts='/home/user/my_hosts.pm' }
              use Net::FullAuto;
              . . . 
              BEGIN { our $usr_code='/home/user/my_code.pm' }
              use Net::FullAuto;
              . . .

 NOTE: It is common to use BOTH location variables together:

        BEGIN { our $usr_code='/home/user/my_code.pm';
                our $fa_hosts='/home/user/my_hosts.pm' }
        use Net::FullAuto;
        . . . 
        package fa_hosts;

        require Exporter;
        use warnings;
        our @ISA = qw(Exporter);
        our @EXPORT = qw(@Hosts);

        @Hosts=(
        #################################################################
        ##  Do NOT alter code ABOVE this block.
        #################################################################
        ## -------------------------------------------------------------
        ##  ADD HOST BLOCKS HERE:
        ## -------------------------------------------------------------

           {
               Label     => 'REMOTE COMPUTER ONE',
               IP        => '198.201.10.01',
               Hostname  => 'Linux_Host_One',
           },
           {
               Label     => 'REMOTE COMPUTER TWO',
               IP        => '198.201.10.02',
               Hostname  => 'Linux_Host_Two',
           },

        #################################################################
        ##  Do NOT alter code BELOW this block.
        #################################################################
        );

        ## Important! The '1' at the Bottom is NEEDED!
        1
        package fa_code;

        require Exporter;
        use warnings;
        our @ISA = qw(Exporter Net::FullAuto::FA_Core);
        use Net::FullAuto::FA_Core;

        #################################################################
        ##  Do NOT alter code ABOVE this block.
        #################################################################

        sub hello_world {

            print $localhost->cmd('echo "hello world"');

        }

        sub remote_hostname {

            my ($computer_one,$stdout,$stderr);      # Scope Variables

            $computer_one=connect_ssh('REMOTE COMPUTER ONE'); # Connect to
                                                     # Remote Host via ssh

            ($stdout,$stderr)=$computer_one->cmd('hostname');

            print "REMOTE ONE HOSTNAME=$stdout\n";

        }

        ########### END OF SUBS ########################

        #################################################################
        ##  Do NOT alter code BELOW this block.
        #################################################################

        ## Important! The '1' at the Bottom is NEEDED!
        1 

 fa_hosts.pm HOST BLOCK KEY ELEMENTS ^

 usr_code.pm METHODS ^

EXAMPLES ^

AUTHOR ^

Brian M. Kelly <Brian.Kelly@fullautosoftware.net>

COPYRIGHT ^

Copyright (C) 2000-2014

by Brian M. Kelly.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License. (http://www.gnu.org/licenses/agpl.html).

syntax highlighting: