Chapter 10. Access control
Satisfy any
</Directory>
Figure 10-15. Mixed restrictions
The two worlds of access control are joined by the Satisfy command. This has two
possible options: Any and All. Satisfy Any requires the request to satisfy either the
location requirement or the authentication requirement. Satisfy All would require it
to satisfy both.
Blocking access based on a file’s name
There is one last aspect of access control we must consider. We have stopped certain
files being listed in indexes in the Section called Automatic indexing of directories in
Chapter 6 but we warned that this did not stop the files being downloaded if the
client could guess the name. This section will demonstrate how to block downloads
of files matching certain expressions in the same way as the IndexIgnore command
stops files matching those patterns being listed.
We can restrict certain commands to files that match regular expressions with the
<FilesMatch> ... </FilesMatch> directive. We can put a simple denial of all access
in this block.
In an ideal world, IndexIgnore and <FilesMatch> would accept the same syntax
for describing their files. Unfortunately they don’t, and this is a serious flaw in the
Apache Software Foundation’s way of handling their modules. IndexIgnore uses
shell-style wildcards, formally known as globbing, and <FilesMatch> uses sed-style
regular expressions.
Our current example configuration file has the line
IndexIgnore "#*#" "*~" "configuration"
and the equivalent <FilesMatch> regular expression is
(^#.*#$|.*~$|^configuration$)
IndexIgnore "#*#" "*~" "configuration"
...
<FilesMatch (^#.*#$|.*~$|^configuration$)>
Order allow,deny
Deny from All
</FilesMatch>
Figure 10-16. Blocking access to the files ignored in the index
79
Comentarios a estos manuales