Code

* Moved README's to the central doc/ directory
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 11 Jul 2007 05:59:47 +0000 (05:59 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 11 Jul 2007 05:59:47 +0000 (05:59 +0000)
* Removed goSamba.pl. It's obsoleted by the use of gopdc
* Moved goNagios.pl to the contrib/scripts
* Updated debian infrastructure to reflect the changes

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6818 594d385d-05f5-0310-b6e9-bd551577e9d8

15 files changed:
contrib/opensides/README.OpenSides [deleted file]
contrib/opensides/glpi.README [deleted file]
contrib/opensides/goNagios.pl [deleted file]
contrib/opensides/goSamba.pl [deleted file]
contrib/opensides/nagios.README [deleted file]
contrib/opensides/phpscheduleit.README [deleted file]
contrib/opensides/pptp.README [deleted file]
contrib/opensides/xls-export.README [deleted file]
contrib/scripts/goNagios.pl [new file with mode: 0755]
debian/rules
doc/README.glpi [new file with mode: 0644]
doc/README.nagios [new file with mode: 0644]
doc/README.phpscheduleit [new file with mode: 0644]
doc/README.pptp [new file with mode: 0644]
doc/README.xls-export [new file with mode: 0644]

diff --git a/contrib/opensides/README.OpenSides b/contrib/opensides/README.OpenSides
deleted file mode 100644 (file)
index d5e9e78..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-goSamba.pl - This script will help you populate your ldap tree with
-            the correct attribute when using the smbldap-tools
-            from idealx.
-
-goNagios.pl - This script will help you to manage the authentification
-              users inside of the cgi.cfg, contacts.cfg, contactgroups.cfg
-nagios.README - how to make the nagios plugin work
-
-pptp.README - how to make the pptp connectivity extension work
-
-phpscheduleit.README - how to make the phpscheduleit extension work
-
-xls-export.README - how to make the xls export xork
-
-
-The php_writeexcel library is coming from
-
-http://www.bettina-attack.de/jonny/projects/php_writeexcel/
-
-Author : <jonny@1409.org>
-
-LICENSE : GNU LESSER GENERAL PUBLIC LICENSE
-
-Bug: 
-
-It doesn't work on php5 we are working on it.
-
-Benoit Mortier <benoit.mortier@opensides.be>
-Guillaume Delecourt <guillaume.delecourt@opensides.be>
-Vincent Seynhaeve <vincent.seynhaeve@opensides.be>
diff --git a/contrib/opensides/glpi.README b/contrib/opensides/glpi.README
deleted file mode 100644 (file)
index 52cfcf2..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-To use the glpi connectivity extension
-
-1) Add the glpi.schema to your schema directory
-
-2) Remove the comment in front of glpiAccount in gosa.conf
-
-<!--    <tab class="glpiAccount" /> -->
-
-Benoit Mortier
-OpenSides November 2005
-
-
-
diff --git a/contrib/opensides/goNagios.pl b/contrib/opensides/goNagios.pl
deleted file mode 100755 (executable)
index 754681d..0000000
+++ /dev/null
@@ -1,391 +0,0 @@
-#!/usr/bin/perl -w
-
-
-# Copyright (C) 2005 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-# Copyright (C) 2005 Vincent Senave <vincent.senave@opensides.be>
-#
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-#
-
-use Net::LDAP;
-use Getopt::Std;
-use Net::LDAP::Schema;
-use Net::LDAP::LDIF;
-use Data::Dumper;
-use MIME::Lite;
-use Sys::Syslog;
-use Switch; 
-use strict;
-
-# Variables a config
-
-my $admindef="admin";
-
-my $cgi_file="cgi.cfg";
-my $contacts_file="contacts.cfg";
-my $contacts_groups_file="contactgroups.cfg";
-
-my $TS_FILE='/tmp/gosa_timestamp';
-my %Options;
-my $nb_user=0;
-my $nb_groupe=0;
-
-my ($i,$file,$ldap,@nagiosmail,
-       $line,$text,$mesg,$entry,$userlist1,$userlist2,$userlist3,$userlist4,
-       $userlist5,$userlist6,$userlist7,$msg,@groupname,@groupmembers,@contactlias,
-       @groupdescription,@servicenotificationoptions,@servicenotificationperiod,
-       @hostnotificationoptions,@hostnotificationperiod,$stdout,
-       $usercontact,$members,@contactname,@nagiosalias,$j,@entries
-);
-
-# Les parametres de connexion proviennent du fichier smbldap-bind.conf
-my $gosa_bind_conf="/etc/gosa_bind.conf";
-my $gosa_ldap_conf="/etc/gosaldap.conf";
-my %config_bind = &read_conf($gosa_bind_conf);
-my %config = &read_conf($gosa_ldap_conf);
-
-my $peopleou=$config{peopleou};
-my $groupeou=$config{groupeou};
-my $base=$config{base};
-my $scope=$config{scope};# par defaut
-my $server=$config{server};
-
-my $admin=$config_bind{masterDN};
-my $password=$config_bind{masterPw};
-
-
-       $stdout.="\n\nSearch new Nagios attribute in user list\n";
-       $stdout.="-"x55;$stdout.="\n";
-       #my $ts = getTS;
-
-#      $ldap = &anonBind;
-#      $mesg = $ldap->search(
-#      base => $LDAP_BASE,
-#      filter => "(&(modifyTimestamp>=$ts)(!(objectClass=gosaUserTemplate)))"
-#      );
-
-       # Put timestamp to file
-       #putTS;
-
-       # Work if changes is present
-       #if($mesg->count > 0)
-       #{
-       #$stdout.="Processing records modified after $ts\n\n";
-       $ldap = Net::LDAP->new($server);
-       $mesg = $ldap->bind($admin,password=>$password) or syslog('error',$mesg->err) && print $mesg->code && die $mesg->error;
-
-       
-
-       #Partie pour l'objectClass NAgios Contact
-       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosContact))", base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-       $i=0;
-       foreach $entry (@entries) {
-       $stdout.="\nContact $i : \nName\t\t\t";$contactname[$i]=$entry->get_value('uid');$stdout.=$contactname[$i];
-       $stdout.="\n\n\tmail:\t\t\t\t";$nagiosmail[$i]=$entry->get_value('NagiosMail');$stdout.=$nagiosmail[$i];
-       $stdout.="\n\talias:\t\t\t\t";$nagiosalias[$i]=$entry->get_value('NagiosAlias');$stdout.=$nagiosalias[$i];
-       $stdout.="\n\tHostNotificationPeriod:\t\t";$hostnotificationperiod[$i]=$entry->get_value('HostNotificationPeriod');$stdout.=$hostnotificationperiod[$i];
-       $stdout.="\n\tServiceNotificationPeriod:\t";$servicenotificationperiod[$i]=$entry->get_value('ServiceNotificationPeriod');$stdout.=$servicenotificationperiod[$i];
-       $stdout.="\n\tHostNotificationOptions:\t";$hostnotificationoptions[$i]=$entry->get_value('HostNotificationOptions');$stdout.=$hostnotificationoptions[$i];
-       $stdout.="\n\tServiceNotificationOptions:\t";$servicenotificationoptions[$i]=$entry->get_value('ServiceNotificationOptions');$stdout.=$servicenotificationoptions[$i];
-       $stdout.="\n"." "x15;$stdout.="-"x20;$stdout.=" "x 15;                          
-       $usercontact.=$entry->get_value('uid')."  ,";
-       $i++;
-       }
-       $nb_user=$i;
-               
-               
-       #Partie pour l'objectClass NAgios Group
-       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosContactGroup))", base=>$groupeou,scope=>$scope);
-       @entries = $mesg->entries;
-       $i=0;
-       foreach $entry (@entries) {
-       $stdout.="\nGroupe $i : \nName\t\t";$groupname[$i]=$entry->get_value('cn');$stdout.=$groupname[$i];
-       $stdout.="\n\n\talias:\t\t";$groupdescription[$i]=$entry->get_value('description');$stdout.=$groupdescription[$i];
-       $stdout.="\n\tmembers:\t";
-       $j=0;
-       foreach $members($entry->get_value('memberUid'))
-       {
-       $stdout.=$members." ";
-       $groupmembers[$i][$j]=$members;
-       $j++;
-       }
-       $stdout.="\n"." "x15;$stdout.="-"x20;$stdout.=" "x 15;                  
-       $i++;
-       }
-       $nb_groupe=$i;
-
-               $userlist1.=$admindef;
-
-       #Partie pour l'objectClass NagiosAuth
-       $stdout.="\n\n\n\n\nAuthorization for the different Information in Nagios\n"."-" x 53;$stdout.="\n";
-       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedSystemInformation~=checked))", base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-       $stdout.="\nSystem infos :\t\t";
-       foreach $entry (@entries) {
-       $stdout.= $entry->get_value('uid')."\t";
-       $userlist1.=$entry->get_value('uid')."  ,";
-       }
-       $userlist1.=$admindef;
-
-       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedConfigurationInformation~=checked))", base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-       $stdout.="\nConfiguration infos :\t";
-       foreach $entry (@entries) {
-       $stdout.= $entry->get_value('uid')."\t";
-       $userlist2.=$entry->get_value('uid')." , ";
-       }
-       $userlist2.=$admindef;
-
-       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedSystemCommands~=checked))", base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-       $stdout.="\nSystem commands : \t";
-       foreach $entry (@entries) {
-       $stdout.= $entry->get_value('uid')."\t";
-       $userlist3.=$entry->get_value('uid')." , ";
-       }
-       $userlist3.=$admindef;
-
-       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedAllServices~=checked))", base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-       $stdout.="\nAll services :\t\t";
-       foreach $entry (@entries) {
-       $stdout.= $entry->get_value('uid')."\t";
-       $userlist4.=$entry->get_value('uid')." ,";
-       }
-       $userlist4.=$admindef;
-
-       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedAllHosts~=checked))", base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-       $stdout.="\nAll hosts :\t\t";
-       foreach $entry (@entries) {
-       $stdout.= $entry->get_value('uid')."\t";
-       $userlist5.=$entry->get_value('uid').",";
-       }
-       $userlist5.=$admindef;
-
-
-       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedAllServiceCommands~=checked))", base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-       $stdout.="\nAll services commands :\t";
-       foreach $entry (@entries) {
-       $stdout.= $entry->get_value('uid')."\t";
-       $userlist6.=$entry->get_value('uid').",";
-       }
-       $userlist6.=$admindef;
-
-       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedAllHostCommands~=checked))",base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-       $stdout.="\nAll host commands :\t";
-       foreach $entry (@entries) {
-       $stdout.= $entry->get_value('uid')."\t";
-       $userlist7.=$entry->get_value('uid').",";
-       }
-       $userlist7.=$admindef;
-
-
-       &modiffile_cgi($cgi_file);
-       &modiffile_contact($contacts_file);
-       &modiffile_group($contacts_groups_file);
-       
-       $ldap->unbind;
-       $stdout.="\n";
-       switch($config{stdout})
-       {
-       case "mail"     {&mail()}
-       case "log"      {&writelog()}
-       case "normal"   {print $stdout}
-       }
-       exit(0);
-
-sub modiffile_contact()
-{
-       $file=$_[0];
-       my $text="";
-       open(FH,"$file") || die "Probleme d'ouverture du fichier $file";
-       $stdout.="\n\n"; $stdout.=" "x10;$stdout.="-"x25;$stdout.=" "x10;
-       $stdout.="\n\n$nb_user utilisateur(s) ajouté(s) dans le fichier $file\n";
-       for($i=0;$i<$nb_user;$i++)
-       {
-               $text.="\n\ndefine contact{\n";
-               $text.="\n\tcontact_name \t\t\t".$contactname[$i];
-               $text.="\n\talias \t\t\t\t".$nagiosalias[$i];
-               $text.="\n\thost_notification_period \t".$hostnotificationperiod[$i];
-               $text.="\n\thost_notification_options \t".$hostnotificationoptions[$i];
-               $text.="\n\tservice_notification_period \t".$servicenotificationperiod[$i];
-               $text.="\n\tservice_notification_options \t".$servicenotificationoptions[$i];
-               $text.="\n\temail \t\t\t\t".$nagiosmail[$i];
-               $text.="\n}\n\n";
-       }
-       close(FH);
-       open(FH,"> $file") || die "Probleme d'ouverture du fichier $file";
-       print  FH "$text";
-       close(FH);
-       
-}
-
-sub modiffile_group()
-{
-       $file=$_[0];
-       $text="";
-       $j=0;
-       $i=0;
-       open(FH,"$file") || die "Probleme d'ouverture du fichier $file";
-       $stdout.="\n\n"; $stdout.=" "x10;$stdout.="-"x25;$stdout.=" "x10;
-       $stdout.="\n\n$nb_groupe groupe(s) ajouté(s) dans le fichier $file\n";
-       for($i=0;$i<$nb_groupe;$i++)
-       {
-               $text.="\n\ndefine contact{\n";
-               $text.="\n\tcontactgroup_name \t".$groupname[$i];
-               $text.="\n\talias \t\t\t".$groupdescription[$i];
-               $text.="\n\tmembers \t\t";
-               while(defined($groupmembers[$i][$j]))
-               {
-                       $text.=$groupmembers[$i][$j]." ";
-                       $j++;
-               }
-               $text.="\n}\n\n";
-       }
-       
-       close(FH);
-       open(FH,"> $file") || die "Probleme d'ouverture du fichier $file";
-       print FH "$text";
-       close(FH);
-       
-}
-
-sub modiffile_cgi()
-{
-       $file=$_[0];
-       $text="";
-       open(FH,"$file") || die "Probleme d'ouverture du fichier $file";
-       while(<FH>)
-       {       
-               $line=$_;
-               #$stdout.="$line";
-               if($line =~ /^authorized_for_system_information=*/i){$text.="authorized_for_system_information=".$userlist1}
-               elsif($line =~ /^authorized_for_configuration_information=*/i){$text.="authorized_for_configuration_information=".$userlist2}
-               elsif($line =~ /^authorized_for_system_commands=*/i){$text.="authorized_for_system_commands=".$userlist3}
-               elsif($line =~ /^authorized_for_all_services=*/i){$text.="authorized_for_all_services=".$userlist4."\n"}
-               elsif($line =~ /^authorized_for_all_hosts=*/i){$text.="authorized_for_all_hosts=".$userlist5}
-               elsif($line =~ /^authorized_for_all_service_commands=*/i){$text.="authorized_for_all_host_commands=".$userlist6."\n"}
-               elsif($line =~ /^authorized_for_all_host_commands=*/i){$text.="authorized_for_all_service_commands=".$userlist7}
-               else {$text.=$line};
-       }
-       close(FH);
-       open(FH,"> $file") || die "Probleme d'ouverture du fichier $file";
-       print FH "$text";
-       close(FH);
-       
-}
-
-sub read_conf()
-{
-        my %conf;
-        open (CONFIGFILE, "$_[0]") || die "Unable to open $_[0] for reading !\n";
-        while (<CONFIGFILE>) {
-                chomp($_);
-                ## throw away comments
-                next if ( /^\s*#/ || /^\s*$/ || /^\s*\;/);
-                ## check for a param = value
-                my ($parameter,$value)=read_parameter($_);
-                $value = &subst_configvar($value,\%conf);
-                $conf{$parameter}=$value;
-          }
-        close (CONFIGFILE);
-        return(%conf);
-}
-
-
-
-
-sub read_parameter
-{
-        my $line=shift;
-        ## check for a param = value
-        if ($_=~/=/) {
-          my ($param,$val);
-          if ($_=~/"/) {
-                #my ($param,$val) = ($_=~/(.*)\s*=\s*"(.*)"/);
-                ($param,$val) = /\s*(.*?)\s*=\s*"(.*)"/;
-          } elsif ($_=~/'/) {
-                ($param,$val) = /\s*(.*?)\s*=\s*'(.*)'/;
-          } else {
-                ($param,$val) = /\s*(.*?)\s*=\s*(.*)/;
-          }
-          return ($param,$val);
-        }
-}
-
-sub subst_configvar
-{
-        my $value = shift;
-        my $vars = shift;
-
-        $value =~ s/\$\{([^}]+)\}/$vars->{$1} ? $vars->{$1} : $1/eg;
-        return $value;
-}
-
-sub mail
-{
-
-if($config{email}eq ""){$config{email}="root"}
-
-$msg = MIME::Lite->new(
-             From     => 'monperl@opensides.be',
-             To       => $config{email},
-             Subject  => "Plugin Nagios Gosa",
-             Data     => $stdout
-             );
-
-
-$msg->send;
-}
-
-sub writelog
-{
-       open(F, "> $config{logfile}");
-       print F $stdout;
-       close(F);
-}
-
-# Read timestamp
-sub getTS
-{
-       open(F, "< $TS_FILE");
-       my $ts = <F>;
-       chop $ts;
-       $ts ||= "19700101000000Z";
-       return $ts;
-}
-
-# save timestamp
-sub putTS
-{
-       my $ts = `date -u '+%Y%m%d%H%M%SZ'`;
-       open(F, "> $TS_FILE");
-       $stdout.= F $ts;
-}
-
-#connexion anonyme
-sub anonBind
-{
-       my $ldap = Net::LDAP->new( $server);
-       my $mesg = $ldap->bind();
-       $mesg->code && die $mesg->error;
-       return $ldap;
-}
diff --git a/contrib/opensides/goSamba.pl b/contrib/opensides/goSamba.pl
deleted file mode 100755 (executable)
index ef7b210..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-#!/usr/bin/perl
-
-
-# Copyright (C) 2005 Guillaume Delecourt <guillaume.delecourt@opensides.be>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-#
-
-use Net::LDAP;
-use Getopt::Std;
-use Net::LDAP::Schema;
-use Net::LDAP::LDIF;
-
-# Variables a config
-$admin="cn=ldapadmin,dc=example,dc=be";
-$password="";
-$peopleou="ou=People,dc=example,dc=be";
-$base="dc=example,dc=be";
-$scope="one"; # par defaut
-$dump_file="myldaptree.ldif";
-$server="localhost";
-
-
-my %Options;
-
-my $ok = getopts('?', \%Options);
-
-#Verifying if help is needed
-if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) ) {
-       &help();
-}
-
-print "We backup the whole tree before every operation\n";
-&dump();
-
-$comm=$ARGV[0];
-
-if($comm eq "del" && @ARGV >1 )
-{      
-       print "You asked to delete attribute : ";
-       $i=1;
-       while($ARGV[$i] ne "")
-       {       
-                       print $ARGV[$i]." ";
-                       $i++;
-       }
-       print "\n";
-       $ldap = Net::LDAP->new($server);
-       $ldap->bind($admin,password=>$password);
-
-
-       print "ldap connection" .$ldap;
-
-       $mesg = $ldap->search(filter=>"(objectClass=*)",base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-
-       foreach $entry (@entries) {
-               $i=1;
-               print $entry->dn()."\n";
-               while($ARGV[$i] ne "")
-               {       
-                       if($ARGV[$i] eq "obj"){$obj=1;$i++;next}
-                       if($obj==1)
-                       {
-                               $mesg = $ldap->modify($entry->dn(), delete => {"ObjectClass"=>"$ARGV[$i]"});
-                               print "\t objectClass: ".$ARGV[$i];
-                       }
-                       else
-                       {
-                               $mesg = $ldap->modify($entry->dn(), delete => [$ARGV[$i]]);
-                               print "\t attribut: ".$ARGV[$i];
-                       }
-                       $obj=0;
-                       $i++;
-               }
-               
-               print "\n";
-       }
-       $ldap->unbind;
-       exit(0);
-}
-elsif($comm eq "gosa" && @ARGV ==1)
-{
-       print "Add GOsa attribute for the following users\n";
-       print "---------------------------------------------\n";
-       $ldap = Net::LDAP->new($server);
-       $ldap->bind($admin,password=>$password);
-       $mesg = $ldap->search(filter=>"&(!(objectClass~=gosaAccount))", base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-
-       foreach $entry (@entries) {
-               $mesg = $ldap->modify($entry->dn(), add => { "ObjectClass" => "gosaAccount"});
-               $mesg = $ldap->modify($entry->dn(), add => { "ObjectClass" => "organizationalPerson"});
-               $mesg = $ldap->modify($entry->dn(), add => { "ObjectClass" => "Person"});
-               print $entry->dn();
-               print "\n";
-       }
-       $ldap->unbind;
-       exit(0);
-}
-elsif($comm eq "modif" && @ARGV >1)
-{
-       print "Modifications asked\n";
-       print "------------------------\n";
-       $ldap = Net::LDAP->new($server);
-       $ldap->bind($admin,password=>$password);
-
-       $mesg = $ldap->search(filter=>"(objectClass=*)",base=>$peopleou,scope=>$scope);
-       @entries = $mesg->entries;
-       foreach $entry (@entries) {
-       $mesg = $ldap->modify($entry->dn(), replace => { "$ARGV[1]" => "$ARGV[2]" } );
-       print $entry->dn()."\n\tattribut $ARGV[1] modifié avec la valeur $ARGV[2]\n";
-       }
-       $ldap->unbind;
-       exit(0);
-}
-elsif($comm eq "dump" && @ARGV ==1)
-{
-       &dump();
-}
-else
-{
-       &help();
-}
-
-sub help()
-{
-    print_banner;
-    print "Usage: $0 [-?] command\n";
-    print "\t-?        show this help message\n";
-    print "\tgosa -> add GOsa attributes for the whole the people branch !\n";
-    print "\tdel attribut  -> Remove an attribute for the whole people branch !\n";
-    print "\tmodif <attribute> <attribute value> -> to modify the attribute\n";
-    print "\tdump to dump the whole ldap tree\n";
-    exit (1);
-}
-
-sub dump()
-{
-    $ldap = Net::LDAP->new($server) or die "$@";
-    $ldap->bind($admin,password=>$password);
-    my $ldif = Net::LDAP::LDIF->new($dump_file,'w') ;
-    $mesg = $ldap->search ( 
-                               base   => "$base",
-                               filter => "(objectclass=*)"
-                       );
-    $ldif->write_entry($mesg->entries) ;
-    $ldap->unbind;
-}
diff --git a/contrib/opensides/nagios.README b/contrib/opensides/nagios.README
deleted file mode 100644 (file)
index 5878e40..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-To use the nagios plugin
-
-1) Add the nagios schema to your schema directory
-
-2) Remove the comment in front of nagiosAccount in gosa.conf
-
-<!--                     <plugin acl="default" class="nagiosAccount" icon="monitoring.png"
-                                path="plugins/personal/nagios" /> -->
-
-
-<!--    <nagios>
-                <tab class="nagiosAccount" />
-        </nagios> -->
-
-Benoit Mortier
-Guillaume Delecourt
-OpenSides October-November 2005
-
-
-
diff --git a/contrib/opensides/phpscheduleit.README b/contrib/opensides/phpscheduleit.README
deleted file mode 100644 (file)
index 4b634c8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-To use the phpscheduleit connectivity extension
-
-1) Add the schema phpscheduleit.schema in your schema directory
-
-2) Remove the comment in front of phpscheduleitAccount in gosa.conf
-
-<!--    <tab class="pptpAccount" /> -->
-
-Guillaume Delecourt
-OpenSides November 2005
diff --git a/contrib/opensides/pptp.README b/contrib/opensides/pptp.README
deleted file mode 100644 (file)
index 556e274..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-To use the pptp connectivity extension
-
-1) Add the pptp.schema to your schema directory
-
-2) Remove the comment in front of pptpAccount in gosa.conf
-
-<!--    <tab class="pptpAccount" /> -->
-
-Guillaume Delecourt
-OpenSides November 2005
-
-
-
diff --git a/contrib/opensides/xls-export.README b/contrib/opensides/xls-export.README
deleted file mode 100644 (file)
index e9b0606..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-To use the xls export ldapamanager addon uncomment the following line in your gosa.conf :
-
-<!--            <tab class="xlsexport" name="Excel Export" />   -->
-
-Guillaume Delecourt
-Vincent Seynhaeve
-OpenSides October 2005
diff --git a/contrib/scripts/goNagios.pl b/contrib/scripts/goNagios.pl
new file mode 100755 (executable)
index 0000000..754681d
--- /dev/null
@@ -0,0 +1,391 @@
+#!/usr/bin/perl -w
+
+
+# Copyright (C) 2005 Guillaume Delecourt <guillaume.delecourt@opensides.be>
+# Copyright (C) 2005 Vincent Senave <vincent.senave@opensides.be>
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+#
+
+use Net::LDAP;
+use Getopt::Std;
+use Net::LDAP::Schema;
+use Net::LDAP::LDIF;
+use Data::Dumper;
+use MIME::Lite;
+use Sys::Syslog;
+use Switch; 
+use strict;
+
+# Variables a config
+
+my $admindef="admin";
+
+my $cgi_file="cgi.cfg";
+my $contacts_file="contacts.cfg";
+my $contacts_groups_file="contactgroups.cfg";
+
+my $TS_FILE='/tmp/gosa_timestamp';
+my %Options;
+my $nb_user=0;
+my $nb_groupe=0;
+
+my ($i,$file,$ldap,@nagiosmail,
+       $line,$text,$mesg,$entry,$userlist1,$userlist2,$userlist3,$userlist4,
+       $userlist5,$userlist6,$userlist7,$msg,@groupname,@groupmembers,@contactlias,
+       @groupdescription,@servicenotificationoptions,@servicenotificationperiod,
+       @hostnotificationoptions,@hostnotificationperiod,$stdout,
+       $usercontact,$members,@contactname,@nagiosalias,$j,@entries
+);
+
+# Les parametres de connexion proviennent du fichier smbldap-bind.conf
+my $gosa_bind_conf="/etc/gosa_bind.conf";
+my $gosa_ldap_conf="/etc/gosaldap.conf";
+my %config_bind = &read_conf($gosa_bind_conf);
+my %config = &read_conf($gosa_ldap_conf);
+
+my $peopleou=$config{peopleou};
+my $groupeou=$config{groupeou};
+my $base=$config{base};
+my $scope=$config{scope};# par defaut
+my $server=$config{server};
+
+my $admin=$config_bind{masterDN};
+my $password=$config_bind{masterPw};
+
+
+       $stdout.="\n\nSearch new Nagios attribute in user list\n";
+       $stdout.="-"x55;$stdout.="\n";
+       #my $ts = getTS;
+
+#      $ldap = &anonBind;
+#      $mesg = $ldap->search(
+#      base => $LDAP_BASE,
+#      filter => "(&(modifyTimestamp>=$ts)(!(objectClass=gosaUserTemplate)))"
+#      );
+
+       # Put timestamp to file
+       #putTS;
+
+       # Work if changes is present
+       #if($mesg->count > 0)
+       #{
+       #$stdout.="Processing records modified after $ts\n\n";
+       $ldap = Net::LDAP->new($server);
+       $mesg = $ldap->bind($admin,password=>$password) or syslog('error',$mesg->err) && print $mesg->code && die $mesg->error;
+
+       
+
+       #Partie pour l'objectClass NAgios Contact
+       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosContact))", base=>$peopleou,scope=>$scope);
+       @entries = $mesg->entries;
+       $i=0;
+       foreach $entry (@entries) {
+       $stdout.="\nContact $i : \nName\t\t\t";$contactname[$i]=$entry->get_value('uid');$stdout.=$contactname[$i];
+       $stdout.="\n\n\tmail:\t\t\t\t";$nagiosmail[$i]=$entry->get_value('NagiosMail');$stdout.=$nagiosmail[$i];
+       $stdout.="\n\talias:\t\t\t\t";$nagiosalias[$i]=$entry->get_value('NagiosAlias');$stdout.=$nagiosalias[$i];
+       $stdout.="\n\tHostNotificationPeriod:\t\t";$hostnotificationperiod[$i]=$entry->get_value('HostNotificationPeriod');$stdout.=$hostnotificationperiod[$i];
+       $stdout.="\n\tServiceNotificationPeriod:\t";$servicenotificationperiod[$i]=$entry->get_value('ServiceNotificationPeriod');$stdout.=$servicenotificationperiod[$i];
+       $stdout.="\n\tHostNotificationOptions:\t";$hostnotificationoptions[$i]=$entry->get_value('HostNotificationOptions');$stdout.=$hostnotificationoptions[$i];
+       $stdout.="\n\tServiceNotificationOptions:\t";$servicenotificationoptions[$i]=$entry->get_value('ServiceNotificationOptions');$stdout.=$servicenotificationoptions[$i];
+       $stdout.="\n"." "x15;$stdout.="-"x20;$stdout.=" "x 15;                          
+       $usercontact.=$entry->get_value('uid')."  ,";
+       $i++;
+       }
+       $nb_user=$i;
+               
+               
+       #Partie pour l'objectClass NAgios Group
+       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosContactGroup))", base=>$groupeou,scope=>$scope);
+       @entries = $mesg->entries;
+       $i=0;
+       foreach $entry (@entries) {
+       $stdout.="\nGroupe $i : \nName\t\t";$groupname[$i]=$entry->get_value('cn');$stdout.=$groupname[$i];
+       $stdout.="\n\n\talias:\t\t";$groupdescription[$i]=$entry->get_value('description');$stdout.=$groupdescription[$i];
+       $stdout.="\n\tmembers:\t";
+       $j=0;
+       foreach $members($entry->get_value('memberUid'))
+       {
+       $stdout.=$members." ";
+       $groupmembers[$i][$j]=$members;
+       $j++;
+       }
+       $stdout.="\n"." "x15;$stdout.="-"x20;$stdout.=" "x 15;                  
+       $i++;
+       }
+       $nb_groupe=$i;
+
+               $userlist1.=$admindef;
+
+       #Partie pour l'objectClass NagiosAuth
+       $stdout.="\n\n\n\n\nAuthorization for the different Information in Nagios\n"."-" x 53;$stdout.="\n";
+       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedSystemInformation~=checked))", base=>$peopleou,scope=>$scope);
+       @entries = $mesg->entries;
+       $stdout.="\nSystem infos :\t\t";
+       foreach $entry (@entries) {
+       $stdout.= $entry->get_value('uid')."\t";
+       $userlist1.=$entry->get_value('uid')."  ,";
+       }
+       $userlist1.=$admindef;
+
+       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedConfigurationInformation~=checked))", base=>$peopleou,scope=>$scope);
+       @entries = $mesg->entries;
+       $stdout.="\nConfiguration infos :\t";
+       foreach $entry (@entries) {
+       $stdout.= $entry->get_value('uid')."\t";
+       $userlist2.=$entry->get_value('uid')." , ";
+       }
+       $userlist2.=$admindef;
+
+       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedSystemCommands~=checked))", base=>$peopleou,scope=>$scope);
+       @entries = $mesg->entries;
+       $stdout.="\nSystem commands : \t";
+       foreach $entry (@entries) {
+       $stdout.= $entry->get_value('uid')."\t";
+       $userlist3.=$entry->get_value('uid')." , ";
+       }
+       $userlist3.=$admindef;
+
+       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedAllServices~=checked))", base=>$peopleou,scope=>$scope);
+       @entries = $mesg->entries;
+       $stdout.="\nAll services :\t\t";
+       foreach $entry (@entries) {
+       $stdout.= $entry->get_value('uid')."\t";
+       $userlist4.=$entry->get_value('uid')." ,";
+       }
+       $userlist4.=$admindef;
+
+       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedAllHosts~=checked))", base=>$peopleou,scope=>$scope);
+       @entries = $mesg->entries;
+       $stdout.="\nAll hosts :\t\t";
+       foreach $entry (@entries) {
+       $stdout.= $entry->get_value('uid')."\t";
+       $userlist5.=$entry->get_value('uid').",";
+       }
+       $userlist5.=$admindef;
+
+
+       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedAllServiceCommands~=checked))", base=>$peopleou,scope=>$scope);
+       @entries = $mesg->entries;
+       $stdout.="\nAll services commands :\t";
+       foreach $entry (@entries) {
+       $stdout.= $entry->get_value('uid')."\t";
+       $userlist6.=$entry->get_value('uid').",";
+       }
+       $userlist6.=$admindef;
+
+       $mesg = $ldap->search(filter=>"(&(objectClass~=nagiosAuth)(AuthorizedAllHostCommands~=checked))",base=>$peopleou,scope=>$scope);
+       @entries = $mesg->entries;
+       $stdout.="\nAll host commands :\t";
+       foreach $entry (@entries) {
+       $stdout.= $entry->get_value('uid')."\t";
+       $userlist7.=$entry->get_value('uid').",";
+       }
+       $userlist7.=$admindef;
+
+
+       &modiffile_cgi($cgi_file);
+       &modiffile_contact($contacts_file);
+       &modiffile_group($contacts_groups_file);
+       
+       $ldap->unbind;
+       $stdout.="\n";
+       switch($config{stdout})
+       {
+       case "mail"     {&mail()}
+       case "log"      {&writelog()}
+       case "normal"   {print $stdout}
+       }
+       exit(0);
+
+sub modiffile_contact()
+{
+       $file=$_[0];
+       my $text="";
+       open(FH,"$file") || die "Probleme d'ouverture du fichier $file";
+       $stdout.="\n\n"; $stdout.=" "x10;$stdout.="-"x25;$stdout.=" "x10;
+       $stdout.="\n\n$nb_user utilisateur(s) ajouté(s) dans le fichier $file\n";
+       for($i=0;$i<$nb_user;$i++)
+       {
+               $text.="\n\ndefine contact{\n";
+               $text.="\n\tcontact_name \t\t\t".$contactname[$i];
+               $text.="\n\talias \t\t\t\t".$nagiosalias[$i];
+               $text.="\n\thost_notification_period \t".$hostnotificationperiod[$i];
+               $text.="\n\thost_notification_options \t".$hostnotificationoptions[$i];
+               $text.="\n\tservice_notification_period \t".$servicenotificationperiod[$i];
+               $text.="\n\tservice_notification_options \t".$servicenotificationoptions[$i];
+               $text.="\n\temail \t\t\t\t".$nagiosmail[$i];
+               $text.="\n}\n\n";
+       }
+       close(FH);
+       open(FH,"> $file") || die "Probleme d'ouverture du fichier $file";
+       print  FH "$text";
+       close(FH);
+       
+}
+
+sub modiffile_group()
+{
+       $file=$_[0];
+       $text="";
+       $j=0;
+       $i=0;
+       open(FH,"$file") || die "Probleme d'ouverture du fichier $file";
+       $stdout.="\n\n"; $stdout.=" "x10;$stdout.="-"x25;$stdout.=" "x10;
+       $stdout.="\n\n$nb_groupe groupe(s) ajouté(s) dans le fichier $file\n";
+       for($i=0;$i<$nb_groupe;$i++)
+       {
+               $text.="\n\ndefine contact{\n";
+               $text.="\n\tcontactgroup_name \t".$groupname[$i];
+               $text.="\n\talias \t\t\t".$groupdescription[$i];
+               $text.="\n\tmembers \t\t";
+               while(defined($groupmembers[$i][$j]))
+               {
+                       $text.=$groupmembers[$i][$j]." ";
+                       $j++;
+               }
+               $text.="\n}\n\n";
+       }
+       
+       close(FH);
+       open(FH,"> $file") || die "Probleme d'ouverture du fichier $file";
+       print FH "$text";
+       close(FH);
+       
+}
+
+sub modiffile_cgi()
+{
+       $file=$_[0];
+       $text="";
+       open(FH,"$file") || die "Probleme d'ouverture du fichier $file";
+       while(<FH>)
+       {       
+               $line=$_;
+               #$stdout.="$line";
+               if($line =~ /^authorized_for_system_information=*/i){$text.="authorized_for_system_information=".$userlist1}
+               elsif($line =~ /^authorized_for_configuration_information=*/i){$text.="authorized_for_configuration_information=".$userlist2}
+               elsif($line =~ /^authorized_for_system_commands=*/i){$text.="authorized_for_system_commands=".$userlist3}
+               elsif($line =~ /^authorized_for_all_services=*/i){$text.="authorized_for_all_services=".$userlist4."\n"}
+               elsif($line =~ /^authorized_for_all_hosts=*/i){$text.="authorized_for_all_hosts=".$userlist5}
+               elsif($line =~ /^authorized_for_all_service_commands=*/i){$text.="authorized_for_all_host_commands=".$userlist6."\n"}
+               elsif($line =~ /^authorized_for_all_host_commands=*/i){$text.="authorized_for_all_service_commands=".$userlist7}
+               else {$text.=$line};
+       }
+       close(FH);
+       open(FH,"> $file") || die "Probleme d'ouverture du fichier $file";
+       print FH "$text";
+       close(FH);
+       
+}
+
+sub read_conf()
+{
+        my %conf;
+        open (CONFIGFILE, "$_[0]") || die "Unable to open $_[0] for reading !\n";
+        while (<CONFIGFILE>) {
+                chomp($_);
+                ## throw away comments
+                next if ( /^\s*#/ || /^\s*$/ || /^\s*\;/);
+                ## check for a param = value
+                my ($parameter,$value)=read_parameter($_);
+                $value = &subst_configvar($value,\%conf);
+                $conf{$parameter}=$value;
+          }
+        close (CONFIGFILE);
+        return(%conf);
+}
+
+
+
+
+sub read_parameter
+{
+        my $line=shift;
+        ## check for a param = value
+        if ($_=~/=/) {
+          my ($param,$val);
+          if ($_=~/"/) {
+                #my ($param,$val) = ($_=~/(.*)\s*=\s*"(.*)"/);
+                ($param,$val) = /\s*(.*?)\s*=\s*"(.*)"/;
+          } elsif ($_=~/'/) {
+                ($param,$val) = /\s*(.*?)\s*=\s*'(.*)'/;
+          } else {
+                ($param,$val) = /\s*(.*?)\s*=\s*(.*)/;
+          }
+          return ($param,$val);
+        }
+}
+
+sub subst_configvar
+{
+        my $value = shift;
+        my $vars = shift;
+
+        $value =~ s/\$\{([^}]+)\}/$vars->{$1} ? $vars->{$1} : $1/eg;
+        return $value;
+}
+
+sub mail
+{
+
+if($config{email}eq ""){$config{email}="root"}
+
+$msg = MIME::Lite->new(
+             From     => 'monperl@opensides.be',
+             To       => $config{email},
+             Subject  => "Plugin Nagios Gosa",
+             Data     => $stdout
+             );
+
+
+$msg->send;
+}
+
+sub writelog
+{
+       open(F, "> $config{logfile}");
+       print F $stdout;
+       close(F);
+}
+
+# Read timestamp
+sub getTS
+{
+       open(F, "< $TS_FILE");
+       my $ts = <F>;
+       chop $ts;
+       $ts ||= "19700101000000Z";
+       return $ts;
+}
+
+# save timestamp
+sub putTS
+{
+       my $ts = `date -u '+%Y%m%d%H%M%SZ'`;
+       open(F, "> $TS_FILE");
+       $stdout.= F $ts;
+}
+
+#connexion anonyme
+sub anonBind
+{
+       my $ldap = Net::LDAP->new( $server);
+       my $mesg = $ldap->bind();
+       $mesg->code && die $mesg->error;
+       return $ldap;
+}
index 3280c197611ffd1f326e9bdbe8d10b5912e6ca1f..2a76b63f841ae27a7935ae9b4fc2283e71432194 100755 (executable)
@@ -53,11 +53,9 @@ install-stamp:
        -mkdir -p debian/gosa-help-nl/usr/share/doc/gosa-help-nl
        -gzip -c9 debian/changelog > debian/gosa-help-nl/usr/share/doc/gosa-help-nl/changelog.Debian.gz
        -gzip -c9 Changelog > debian/gosa/usr/share/doc/gosa/changelog.gz
-       -cp AUTHORS README FAQ doc/README.safemode doc/README.devel doc/README.openxchange debian/gosa/usr/share/doc/gosa/
+       -cp AUTHORS README FAQ doc/README.pptp doc/README.xls-export doc/README.glpi doc/README.nagios doc/README.phpscheduleit doc/README.safemode doc/README.devel doc/README.openxchange debian/gosa/usr/share/doc/gosa/
        -rm debian/gosa/usr/share/gosa/README debian/gosa/usr/share/gosa/INSTALL
-       -rm debian/gosa/usr/share/gosa/README.safemode
        -rm debian/gosa/usr/share/gosa/AUTHORS debian/gosa/usr/share/gosa/Changelog
-       -rm debian/gosa/usr/share/gosa/DEVEL
        -rm debian/gosa/usr/share/gosa/COPYING debian/gosa/usr/share/gosa/TODO
        -rm debian/gosa/usr/share/gosa/FAQ
        -mkdir -p debian/gosa/var/spool/gosa/compile
diff --git a/doc/README.glpi b/doc/README.glpi
new file mode 100644 (file)
index 0000000..52cfcf2
--- /dev/null
@@ -0,0 +1,13 @@
+To use the glpi connectivity extension
+
+1) Add the glpi.schema to your schema directory
+
+2) Remove the comment in front of glpiAccount in gosa.conf
+
+<!--    <tab class="glpiAccount" /> -->
+
+Benoit Mortier
+OpenSides November 2005
+
+
+
diff --git a/doc/README.nagios b/doc/README.nagios
new file mode 100644 (file)
index 0000000..5878e40
--- /dev/null
@@ -0,0 +1,20 @@
+To use the nagios plugin
+
+1) Add the nagios schema to your schema directory
+
+2) Remove the comment in front of nagiosAccount in gosa.conf
+
+<!--                     <plugin acl="default" class="nagiosAccount" icon="monitoring.png"
+                                path="plugins/personal/nagios" /> -->
+
+
+<!--    <nagios>
+                <tab class="nagiosAccount" />
+        </nagios> -->
+
+Benoit Mortier
+Guillaume Delecourt
+OpenSides October-November 2005
+
+
+
diff --git a/doc/README.phpscheduleit b/doc/README.phpscheduleit
new file mode 100644 (file)
index 0000000..4b634c8
--- /dev/null
@@ -0,0 +1,10 @@
+To use the phpscheduleit connectivity extension
+
+1) Add the schema phpscheduleit.schema in your schema directory
+
+2) Remove the comment in front of phpscheduleitAccount in gosa.conf
+
+<!--    <tab class="pptpAccount" /> -->
+
+Guillaume Delecourt
+OpenSides November 2005
diff --git a/doc/README.pptp b/doc/README.pptp
new file mode 100644 (file)
index 0000000..556e274
--- /dev/null
@@ -0,0 +1,13 @@
+To use the pptp connectivity extension
+
+1) Add the pptp.schema to your schema directory
+
+2) Remove the comment in front of pptpAccount in gosa.conf
+
+<!--    <tab class="pptpAccount" /> -->
+
+Guillaume Delecourt
+OpenSides November 2005
+
+
+
diff --git a/doc/README.xls-export b/doc/README.xls-export
new file mode 100644 (file)
index 0000000..e9b0606
--- /dev/null
@@ -0,0 +1,7 @@
+To use the xls export ldapamanager addon uncomment the following line in your gosa.conf :
+
+<!--            <tab class="xlsexport" name="Excel Export" />   -->
+
+Guillaume Delecourt
+Vincent Seynhaeve
+OpenSides October 2005