#!/usr/bin/perl #================================================ # LemonLDAP::NG default test page # Display headers and environment #================================================ # Init CGI use CGI; my $cgi = CGI->new; # GET parameters my $name = $cgi->param("name") || "LemonLDAP::NG sample protected application"; my $color = $cgi->param("color") || "#ddd"; # Local parameters my $manager_url = "http://manager.__DNSDOMAIN__"; # CSS my $css = <{$a} = $_; } } # Display page print $cgi->header(-charset => 'utf-8'); print $cgi->start_html( -title => "$name", -style => { -code => $css } ); print "
\n"; print "

$name

\n"; print "

Main informations

\n"; print "\n"; print "

Be carefull, the \$ENV{REMOTE_USER} is set only if your script is in the same server than LemonLDAP::NG Handler (\$whatToTrace parameter). If you use it on a reverse-proxy, \$ENV{REMOTE_USER} is not set.

\n"; print "

HTTP headers

\n"; print "

To know who is connected in your applications, you can read HTTP headers:

\n"; print "\n"; print "\n"; foreach(sort keys %$headers) { next if $_ =~ /(Accept|Cache|User-Agent|Connection|Keep-Alive)/i; $style = $_ eq 'Auth-User' ? 'class="emphase"' : ''; print "\n"; } print "
HeaderPerl CGIPHP scriptValue
$_ \$ENV{$headers->{$_}} \$_SERVER{$headers->{$_}}
    "; foreach( split( /;/, $ENV{$headers->{$_}} ) ) { print "
  • $_
  • " if $_ ne " "; } print "☒" unless $ENV{$headers->{$_}}; print "
\n"; print "

Note that LemonLDAP::NG cookie is hidden. So that application developpers can not spoof sessions.

\n"; print "

You can access to any information (IP address or LDAP attribute) by customizing exported headers with the LemonLDAP::NG Management interface

\n"; print "

Script parameters

\n"; print "

Find here all GET or POST parameters sent to this page:

\n"; print "\n"; print "\n"; foreach(sort $cgi->param()) { my $tmp = $cgi->param($_); print "\n"; } print "

POST parameters can be forged by LemonLDAP::NG to autosubmit forms

\n"; print "
ParameterValue
$_ $tmp
\n"; print "

Environment for Perl CGI

\n"; print "\n"; print "\n"; foreach(sort keys %ENV) { my $tmp = $ENV{$_}; $tmp =~ s/&/&/g; $tmp =~ s/>/>/g; $tmp =~ s/\n"; } print "
Environment variableValue
$_ $tmp
\n"; print "
\n"; print $cgi->end_html;