ARCv2
view release on metacpan or search on metacpan
lib/Arc/Connection.pod view on Meta::CPAN
=head1 NAME
Arc::Connection - Abstract base class for connection handling for ARCv2
=head1 DESCRIPTION
ARC allows non-privileged users to run privileged commands on the server.
The server decides if the user is allowed to run this command through ACL.
This file is a part of the Perl ARCv2 module suite. ARCv2 is a
rewrite of ARC by R.Toebbicke, CERN, Switzerland in Perl.
=head1 ABSTRACT
From ARC by R. Toebbicke, modified by me:
User requests are shipped from a client machine to a server using a
SASL-authenticated socket connection. The purpose is to convey
requests such as privileged commands (e.g. AFS, Crontab) to be executed on the
server under appropriate privileges. Given that all privileges are
confined to the server and the server can be programmed as to filter and
check the command to be executed, the client machine can be less trusted
than the server.
Because ARC-v1-Commands are written in perl anyway, implementing the client/server
in perl makes sense. Platform-independence and "easy-to-read" source code are welcome
too. This package provides two perl command line scripts (arcx, arcxd). They can
be used for working with the ARC server from the command line, resp. to start the
server.
=head1 SYNOPSIS
This module is part of the module suite ARCv2.
This is the connection module from ARCv2. If we would use C++, we would say
this is an abstract class of an ARCv2 Connection. This class provides common
methods to its derived classes. Such as for authentication and basic ARCv2
protocols.
=head1 Class VARIABLES
=head3 PUBLIC MEMBERS
=over 2
=item protocol
B<Description>: Which protocol is used (0 = ARC/2.0, 1 = ARC/2.1)
B<Default value>: undef
=item service
B<Description>: name of the server (for SASL)
B<Default value>: undef
=item timeout
B<Description>: timeout for all connections (ARCv2 and command) in seconds
B<Default value>: undef
=back
=over 2
=item logdestination I<inherited from Arc>
B<Description>: Where should all the log output go to ('stderr','syslog')
B<Default value>: 'syslog'
=item logfileprefix I<inherited from Arc>
B<Description>: Prepended to every log entry
B<Default value>: ""
=item loglevel I<inherited from Arc>
B<Description>: loglevel is combination of bits (1=AUTH,2=USER,4=ERR,8=CMDDEBUG,16=VERBSIDE,32=DEBUG) see _Log method
B<Default value>: 7
=back
=over 2
=back
=head3 PROTECTED MEMBERS
=over 2
=item _authenticated
B<Description>: Are we authenticated
=item _cmdclientsock
B<Description>: IO::Socket for the command connection (encrypted)
B<Default value>: undef
=item _cmdparameter
B<Description>: parameter after the command
B<Default value>: undef
=item _connected
B<Description>: are we connected
=item _connection
B<Description>: IO::Socket for the ARCv2 Connection
B<Default value>: undef
=item _expectedcmds
B<Description>: array, which ARCv2 protocol commands are allowed to come next
B<Default value>: undef
=item _select
B<Description>: IO::Select for the ARCv2 Connection
B<Default value>: undef
=item _username
B<Description>: username extracted from SASL
B<Default value>: "anonymous"
=back
=over 2
=item _error I<inherited from Arc>
B<Description>: contains the error message
B<Default value>: undef
=item _syslog I<inherited from Arc>
B<Description>: log to syslog or to STDERR
B<Default value>: 1
=back
=over 2
lib/Arc/Connection.pod view on Meta::CPAN
B<Description>: a partial line (idea From Net::Cmd)
B<Default value>: ""
=item __sasl
B<Description>: Authen::SASL Handle
B<Default value>: undef
=back
=head1 Class METHODS
=head3 PUBLIC METHODS
=over 2
=item clean ( )
=item IsConnected ( )
B<Description>: are we connected?
B<Returns:> true, if the ARCv2 control connection is connected, otherwise false
B<Example:>
last unless $arc->IsConnected;
=back
=over 2
=item DESTROY ( ) I<inherited from Arc>
B<Description>: Destructor
=item IsError ( ) I<inherited from Arc>
B<Description>: User function to get the error msg.
B<Returns:> the error message if any otherwise undef
B<Example:>
unless (my $err = $arc->IsError()) { .. } else { print STDERR $err; }
=item Log ( $facility, ... (message) ) I<inherited from Arc>
B<Description>: Log function.
Logs messages to 'logdestination' if 'loglevel' is is set appropriatly.
loglevel behaviour has changed in the 1.0 release of ARCv2, the "Arc"-class can export
LOG_AUTH (authentication information), LOG_USER (connection information), LOG_ERR (errors),
LOG_CMD (ARCv2 addition internal command information), LOG_SIDE (verbose client/server-specific
information), LOG_DEBUG (verbose debug information). It possible to combine the
levels with or (resp. +) to allow a message to appear when not all loglevels are
requested by the user.
Commonly used for logging errors from application level.
B<Returns:> always false
B<Example:>
return $arc->Log(LOG_ERR,"Message");
=item new ( %hash, key => val, ... ) I<inherited from Arc>
B<Description>: Constructor.
Initializes the object and returns it blessed.
For all sub classes, please override C<_Init> to check the
parameter which are passed to the C<new> function. This
is necessary because you are not able to call the the new method of a
parent class, when having a class name (new $class::SUPER::new, does not work.).
B<Returns:> blessed object of the class
B<Example:>
my $this = new Arc::Class ( key => value, key2 => value2 );
=back
=over 2
=back
=head3 PROTECTED METHODS
=over 2
=item _CommandConnection ( )
B<Description>: initializes command connection. (protocol)
Starts listen on the Command socket and sends the B<CMDPASV> command.
B<Returns:> true if everything went like expected, otherwise false.
B<Example:>
$this->_CommandConnection();
=item _Init ( ) I<reimplemented from Arc>
=item _PrepareAuthentication ( )
( run in 1.208 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )