NAME

Web::VWF::Allow - The last access check a request must pass

VERSION

Version 0.003.0

SYNOPSIS

unless(Web::VWF::Allow::allow({ info => $info, lingua => $lingua, config => $config, logger => $logger })) {
	# refused
}

DESCRIPTION

Decides whether a client may be shown the site. It checks, in this order, the user agent against a list of unwelcome robots, the per-address Data::Throttler limit (the throttle settings, see "CONFIGURATION" in Web::VWF), the country against the blacklist_countries setting, CGI::IDS, a few known attack signatures in the Referer and URL, the DShield list of attacking addresses, and a cookie set by one kind of scanner.

Search engines are not throttled. The verdict for an address is remembered for five minutes.

FUNCTIONS

allow

Takes a hash or a hash reference: info (a CGI::Info, required in practice), lingua (a CGI::Lingua), logger, config and cache. One of cache and config is needed for the DShield list.

Returns true when the client is allowed, which is always so when REMOTE_ADDR is not set (the script is being run from a command line), and when info is not given, which is logged. A client that is refused makes it throw an Error::Simple, and the next calls for the same address in the following five minutes return false instead of throwing. info->status is set to 429 for a throttled address.

API SPECIFICATION

INPUT

{
	info => { type => 'object', optional => 1 },
	lingua => { type => 'object', optional => 1 },
	logger => { type => 'object', optional => 1 },
	config => { type => 'object', optional => 1 },
	cache => { type => 'object', optional => 1 },
}

OUTPUT

{ type => 'boolean' }

and throws Error::Simple when the client is refused.

AUTHOR

Nigel Horne, <njh at nigelhorne.com>

LICENCE AND COPYRIGHT

Copyright 2010-2026 Nigel Horne.

Usage is subject to the GPL2 licence terms. If you use it, please let me know.