nethserver:trustednetworks

NethServer::TrustedNetworks

NAME

  NethServer::TrustedNetworks -- extensible module for trusted networks
  providers

DESCRIPTION

  A network can be trusted for disparate reasons, and cannot be defined a
  priori. This module defines an API to
  • register a custom “provider” function, that returns some trusted networks when invoked
  • retrieve the complete list of trusted networks from the registered providers
  To define a provider function, add a Perl module under TrustedNetworks/
  directory, with namespace prefix NethServer::TrustedNetworks.
  For a real example, see the file Default.pm.

USAGE

  This is an example provider "Provider1" definition.
   package NethServer::TrustedNetworks::Provider1;
   use NethServer::TrustedNetworks qw(register_callback);
   register_callback(&provider1);
   sub provider1
   {
      my $results = shift;
      ... # do something with $results (array ref)
   }
  The $results variable is a reference to an array. Each array item must be
  an hash reference. And the hash must have two keys
  1. cidr, a string, representing the trusted network in CIDR form
  2. provider, a string that identifies the entry provider
  User code example, that retrieves the list of trusted networks in CIDR
  format:
   use NethServer::TrustedNetworks;
   print join(",", NethServer::TrustedNetworks::list_cidr()) . "\n";

API FUNCTIONS

  • register_callback($func_ref, $order = undef)
  • list_cidr() returns the trusted networks list with CIDR format (i.e. 192.168.1.0/24)
  • list_mask() returns the trusted networks list with netmask format (i.e 192.168.1.0/255.255.255.0)
  • list_full() returns the complete $results list
perldoc NethServer::Directory