3.5. libwrap

3.5.1. NAME

libwrap - Guardian Digital WebTool module interface to TCP Wrappers.

3.5.2. SYNOPSIS

use libwrap;
my $libwrap  = new libwrap;

3.5.3. DESCRIPTION

This Guardian Digital WebTool module provides an interface to manipulating TCP wrappers (/etc/hosts.allow and /etc/hosts.deny). This module allows you to add, delete, get, and list entries in the hosts.allow file.

3.5.4. METHODS

exists($$$)

This function is basically used to check out that particular entry(host) is exists in configuration file(hosts.allow/hosts.deny) or not? It returns true or false respectively. It takes service, host and file as arguments.

Example Usage:

$libwrap->exists($service, $host, $file);

resolve_service($)

This function is used to get service name based on the language selection, usually for display purpose on page. It receives two arguments one is WebTool::UI object and another is service name. It returns translated service name.

Example Usage:

$libwrap->resolve_service($page, 'pptpd')

allow_add($)

This function is used to add host to hosts.allow file. It receives service name and host(ip address or ALL) as arguments and update hosts.allow file by adding entry.

Example Usage:

$libwrap->allow_add($service, $host);

allow_delete($)

This function is used to delete host from hosts.allow file. It receives service name and host(ip address or ALL) as arguments and update hosts.allow file by deleting entry.

Example Usage:

$libwrap->allow_delete($service, $host);

allow_get()

This function is used to get information from configuration file(usually /etc/hosts.allow). It returns hash reference containing services as keys and allowed hosts as respective values (in terms of array reference).

Example Usage:

$allow = libwrap::allow_get();
foreach my $service (sort keys %{$allow}) {
     my @hosts = @{$allow->{$service}};
     ...
}

3.5.5. AUTHORS

Ryan W. Maple <ryan@guardiandigital.com>

3.5.6. COPYRIGHT AND LICENSE

Copyright Guardian Digital, Inc., All Rights Reserved