allow per php-config setting of adding '-pass-header Authorization' / 'CGIPassAuth On' to the domains vhosts

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-01-09 17:14:57 +01:00
parent 84abb33e54
commit ba58991d11
9 changed files with 55 additions and 4 deletions

View File

@@ -330,8 +330,17 @@ class apache extends HttpConfigBase
$this->virtualhosts_data[$vhosts_filename] .= ' <FilesMatch \.php$>' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' SetHandler proxy:unix:' . $php->getInterface()->getSocketFile() . '|fcgi://localhost' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' </FilesMatch>' . "\n";
if ($phpconfig['pass_authorizationheader'] == '1') {
$this->virtualhosts_data[$vhosts_filename] .= ' <Directory "' . $mypath . '">' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' CGIPassAuth On' . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' </Directory>' . "\n";
}
} else {
$this->virtualhosts_data[$vhosts_filename] .= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName . ' -socket ' . $php->getInterface()->getSocketFile() . ' -idle-timeout ' . Settings::Get('phpfpm.idle_timeout') . "\n";
$addheader = "";
if ($phpconfig['pass_authorizationheader'] == '1') {
$addheader = " -pass-header Authorization";
}
$this->virtualhosts_data[$vhosts_filename] .= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName . ' -socket ' . $php->getInterface()->getSocketFile() . ' -idle-timeout ' . Settings::Get('phpfpm.idle_timeout') . $addheader . "\n";
$this->virtualhosts_data[$vhosts_filename] .= ' <Directory "' . $mypath . '">' . "\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
$this->virtualhosts_data[$vhosts_filename] .= ' <FilesMatch "\.(' . implode('|', $file_extensions) . ')$">' . "\n";

View File

@@ -54,13 +54,25 @@ class apache_fcgid extends apache
// for this path, as this would be the first require and therefore grant all access
if ($mypath_dir->isUserProtected() == false) {
$php_options_text.= ' <Directory "' . makeCorrectDir($domain['documentroot']) . '">' . "\n";
if ($phpconfig['pass_authorizationheader'] == '1') {
$php_options_text.= ' CGIPassAuth On' . "\n";
}
$php_options_text.= ' Require all granted' . "\n";
$php_options_text.= ' AllowOverride All' . "\n";
$php_options_text.= ' </Directory>' . "\n";
} elseif ($phpconfig['pass_authorizationheader'] == '1') {
// allow Pass of Authorization header
$php_options_text.= ' <Directory "' . makeCorrectDir($domain['documentroot']) . '">' . "\n";
$php_options_text.= ' CGIPassAuth On' . "\n";
$php_options_text.= ' </Directory>' . "\n";
}
} else {
$php_options_text.= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName . ' -socket ' . $php->getInterface()->getSocketFile() . ' -idle-timeout ' . Settings::Get('phpfpm.idle_timeout') . "\n";
$addheader = "";
if ($phpconfig['pass_authorizationheader'] == '1') {
$addheader = " -pass-header Authorization";
}
$php_options_text.= ' FastCgiExternalServer ' . $php->getInterface()->getAliasConfigDir() . $srvName . ' -socket ' . $php->getInterface()->getSocketFile() . ' -idle-timeout ' . Settings::Get('phpfpm.idle_timeout') . $addheader . "\n";
$php_options_text.= ' <Directory "' . makeCorrectDir($domain['documentroot']) . '">' . "\n";
$php_options_text.= ' <FilesMatch "\.php$">' . "\n";
$php_options_text.= ' SetHandler php5-fastcgi'. "\n";