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:
Pavel Raiskup 2021-12-10 18:20:04 +01:00
parent 3d121ae5ee
commit f736ed7ef9

View file

@ -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"
}
##