Question

Today I have tried to enable authentication on apache server for gweb. I got authenticated successfully but not able to do logout after clicking on Logout link at top right corner. Please help on this if any one came across the same issue,

Authentication Configuration

In httpd.conf

LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authz_user_module modules/mod_authz_user.so

SetEnv ganglia_secret xxxxxxxxxxxxxxxxxxxxxxxxxx

<Files "login.php">
AuthType Basic
AuthName "Ganglia Access"
AuthUserFile "/config/.htpasswd"
Require valid-user
</Files>

<Directory /ganglia/>
AllowOverride AuthConfig
AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/config/.htpasswd"
Require valid-user
DirectoryIndex index.html index.php
Options FollowSymLinks +Indexes
Order deny,allow
Allow from all
</Directory>

Placed .htpasswd in proper location as configured.

In conf.php - gweb

$conf['auth_system'] = 'enabled';
$acl = GangliaAcl::getInstance();
$acl->addRole( 'username', GangliaAcl::ADMIN );
Was it helpful?

Solution

I have tried all possible ways to logout completely from ganglia, but I could not make it. So decided to pass wrong username and password to invalidate basic authentication. Added below javascript method in header.tpl file, called the below function while clicking on logout link.

function logoff() {
try {
     $.ajax({
         url: '/login.php',
         username: 'reset',
         password: 'reset',
         statusCode: { 401: function() { alert('Logged Out') } }
    });
} catch (exception) {
    document.execCommand("ClearAuthenticationCache");
} 
return false;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top