mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-05-03 01:02:07 +08:00
copr-be: dir-generator fix once more
Seems like with lighttpd v1.4.61 we finally can match the index file request against the rewritten url, so it is secure! This allows us to prettily restrict the configuration to load the php script from only one possible location.
This commit is contained in:
@@ -304,24 +304,16 @@ server.max-keep-alive-idle = 2
|
||||
## "index.htm", "default.htm" )
|
||||
##
|
||||
|
||||
# Warning: This is sooo ugly.
|
||||
#
|
||||
# We only ever want to enable PHP CGI for the index generator file
|
||||
# 'dir-generator.php', nothing else - so we are sure our users can not execute
|
||||
# their own scripts. Therefore non-conditional 'cgi.assign' config can not be
|
||||
# used.
|
||||
#
|
||||
# But to make the 'index-file.names' work correctly, we still have to set
|
||||
# 'cgi.assign' conditionally - the trick is to do this only on paths that both
|
||||
# (a) end with slash (= directories) and (b) do not contain 'dir-generator'
|
||||
# string (guard against '/some/dir-generator.php/' or alike hacks).
|
||||
# their own scripts. Therefore only conditional 'cgi.assign' can be used.
|
||||
|
||||
index-file.names = (
|
||||
"/dir-generator.php"
|
||||
)
|
||||
$HTTP["url"] =~ "/$" {
|
||||
$HTTP["url"] !~ "dir-generator" {
|
||||
cgi.assign = ( "/dir-generator.php" => "/usr/bin/php-cgi" )
|
||||
}
|
||||
|
||||
$HTTP["url"] == "/dir-generator.php" {
|
||||
cgi.assign = ( "/dir-generator.php" => "/usr/bin/php-cgi"
|
||||
}
|
||||
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user