summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f2051a7)
raw | patch | inline | side by side (parent: f2051a7)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 4 Jan 2008 13:48:13 +0000 (13:48 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 4 Jan 2008 13:48:13 +0000 (13:48 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8221 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-client | patch | blob | history | |
gosa-si/modules/ServerPackages.pm | patch | blob | history |
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index b69c34782bb7d468d56a3db5c3dc4365b16fd651..efb794374354ee2b95792330008da34b7e2f61c3 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
my ($cfg_file, %cfg_defaults, $foreground, $verbose, $pid_file, $procid, $pid, $log_file);
my ($server_address, $server_ip, $server_port, $server_domain, $server_passwd, $server_cipher, $server_timeout);
my ($client_address, $client_ip, $client_port, $client_mac_address, $ldap_config, $pam_config, $nss_config);
-my ($input_socket, $rbits, $wbits, $ebits, $xml, $known_hosts);
+my ($input_socket, $rbits, $wbits, $ebits, $xml, $known_hosts, $ldap_enabled);
my (@events);
# default variables
},
"client" =>
{"client_port" => [\$client_port, "20083"],
+ "ldap" => [\$ldap_enabled, 1],
"ldap_config" => [\$ldap_config, "/etc/ldap/ldap.conf"],
"pam_config" => [\$pam_config, "/etc/pam_ldap.conf"],
"nss_config" => [\$nss_config, "/etc/libnss_ldap.conf"],
close(DIR);
daemon_log("could not assign the msg $header to an event", 5);
-
-
- if ($header eq 'new_ldap_config') { &new_ldap_config($msg_hash)}
+ if ($header eq 'new_ldap_config') { if ($ldap_enabled == 1) {&new_ldap_config($msg_hash)}}
elsif ($header eq 'ping') { &got_ping($msg_hash) }
elsif ($header eq 'wake_up') { &execute_event($msg_hash)}
elsif ($header eq 'new_passwd') { &new_passwd()}
my @ldap_options;
my @pam_options;
my @nss_options;
+ my $goto_admin;
+ my $goto_secret;
# Transform input into array
while ( my ($key, $value) = each(%$msg_hash) ) {
$ldap_base= $element;
next;
}
+ if ($key =~ /^goto_admin$/) {
+ $goto_admin= $element;
+ next;
+ }
+ if ($key =~ /^goto_secret$/) {
+ $goto_secret= $element;
+ next;
+ }
if ($key =~ /^ldap_cfg$/) {
push (@ldap_options, "$element");
next;
close (file1);
daemon_log("wrote $pam_config", 5);
+ # Create goto.secrets if told so
+ if (defined $goto_admin){
+ open(file1, "> /etc/goto/secret");
+ close(file1);
+ chown(0,0, "/etc/goto/secret");
+ chmod(0600, "/etc/goto/secret");
+ open(file1, "> /etc/goto/secret");
+ print file1 $goto_admin.":".$goto_secret."\n";
+ close(file1);
+ daemon_log("wrote /etc/goto/secret", 5);
+ }
+
return;
}
index b5fa53c44ab9e1f0bc31c2020e06e7ff4813db30..846eed111f3acbc65ec3c8868647b89d553be24e 100644 (file)
my ($bus_activ, $bus_passwd, $bus_ip, $bus_port);
my $server;
my $no_bus;
-my (@ldap_cfg, @pam_cfg, @nss_cfg);
+my (@ldap_cfg, @pam_cfg, @nss_cfg, $goto_admin, $goto_secret);
my %cfg_defaults =
("server" =>
push (@nss_cfg, "$param ".$cfg->val('nss_ldap', $param));
}
}
+ if ($cfg->SectionExists('goto')){
+ $goto_admin= $cfg->val('goto', 'terminal_admin');
+ $goto_secret= $cfg->val('goto', 'terminal_secret');
+ } else {
+ $goto_admin= undef;
+ $goto_secret= undef;
+ }
}
return;
}
- # Build LDAP connection
- my $ldap;
- $ldap= Net::LDAP->new($ldap_uri);
+ # Build LDAP connection
+ my $ldap;
+ $ldap= Net::LDAP->new($ldap_uri);
- # Bind to a directory with dn and password
- my $mesg= $ldap->bind($ldap_admin_dn, $ldap_admin_password);
+ # Bind to a directory with dn and password
+ my $mesg= $ldap->bind($ldap_admin_dn, $ldap_admin_password);
- # Perform search
- $mesg = $ldap->search( base => $ldap_base,
- scope => 'sub',
- attrs => ['dn', 'gotoLdapServer'],
- filter => "(&(objectClass=GOhard)(macaddress=$mac_address))");
- $mesg->code && die $mesg->error;
+ # Perform search
+ $mesg = $ldap->search( base => $ldap_base,
+ scope => 'sub',
+ attrs => ['dn', 'gotoLdapServer'],
+ filter => "(&(objectClass=GOhard)(macaddress=$mac_address))");
+ $mesg->code && die $mesg->error;
- # Sanity check
- if ($mesg->count != 1) {
- &main::daemon_log("WARNING: client mac address $mac_address not found/not unique", 1);
- return;
- }
-
- my $entry= $mesg->entry(0);
- my $dn= $entry->dn;
- my @servers= $entry->get_value("gotoLdapServer");
- my @ldap_uris;
- my $server;
- my $base;
-
- # Do we need to look at an object class?
- if ($#servers < 1){
- $mesg = $ldap->search( base => $ldap_base,
- scope => 'sub',
- attrs => ['dn', 'gotoLdapServer'],
- filter => "(&(objectClass=gosaGroupOfNames)(member=$dn))");
- $mesg->code && die $mesg->error;
-
- # Sanity check
- if ($mesg->count != 1) {
- &main::daemon_log("WARNING: no LDAP information found for client mac $mac_address", 1);
- return;
- }
+ # Sanity check
+ if ($mesg->count != 1) {
+ &main::daemon_log("WARNING: client mac address $mac_address not found/not unique", 1);
+ return;
+ }
- $entry= $mesg->entry(0);
- $dn= $entry->dn;
- @servers= $entry->get_value("gotoLdapServer");
- }
+ my $entry= $mesg->entry(0);
+ my $dn= $entry->dn;
+ my @servers= $entry->get_value("gotoLdapServer");
+ my @ldap_uris;
+ my $server;
+ my $base;
+
+ # Do we need to look at an object class?
+ if ($#servers < 1){
+ $mesg = $ldap->search( base => $ldap_base,
+ scope => 'sub',
+ attrs => ['dn', 'gotoLdapServer'],
+ filter => "(&(objectClass=gosaGroupOfNames)(member=$dn))");
+ $mesg->code && die $mesg->error;
+
+ # Sanity check
+ if ($mesg->count != 1) {
+ &main::daemon_log("WARNING: no LDAP information found for client mac $mac_address", 1);
+ return;
+ }
+
+ $entry= $mesg->entry(0);
+ $dn= $entry->dn;
+ @servers= $entry->get_value("gotoLdapServer");
+ }
- @servers= sort (@servers);
+ @servers= sort (@servers);
- foreach $server (@servers){
- $base= $server;
- $server =~ s%^[^:]+:[^:]+:(ldap.*://[^/]+)/.*$%$1%;
- $base =~ s%^[^:]+:[^:]+:ldap.*://[^/]+/(.*)$%$1%;
- push (@ldap_uris, $server);
- }
+ foreach $server (@servers){
+ $base= $server;
+ $server =~ s%^[^:]+:[^:]+:(ldap.*://[^/]+)/.*$%$1%;
+ $base =~ s%^[^:]+:[^:]+:ldap.*://[^/]+/(.*)$%$1%;
+ push (@ldap_uris, $server);
+ }
- # Unbind
- $mesg = $ldap->unbind;
+ # Unbind
+ $mesg = $ldap->unbind;
- # Send information
+ # Assemble data package
my %data = ( 'ldap_uri' => \@ldap_uris, 'ldap_base' => $base,
'ldap_cfg' => \@ldap_cfg, 'pam_cfg' => \@pam_cfg,'nss_cfg' => \@nss_cfg );
+
+ # Need to append GOto settings?
+ if (defined $goto_admin and defined $goto_secret){
+ $data{'goto_admin'}= $goto_admin;
+ $data{'goto_secret'}= $goto_secret;
+ }
+
+ # Send information
send_msg("new_ldap_config", $server_address, $address, \%data);
return;