Databases Reference
In-Depth Information
Defining rules
The format of a rule is:
<'allow' | 'deny'> <username> [from] <source>
The
from
keyword being optional; here are some examples:
Rule
Description
allow
Bob
from
1.2.3/24
User
Bob
is allowed from any address matching the
network
1.2.3
(this is CIDR IP matching, more details at
http://en.wikipedia.org/wiki/CIDR_notation
).
deny
Alice
from
4.5/16
User
Alice
cannot access when located on network
4.5
.
allow
Melanie
from
all
User
Melanie
can log in from anywhere.
deny
%
from
all
all
can be used as an equivalent to
0.0.0.0/0
, meaning
any host. Here, the
%
sign means any user.
Usually we will have several rules. Let us say we wish to have the following
two rules:
allow Marc from 45.34.23.12
allow Melanie from all
We have to put them in
config.inc.php
(in the related server-specific section)
as follows:
$cfg['Servers'][$i]['AllowDeny']['rules'] =
array('allow Marc from 45.34.23.12', 'allow Melanie from all');
When defining a single rule or multiple rules, a PHP array is used. We must follow
its syntax, enclosing each complete rule within single quotes and separating each
rule from the next with a comma. Thus, if we have only one rule, we must still
use an array to specify it. The next parameter explains the order in which rules
are interpreted.
Order of interpretation for rules
By default, this parameter is empty:
$cfg['Servers'][$i]['AllowDeny']['order'] = '';
This means that no IP-based verification is made.