Get RackTables working with php-cgi or fastcgi
If you’ve tried to google “racktables authentication not working after install” you won’t find much, but there is a couple of articles about fastcgi and the PHP_AUTH_PW and PHP_AUTH_USER not being passed correctly. But no real solution to the problem.
I was able to get RackTables working using the following work around posted on www.rosmir.org/Index/Docs/archive/LabsFolder/FastCGI which has nothing to do with RackTables.
- You will need to add the following to your .htaccess file.
1
2RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] - Next you will need to modify the inc/auth.php file and add the following before the function authenticate.
1
2
3if(preg_match('/Basic+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6)));
} - It should look like following below when completed.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17function authenticate ()
{
if(preg_match('/Basic+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6)));
}
global
$remote_username,
$remote_displayname,
$auto_tags,
$user_given_tags,
$user_auth_src,
$script_mode,
$require_local_account;
if (!isset ($user_auth_src) or !isset ($require_local_account))
throw new RackTablesError ('secret.php: either user_auth_src or require_local_account are missing', RackTablesError::MISCONFIGURED);
if (isset ($_REQUEST['logout']))