Apache. Документация на русском


Директивы Apache
  1    2    3    4    5    6    7    8    9    10    11    12    13    14    15    16    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64    65    66    67    68    69    70    71    72    73    74    75    76    77    78    79    80    81    82    83    84    85  
  86    87    88    89    90    91    92  
  93    94    95    96    97    98    99    100    101    102    103    104    105    106    107    108    109    110    111    112    113    114    115    116    117    118    119    120    121    122    123    124    125    126    127    128    129    130    131    132    133    134    135    136    137    138    139    140    141    142    143    144    145    146    147    148    149    150    151    152    153    154    155    156    157    158    159    160    161    162    163    164    165  
  166    167    168    169    170    171    172    173    174    175    176    177    178    179    180    181    182    183    184    185    186    187    188    189    190    191    192    193    194    195    196    197    198    199    200    201    202    203    204    205    206    207    208    209    210    211    212    213    214    215    216    217    218    219    220      221      222    223    224    225    226    227    228    229    230    231    232    233    234    235    236    237    238    239    240    241    242  

 <         > 
Список директив: Core  |  ModRewrite  |  Lua  |  Proxy  |  SSL

Директива SSLRequire
RU          EN  
Description:Allow access only when an arbitrarily complex boolean expression is true
Syntax: SSLRequire expression
Context:directory, .htaccess
Override:AuthConfig
Status:Extension
Module:mod_ssl

SSLRequire is deprecated

SSLRequire is deprecated and should in general be replaced by Require expr. The so called ap_expr syntax of Require expr is a superset of the syntax of SSLRequire , with the following exception:

In SSLRequire , the comparison operators < , <= , ... are completely equivalent to the operators lt , le , ... and work in a somewhat peculiar way that first compares the length of two strings and then the lexical order. On the other hand, ap_expr has two sets of comparison operators: The operators < , <= , ... do lexical string comparison, while the operators -lt , -le , ... do integer comparison. For the latter, there are also aliases without the leading dashes: lt , le , ...

This directive specifies a general access requirement which has to be fulfilled in order to allow access. It is a very powerful directive because the requirement specification is an arbitrarily complex boolean expression containing any number of access checks.

The expression must match the following syntax (given as a BNF grammar notation):

expr ::= "true" | "false"
 | "!" expr
 | expr "&&" expr
 | expr "||" expr
 | "(" expr ")"
 | comp
comp ::= word "==" word | word "eq" word
 | word "!=" word | word "ne" word
 | word "<" word | word "lt" word
 | word "<=" word | word "le" word
 | word ">" word | word "gt" word
 | word ">=" word | word "ge" word
 | word "in" "{" wordlist "}"
 | word "in" "PeerExtList(" word ")"
 | word "=~" regex
 | word "!~" regex
wordlist ::= word
 | wordlist "," word
word ::= digit
 | cstring
 | variable
 | function
digit ::= [0-9]+
cstring ::= "..."
variable ::= "%{" varname "}"
function ::= funcname "(" funcargs ")"

For varname any of the variables described in Environment Variables can be used. For funcname the available functions are listed in the ap_expr documentation.

The expression is parsed into an internal machine representation when the configuration is loaded, and then evaluated during request processing. In .htaccess context, the expression is both parsed and executed each time the .htaccess file is encountered during request processing.

Example

SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)-/ \
 and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
 and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
 and %{TIME_WDAY} -ge 1 and %{TIME_WDAY} -le 5 \
 and %{TIME_HOUR} -ge 8 and %{TIME_HOUR} -le 20 ) \
 or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/

The PeerExtList(object-ID) function expects to find zero or more instances of the X.509 certificate extension identified by the given object ID (OID) in the client certificate. The expression evaluates to true if the left-hand side string matches exactly against the value of an extension identified with this OID. (If multiple extensions with the same OID are present, at least one extension must match).

Example

SSLRequire "foobar" in PeerExtList("1.2.3.4.5.6")

Notes on the PeerExtList function

  • The object ID can be specified either as a descriptive name recognized by the SSL library, such as "nsComment" , or as a numeric OID, such as "1.2.3.4.5.6" .

  • Expressions with types known to the SSL library are rendered to a string before comparison. For an extension with a type not recognized by the SSL library, mod_ssl will parse the value if it is one of the primitive ASN.1 types UTF8String, IA5String, VisibleString, or BMPString. For an extension of one of these types, the string value will be converted to UTF-8 if necessary, then compared against the left-hand-side expression.

See also

  • Environment Variables in Apache HTTP Server, for additional examples.
  • Require expr
  • Generic expression syntax in Apache HTTP Server
RU          EN