Virtuoso provides a generic access control list for HTTP and other Internet protocol clients. This mechanism uses wildcard expressions to selectively block and allow ranges of IP addresses. An ordered set of patterns is matched against the origin of the request. The first matching pattern's allow/deny flag determines whether the client is approved or not.
The patterns for designating a range of IP addresses follow the syntax of the SQL 'LIKE' predicate; i.e. '%.foo.bar' or '*.foo.bar' for example.
The LIKE Predicate & Search Patterns section.
The following mechanisms for services access restriction are defined by default:
The system table DB.DBA.HTTP_ACL is used to persist ACL definitions, which can be managed with simple INSERT/UPDATE/DELETE statements. The table has the following layout:
Columns for DB.DBA.HTTP_ACL:
The primary key covers columns HA_LIST, HA_ORDER, HA_CLIENT_IP and HA_FLAG.
The full schema is listed in the Appendix under System Tables.
Name of the ACL, This is a label to designate a group of rules applicable to a specific service. There are three pre-defined groups which are: HTTP, NEWS, PROXY. Please note that name of group is treated as case-insensitive string. In other words we can think about HA_LIST as domain of the ACL. Developers can use that table to add their own ACLs , and use them with API functions which are discussed in the next section.
Ordinal number of the rule within its list. This number should be unique within a specific group to have a well defined order of rule matching. Please note that if order is equal the one with allow flag equal to zero (HA_FLAG value see below) takes precedence. The order for applying rules for particular list is in ascending order i.e. first will be applied the rule with the smallest value of HA_ORDER.
A pattern to designate separate IP address or group of addresses. This is a string value as for 'LIKE' operator. Some example is: 192.168.*; will match all hosts from local private network.
A boolean; zero or positive number designating a rule to be applied for matching address/host. The default option is zero (false) for allowed action; positive (true) for denied action. So application may use it in reverse; but in that case it needs to take in account the order precedence (see HA_ORDER).
An integer designating an ID used in predefined ACL for Internet News groups to designate ID of the group. This can be used also in other applications where one desires to apply different rules for different objects. We can think of it as a sub list inside an ACL.
An integer designating a action to be restricted (read/write); used in predefined Internet News groups ACL.
A string containing pattern to match another IP number; this is used in Web Proxy server ACL. This can also be used in custom application logic.
An float for Rate Limit. The filter calculates hit rate average and compares with limit for http acl rule. If it is larger then will drop connection. Once per day the statistics will be reset.
The Rate Limit UI can be configured from Conductor->System Admin->Access Control where:
-- like '%something' or -- something*
Rate limit is hits/per second from one IP address.
For search enging eoptimization statistics, for example can be set rate limit 10 (or even 100 so to start to collect statistics), and then to check with http_acl_stats () what values are returned.
ACL's can be managed from the administration web interface using the following steps.
![]() |
Figure: 12.2.2.1. Access Control |
Alternately the HTTP_ACL table can be directly manipulated with SQL. To add new rule:
INSERT INTO HTTP_ACL (HA_LIST, HA_ORDER, HA_CLIENT_IP, HA_RATE, HA_FLAG) values ('list_name', <order number>, '*pattern*', <hits_per_second_number>, [1/0]);
To remove existing rule:
DELETE from HTTP_ACL where HA_LIST = 'list_name' and HA_ORDER = <order number> and HA_FLAG = [1/0] and HA_CLIENT_IP = '*pattern*';
The http_acl_get() function can be used to test an address against an ACL. The http_client_ip() function can be used to determine the IP address or DNS name of a client machine.
To restrict a 'foo.bar' (network 333.333.333.0) from accessing a SOAP service one could use the following:
-- deny access from '333.333.333.*' insert into http_acl (ha_list, ha_order, ha_flag, ha_client_ip) values ('MY_SOAP', 1, 1, '333.333.333.*'); -- allow insert into http_acl (ha_list, ha_order, ha_flag, ha_client_ip) values ('MY_SOAP', 2, 0, '*'); -- a procedure exposed as SOAP service create procedure SumService (in a int, in b int) returns int { if (0 <> http_acl_get ('MY_SOAP', http_client_ip ())) signal ('42000', 'Access denied'); return (a + b); }
The following ACLs are predefined and have special treatment in Web Server processing:
General Web server ACL, applying rules to it controls access to the Web server. Thus if this ACL is managed via web UI one must pay attention not to disable the current connection and render the administration UI inaccessible. The ACL rules for 'HTTP' must contain HA_ORDER, HA_CLIENT_IP (pattern) and HA_FLAG (access flag) only. The rest of column values are ignored. To add or remove rules to that list see 'ACL definition/removal' where HA_LIST must be equal to 'HTTP'. The value of client's IP address will be tested against rules.
controls access to the separate Internet News groups, restricting POST or READ access to them.
All valid rules for 'HTTP' are also valid for 'NEWS' with following difference:
The HA_LIST must be equal to 'NEWS' if control is managed with SQL statements. The HA_LIST must be equal to 'NEWS'.
This controls access to the Web Proxy Server. Note that Proxy service is disabled by default and can be enabled with 'HTTPProxyEnabled' INI setting. This ACL is similar to the HTTP ACL. Additionally, the pattern in HA_DEST_PATTERN must match the destination server. In this way certain destinations can be restricted.
HTTP ACLs affect PROXY rules. Therefore if HTTP list rejects a request from a particular client, the proxy access from there also will be rejected.
To allow access from localhost only:
insert into http_acl (ha_list, ha_order, ha_flag, ha_client_ip) values ('HTTP', 1, 0, '127.0.0.1'); insert into http_acl (ha_list, ha_order, ha_flag, ha_client_ip) values ('HTTP', 2, 1, '*');
To allow only local addresses (private.net/192.168.0.0) to access proxy server.
insert into http_acl (ha_list, ha_order, ha_flag, ha_client_ip, ha_dest_ip) values ('PROXY', 1, 0, '192.168.1.*', '*'); insert into http_acl (ha_list, ha_order, ha_flag, ha_client_ip, ha_dest_ip) values ('PROXY', 2, 1, '*', '*');
To deny web access from some domain (bad.domain/333.333.333.0)
insert into http_acl (ha_list, ha_order, ha_flag, ha_client_ip) values ('HTTP', 1, 0, '*'); insert into http_acl (ha_list, ha_order, ha_flag, ha_client_ip) values ('HTTP', 2, 1, '333.333.333.*');
Previous
The HTTP Server |
Chapter Contents |
Next
Virtuoso Server Pages (VSP) |