<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>RE: [Nagios-users] Advanced authentication</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>> applications.  Once they're logged in there, we would pass their username<BR>
> over to Nagios via URL querystring or hidden form value, etc (not going for<BR>
> maximum security). <BR>
<BR>
Indeed not, anyone who wants can pretend to be anyone else. Still, if it's an<BR>
internal intranet, and you capture the IP addresses, you can find out whodunit<BR>
<BR>
> On the Nagios server we would use PHP to populate the<BR>
> REMOTE_USER Apache ENV variable with the passed username so that Nagios can<BR>
> compare that to the contacts and provide them with their applicable views.<BR>
<BR>
I'm afraid you can't do that. You would set the REMOTE_USER (or any other env)<BR>
for the scope of that PHP page ONLY.<BR>
<BR>
One option would be to edit all the nagios CGIs to look for the username in<BR>
the query string, and set the variable at the top of the CGI (in main). Or<BR>
replace all instances of ENV.REMOTE_USER with a function which<BR>
<BR>
Another option might be to execute the cgi's from a PHP page which pre-sets<BR>
the username. You could use mod_rewrite to rewrite *.cgi to<BR>
"nagportal.php?cgi=*.cgi".<BR>
<BR>
In both cases you would have to maintain the username throughout the session.<BR>
If you edit all the links in nagios on the fly to pass in a new username,<BR>
(change status.cgi to status.cgi?username=bob), you would have a problem with<BR>
people emailing links to others.<BR>
<BR>
One option for this would be to use PHP's session capabilities to store the username.<BR>
You would set a cookie with the username in and read it on each call. That would<BR>
work with both the php and the editing-the-cgi way.<BR>
<BR>
Both of those solutions are a fair amount of effort.<BR>
<BR>
A final solution could be using the apache module "SetEnvIf". Something like<BR>
 SetEnvIf "Cookies:.*loginname=(username);.*" REMOTE_USER=\1<BR>
<BR>
But I don't think SetEnvIf will let you do that.<BR>
<BR>
What you're trying to do isn't that easy, as it goes against normal authentication<BR>
practices.<BR>
<BR>
> Is it necessary to modify the Nagios/cgi config in any way to achieve what<BR>
> we're doing?<BR>
<BR>
Perhaps<BR>
<BR>
> Is is necessary to modify the Apache config?<BR>
Perhaps<BR>
<BR>
> Is is necessary to set any other ENV variables besides REMOTE_USER?<BR>
No<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>