environments/ppa-mbqj77/deployments/1
parent
82fd48c92e
commit
5ba1178057
@ -0,0 +1,145 @@ |
||||
#!/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__"; |
||||
my $portal_url = "http://auth.__DNSDOMAIN__"; |
||||
|
||||
# CSS |
||||
my $css = <<EOT; |
||||
body{ |
||||
background:$color; |
||||
font-family:sans-serif; |
||||
font-size:11pt; |
||||
padding:0 5%; |
||||
margin:0; |
||||
} |
||||
#content{ |
||||
background:#fff; |
||||
padding:10px; |
||||
} |
||||
#menu{ |
||||
text-align:center; |
||||
margin-top:30px; |
||||
} |
||||
a{ |
||||
text-decoration:none; |
||||
font-weight:bold; |
||||
} |
||||
h1{ |
||||
font-size:16pt; |
||||
text-align:center; |
||||
margin:5px 100px; |
||||
border:2px solid $color; |
||||
} |
||||
h2{ |
||||
border-bottom:2px solid $color; |
||||
} |
||||
p.note{ |
||||
border:1px solid #ccc; |
||||
padding:5px; |
||||
background:#eee; |
||||
} |
||||
table{ |
||||
border:1px solid #ccc; |
||||
border-collapse:collapse; |
||||
margin:5px 0; |
||||
width:100%; |
||||
font-size:small; |
||||
} |
||||
tr{ |
||||
border:1px dotted #ccc; |
||||
} |
||||
tr:hover{ |
||||
background:#eee; |
||||
} |
||||
th{ |
||||
background:#eee; |
||||
} |
||||
td, th{ |
||||
padding:3px 5px; |
||||
} |
||||
td.emphase{ |
||||
background-color:#eee; |
||||
font-weight:bold; |
||||
} |
||||
EOT |
||||
|
||||
# Read headers |
||||
my %headers; |
||||
foreach(sort keys %ENV) { |
||||
if($_ =~ /^HTTP_/) { |
||||
($a=$_) =~ s/^HTTP_//i; |
||||
$a = join '-', map {ucfirst(lc)} split '_',$a; |
||||
$headers->{$a} = $_; |
||||
} |
||||
} |
||||
|
||||
# Display page |
||||
print $cgi->header; |
||||
print $cgi->start_html( -title => "$name", |
||||
-style => { -code => $css } ); |
||||
|
||||
print "<div id=\"content\">\n"; |
||||
|
||||
print "<h1>$name</h1>\n"; |
||||
|
||||
print "<div id=\"menu\"><a href=\"$portal_url\">Portal</a> - <a href=\"/logout\">Logout</a></div>\n"; |
||||
|
||||
print "<h2>Main informations</h2>\n"; |
||||
print "<ul>\n"; |
||||
print "<li>Authentication status: SUCCESS</li>\n"; |
||||
print "<li>Connected user: <ul>\n"; |
||||
print "<li><tt>\$ENV{HTTP_AUTH_USER}</tt>: $ENV{HTTP_AUTH_USER}</li>\n"; |
||||
print "<li><tt>\$ENV{REMOTE_USER}</tt>: $ENV{REMOTE_USER}</li>\n"; |
||||
print "</ul></li>\n"; |
||||
print "</ul>\n"; |
||||
print "<p class=\"note\">Be carefull, the <tt>\$ENV{REMOTE_USER}</tt> is set only if your script is |
||||
in the same server than Lemonldap::NG Handler (<tt>\$whatToTrace</tt> parameter). If you use |
||||
it on a reverse-proxy, <tt>\$ENV{REMOTE_USER}</tt> is not set.</p>\n"; |
||||
|
||||
print "<h2>HTTP headers</h2>\n"; |
||||
print "<p>To know who is connected in your applications, you can read HTTP headers:</p>\n"; |
||||
print "<table>\n"; |
||||
print "<tr><th>Header</th><th>Perl CGI</th><th>PHP script</th><th>Value</th></tr>\n"; |
||||
foreach(sort keys %$headers) { |
||||
$style = $_ eq 'Auth-User' ? 'class="emphase"' : ''; |
||||
print "<tr> |
||||
<td $style>$_</td> |
||||
<td $style><tt>\$ENV{$headers->{$_}}</tt></td> |
||||
<td $style><tt>\$_SERVER{$headers->{$_}}</tt></td> |
||||
<td $style>$ENV{$headers->{$_}}</td> |
||||
</tr>\n" |
||||
} |
||||
print "</table>\n"; |
||||
print "<p class=\"note\">Note that Lemonldap::NG cookie is hidden. So that application developpers can |
||||
not spoof sessions.</p>\n"; |
||||
print "<p class=\"note\">You can access to any information (IP address or LDAP attribute) by customizing |
||||
exported headers with the <a href=\"$manager_url\">Lemonldap::NG Management interface</a></p>\n"; |
||||
|
||||
print "<h2>Environment for Perl CGI</h2>\n"; |
||||
print "<table>\n"; |
||||
print "<tr><th>Environment variable</th><th>Value</th></tr>\n"; |
||||
foreach(sort keys %ENV) { |
||||
my $tmp = $ENV{$_}; |
||||
$tmp =~ s/&/&/g; |
||||
$tmp =~ s/>/>/g; |
||||
$tmp =~ s/</</g; |
||||
print "<tr><td>$_</td><td>=> $tmp</td></tr>\n"; |
||||
} |
||||
print "</table>\n"; |
||||
print "</div>\n"; |
||||
print $cgi->end_html; |
||||
|
||||
@ -1,5 +1,5 @@ |
||||
Revision history for Perl extension Lemonldap::NG::Common. |
||||
|
||||
0.1 Mon Nov 17 16:34:56 2008 |
||||
0.9 Mon Nov 17 16:34:56 2008 |
||||
- New package including the old Lemonldap::NG::manager::Conf |
||||
|
||||
|
||||
@ -0,0 +1,43 @@ |
||||
# |
||||
# This file contains parameters used by Lemonldap::NG to find its configuration |
||||
# |
||||
# |
||||
# 1 - Type |
||||
# |
||||
# You can use one of the following: |
||||
# * File: you have to set 'dirName' parameter. Example: |
||||
# |
||||
# type = File |
||||
# dirName = /var/lib/lemonldap-ng/conf |
||||
# |
||||
# * DBI : you have to set 'dbiChain' (required) and 'dbiUser' and 'dbiPassword' |
||||
# if needed. Example: |
||||
# |
||||
# type = DBI |
||||
# dbiChain = DBI:mysql:database=lemonldap-ng;host=1.2.3.4 |
||||
# dbiUser = lemonldap |
||||
# dbiPassword = password |
||||
# |
||||
# * SOAP: SOAP configuration access is a sort of proxy: the SOAP server that |
||||
# runs Lemonldap::NG::Manager::SOAPServer is configured to use the real |
||||
# session storage type (DBI or File for example). |
||||
# You have to set 'proxy' parameter. Example: |
||||
# |
||||
# type = SOAP |
||||
# proxy = https://manager.example.com/soapmanager.pl |
||||
# proxyOptions = { timeout => 5 } |
||||
# User = lemonldap |
||||
# Password = mypassword |
||||
# |
||||
# 2 - LocalStorage |
||||
# |
||||
# To increase performances, use a local cache for the configuration. You have |
||||
# to choose a Cache::Cache module and set it's parameters (1 line). Example: |
||||
# |
||||
# localStorage = Cache::FileCache |
||||
# localStorageOptions = { 'namespace' => 'MyNamespace', 'default_expires_in' => 600, 'directory_umask' => '007', 'cache_root' => '/tmp', 'cache_depth' => 5, } |
||||
|
||||
type = File |
||||
dirName = /var/lib/lemonldap-ng/conf |
||||
localStorage = Cache::FileCache |
||||
localStorageOptions = { 'namespace' => 'MyNamespace', 'default_expires_in' => 600, 'directory_umask' => '007', 'cache_root' => '/tmp', 'cache_depth' => 5, } |
||||
@ -1,22 +0,0 @@ |
||||
CREATE TABLE lmConfig ( |
||||
cfgNum int not null primary key, |
||||
locationRules text, |
||||
exportedHeaders text, |
||||
globalStorage text, |
||||
globalStorageOptions text, |
||||
macros text, |
||||
groups text, |
||||
portal text, |
||||
domain text, |
||||
ldapServer text, |
||||
ldapPort int, |
||||
ldapBase text, |
||||
securedCookie int, |
||||
cookieName text, |
||||
authentication text, |
||||
exportedVars text, |
||||
managerDn text, |
||||
managerPassword text, |
||||
timeout int, |
||||
whatToTrace text |
||||
); |
||||
@ -1,29 +0,0 @@ |
||||
#!/usr/bin/perl |
||||
|
||||
# Set here the session storage you use |
||||
$sessionStorage = 'Apache::Session::File'; |
||||
$sessionStorageOptions = { |
||||
Directory => '__SESSIONDIR__', |
||||
}; |
||||
|
||||
############ |
||||
usage() unless($ARGV[0]); |
||||
|
||||
eval "use $sessionStorage"; |
||||
die $@ if($@); |
||||
|
||||
tie %h, $sessionStorage, $ARGV[0], $sessionStorageOptions; |
||||
|
||||
print "Attributes and macros :\n"; |
||||
my @t = sort keys(%h); |
||||
print "$_ " foreach(@t); |
||||
print "\n"; |
||||
foreach my $k ( sort keys(%h) ) { |
||||
next if($k eq 'groups'); |
||||
print "\t$k\t=> $h{$k}\n"; |
||||
} |
||||
|
||||
if( $h{groups} ) { |
||||
print "Groups :\n"; |
||||
print "\t$_\n" foreach( sort split /\s+/, $h{groups} ); |
||||
} |
||||
Loading…
Reference in new issue