The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::Netdisco::Util::Permission

DESCRIPTION

Helper subroutines to support parts of the Netdisco application.

There are no default exports, however the :all tag will export all subroutines.

EXPORT_OK

check_acl( $ip, \@config )

Given an IP address, returns true if any of the items in \@config matches that address, otherwise returns false.

Normally you use check_device_no and check_device_only, passing the name of the configuration setting to load. This helper instead requires not the name of the setting, but its value.

There are several options for what \@config can contain:

  • Hostname, IP address, IP prefix

  • IP address range, using a hyphen and no whitespace

  • Regular Expression in YAML format (no enforced anchors) which will match the device DNS name (using a fresh DNS lookup, so works on new discovery), e.g.:

     - !!perl/regexp ^sep0.*$
  • "property:regex" - matched against a device property, such as model or vendor (with enforced begin/end regex anchors)

To simply match all devices, use "any" or IP Prefix "0.0.0.0/0". Property regular expressions are anchored (that is, they must match the whole string). To match no devices we recommend an entry of "localhost" in the setting.