Host Restrictions

Access to Users can be restricted to certain IP or host masks in order to increase security.  This offers security on top of the authentication with username and password: the user can only log in or use data functions when she has the correct credentials and connects from an allowed host.

Summary
Access to Users can be restricted to certain IP or host masks in order to increase security.
A host restriction is a rule of the form
Deny access (for all users) to all IP’s except 123.456.789
When an IP has been specifically whitelisted it will never be blocked through the User Lockout mechanism.
These methods can be used to set or view host restrictions.

Rules

A host restriction is a rule of the form

[IP or host mask] [ip|host] [allow|deny];

The first part contains an IP address mask or a host name mask.  This mask is matched to the IP address or hostname of the connecting user.  The mask may contain wildcards, where the character ‘%’ matches zero or more characters and ‘_’ matches a single character.

The second part, ‘ip’ or ‘host’, indicates whether the mask should be considered an IP address or a host name.

The third keyword, ‘allow’ or ‘deny’, specifies whether access should be allowed or denied.

If multiple rules match, the last matching rule is used to determine the behavior.  This means the most general rules should come first.  For example, access to a range IP’s can be denied by the first rule while the second rule allows access to one specific IP within the range.

If no rules are supplied, access is allowed for all hosts.  Otherwise all hosts are denied by default, unless they match an ‘allow’ rule.  Therefor at least one of the rules should ‘allow’ hosts, to avoid blocking every host.

Access restrictions can be set on both the level of Accounts and Users.  If restrictions are set on both the users rules are checked first.  If none of the users rules matches the rules of the account are checked.

Examples

Example 1

Deny access (for all users) to all IP’s except 123.456.789

Account123.456.789 ip allow;

Example 2

Deny access (for all users) to all IP’s.  Allow access to user 1 for IP 123.456.789.  Allow access to user 2 for host ‘subdomain.domain.com’ and IP 123.456.789 . Deny access to user 3 for host ‘subdomain.domain.com’, but allow other hosts that end in ‘.domain.com’.

Account% ip deny;
User 1123.456.789 ip allow;
User 2subdomain.domain.com host allow; 123.456.789 ip allow;
User 3%.domain.com host allow; subdomain.domain.com host deny;

Example 3

Allow access from all IP’s, except for 123.123.123.123.

Account% ip allow; 123.123.123.123 ip deny;

Whitelisting and Lockout

When an IP has been specifically whitelisted it will never be blocked through the User Lockout mechanism.  This means that a whitelisted IP will never cause a lockout to occur.  Previously issued bans will also be disregarded, re-activating the IP.

Related methods

These methods can be used to set or view host restrictions.

Accounting::accountEditHostRestrictionsSet host restrictions on an account
Accounting::accountViewHostRestrictionsView host restrictions of an account
Accounting::userEditHostRestrictionsSet host restrictions on a user
Accounting::userViewHostRestrictionsView host restrictions of a user
A user is the primary actor in the Webservices.nl framework.
Access by Users is restricted when multiple concurrent wrong login attempts are recorded.
An account is a collection of Users.
Set host restrictions for the account
View host restrictions for the account
Set host restrictions for the user
View host restrictions for the user