Net-Cisco-ACS
view release on metacpan or search on metacpan
lib/Net/Cisco/ACS.pm view on Meta::CPAN
package Net::Cisco::ACS;
use strict;
use Moose;
# REST IO stuff here
use IO::Socket::SSL qw( SSL_VERIFY_NONE );
use LWP::UserAgent;
use XML::Simple;
# Generics
use MIME::Base64;
use URI::Escape;
use Data::Dumper;
# Net::Cisco::ACS::*
use Net::Cisco::ACS::User;
use Net::Cisco::ACS::IdentityGroup;
use Net::Cisco::ACS::Device;
use Net::Cisco::ACS::DeviceGroup;
use Net::Cisco::ACS::Host;
BEGIN {
use Exporter ();
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $ERROR %actions);
$VERSION = '0.04';
@ISA = qw(Exporter);
@EXPORT = qw();
@EXPORT_OK = qw();
%EXPORT_TAGS = ();
$ERROR = ""; # TODO: Document error properly!
%actions = ( "version" => "/Rest/Common/AcsVersion",
"serviceLocation" => "/Rest/Common/ServiceLocation",
"errorMessage" => "/Rest/Common/ErrorMessage",
);
}
# Moose!
has 'ssl_options' => (
is => 'rw',
isa => 'HashRef',
default => sub { { 'SSL_verify_mode' => SSL_VERIFY_NONE, 'verify_hostname' => '0' } }
);
has 'ssl' => (
is => 'rw',
isa => 'Str',
default => '1',
);
has 'hostname' => (
is => 'rw',
isa => 'Str',
required => '1',
);
has 'mock' => (
is => 'rw',
isa => 'Str',
default => '0',
);
sub users # No Moose here :(
{ my $self = shift;
$ERROR = "";
lib/Net/Cisco/ACS.pm view on Meta::CPAN
$user2->password("TopSecret"); # Password policies will be enforced!
my $id = $acs->update($user,$user2);
# Update users based on Net::Cisco::ACS::User instances in arguments
# Return value is ID generated by ACS but not guaranteed.
# print "Record ID is $id" if $id;
# print $Net::Cisco::ACS::ERROR unless $id;
# $Net::Cisco::ACS::ERROR contains details about failure
my $device = $acs->devices("name","Main_Router");
$device->description("Main Router");
$device->ips([{netMask => "32", ipAddress=>"10.0.0.1"}]); # Change IP address! Overlap check is enforced!
my $device2 = $acs->devices("name","Alt_Router");
$device2->description("Standby Router");
$device2->ips([{netMask => "32", ipAddress=>"10.0.0.2"}]); # Change IP address! Overlap check is enforced!
my $id = $acs->create($device,$device2);
# Update devices based on Net::Cisco::ACS::Device instances in arguments
# Return value is ID generated by ACS but not guaranteed.
# print "Record ID is $id" if $id;
# print $Net::Cisco::ACS::ERROR unless $id;
# $Net::Cisco::ACS::ERROR contains details about failure
=item delete
This method deletes an existing entry in Cisco ACS, depending on the argument passed. Record type is detected automatically.
my $user = $acs->users("name","acsadmin");
$acs->delete($user);
my $device = $acs->users("name","Main_Router");
$acs->delete($device);
=item $ERROR
This variable will contain detailed error information, based on the REST API answer. This value is reset during every call to C<users>, C<devices> and C<devicegroups>.
=back
=head1 REQUIREMENTS
For this library to work, you need an instance with Cisco ACS (obviously) or a simulator like L<Net::Cisco::ACS::Mock>.
To enable the Cisco ACS REST API, you will need to run the command below from the Cisco ACS console:
acs config-web-interface rest enable
You will also need an administrator-role account, typically NOT associated with a device-access account. Configure the account through the GUI.
System Administration > Administrators > Accounts
You will need more than generic privileges (SuperAdmin is ideal, suspected that UserAdmin and NetworkDeviceAdmin are sufficient).
You will also need
=over 3
=item L<Moose>
=item L<IO::Socket::SSL>
=item L<LWP::UserAgent>
=item L<XML::Simple>
=item L<MIME::Base64>
=item L<URI::Escape>
=back
=head1 BUGS
None so far
=head1 SUPPORT
None so far :)
=head1 AUTHOR
Hendrik Van Belleghem
CPAN ID: BEATNIK
hendrik.vanbelleghem@gmail.com
=head1 COPYRIGHT
This program is free software licensed under the...
The General Public License (GPL)
Version 2, June 1991
The full text of the license can be found in the
LICENSE file included with this module.
=head1 COMPATIBILITY
Certain API calls are not support from Cisco ACS 5.0 onwards. The current supported versions of Cisco ACS (by Cisco) are 5.6, 5.7 and 5.8 (Active).
=head1 SEE ALSO
=over 3
See L<Net::Cisco::ACS::User> for more information on User management.
See L<Net::Cisco::ACS::IdentityGroup> for more information on User Group management.
See L<Net::Cisco::ACS::Device> for more information on Device management.
See L<Net::Cisco::ACS::DeviceGroup> for more information on Device Group management.
See L<Net::Cisco::ACS::Host> for more information on Host management.
See the L<Cisco ACS product page|http://www.cisco.com/c/en/us/products/security/secure-access-control-system/index.html> for more information.
L<Net::Cisco::ACS> relies on L<Moose>.
=back
=cut
( run in 3.096 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )