summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b7eb00d)
raw | patch | inline | side by side (parent: b7eb00d)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 5 Feb 2008 15:28:26 +0000 (15:28 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 5 Feb 2008 15:28:26 +0000 (15:28 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8751 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-si/client.conf b/gosa-si/client.conf
index 5359d59cd701ee2a8d10b074f84d55a05c1a0b34..34c7743383254dab2680bdd829574c8d88070c74 100644 (file)
--- a/gosa-si/client.conf
+++ b/gosa-si/client.conf
[client]
client_ip = 10.89.1.31
client_port = 20083
-client_mac_address = 00:01:6c:9d:b9:fa
[server]
-server_ip = 127.0.0.1
+server_ip = 10.89.1.31
server_port = 20081
server_key = secret-server-password
server_timeout = 5
index babe60030859711e2b61aa8fd07460e2a1287bc8..6cbdc1b5d161b94c40dc9a4f8d1cf8656c60d404 100644 (file)
my $server_address = $main::server_address;
my $server_key = $main::server_key;
-my $client_address = $main::client_address;
my $client_mac_address = $main::client_mac_address;
sub get_events {
sub registered {
my ($msg, $msg_hash) = @_ ;
+
my $header = @{$msg_hash->{'header'}}[0];
-
if( $header eq "registered" ) {
my $source = @{$msg_hash->{'source'}}[0];
&main::daemon_log("registration at $source",1);
}
-
+
# set registration_flag to true
my $out_hash = &create_xml_hash("registered", $main::client_address, $main::server_address);
my $out_msg = &create_xml_string($out_hash);
sub new_key {
# my ($msg_hash) = @_ ;
- my $new_server_key = &create_passwd();
+ my $new_server_key = &main::create_passwd();
- my $out_hash = &create_xml_hash("new_passwd", $client_address, $server_address, $new_server_key);
+ my $out_hash = &create_xml_hash("new_key", $main::client_address, $main::server_address, $new_server_key);
my $out_msg = &create_xml_string($out_hash);
- #&send_msg_hash2address($out_hash, $server_address, $main::server_key);
- $main::server_key = $new_server_key;
return $out_msg;
}
&main::daemon_log("Hardware detection done!", 4);
return &send_msg_hash2address(
- &create_xml_hash("detected_hardware", $client_address, $server_address, $result),
+ &create_xml_hash("detected_hardware", $main::client_address, $server_address, $result),
$server_address,
$server_key,
);
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 417b9263e02e01caf5408fc749ad850e15af7b2b..2647710d85fd9d88a444f02bb3fe1804fd11607b 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
use lib "/usr/lib/gosa-si/client/events";
my ($cfg_file, %cfg_defaults, $foreground, $verbose, $pid_file, $procid, $pid, $log_file);
-my ($server_ip, $server_port, $server_key, $server_timeout, $server_domain);
+my ($server_ip, $server_port, $server_key, $server_timeout, $server_domain, $server_key_lifetime);
my ($client_ip, $client_port, $client_mac_address, $ldap_enabled, $ldap_config, $pam_config, $nss_config);
my $xml;
my $default_server_key;
"server_key" => [\$server_key, ""],
"server_timeout" => [\$server_timeout, 10],
"server_domain" => [\$server_domain, ""],
+ "server_key_lifetime" => [\$server_key_lifetime, 600],
},
);
}
daemon_log("waiting for msg 'register_at_gosa_si_server'",1);
$kernel->delay_set('register_at_gosa_si_server',2);
+ # clear old settings and set it again
+ $kernel->delay_set('trigger_new_key', $server_key_lifetime);
}
return;
}
}
}
+sub trigger_new_key {
+ my ($kernel) = $_[KERNEL] ;
+
+ my $msg = "<xml><header>new_key</header><source>$client_address</source><target>$client_address</target></xml>";
+ &send_msg_to_target($msg, $client_address, $server_key, 'new_key');
+
+ $kernel->delay_set('trigger_new_key', $server_key_lifetime);
+
+}
+
+
+sub _start {
+ my ($kernel) = $_[KERNEL];
+ $kernel->alias_set('client_session');
+ $kernel->yield('register_at_gosa_si_server');
+}
+
sub server_input {
- my ($heap,$input,$wheel) = @_[HEAP, ARG0, ARG1];
+ my ($kernel, $heap, $input, $wheel) = @_[KERNEL, HEAP, ARG0, ARG1];
my $error = 0;
my $answer;
########
# answer
if( $answer ) {
+ # preprocessing
if( $answer =~ "<header>registered</header>") {
+ # set registered flag to true to stop sending further registered msgs
$REGISTERED_FLAG = 0;
}
else {
- &send_msg_to_address($answer, $server_address, $server_key);
+ &send_msg_to_target($answer, $server_address, $server_key);
+ }
+ # postprocessing
+ if( $answer =~ "<header>new_key</header>") {
+ # set new key to global variable
+ $answer =~ /<new_key>(\S*?)<\/new_key>/;
+ my $new_key = $1;
+ $server_key = $new_key;
}
}
@@ -1100,8 +1129,9 @@ daemon_log("found servers in configuration file and via DNS: $servers_string", 5
POE::Session->create(
inline_states => {
- _start => \®ister_at_gosa_si_server ,
+ _start => \&_start,
register_at_gosa_si_server => \®ister_at_gosa_si_server,
+ trigger_new_key => \&trigger_new_key,
}
);
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 3c73064d81fc3dd7767adfa622cf19b52f0db135..29a52650990ca810c40c63f223ce0aaf5ebd238e 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
# process incoming msg
if( $error == 0) {
daemon_log("Processing module ".$module, 3);
- $answer_l = &{ $module."::process_incoming_msg" }($msg, $msg_hash);
+ $answer_l = &{ $module."::process_incoming_msg" }($msg, $msg_hash, $heap->{'remote_ip'});
if ( 0 > @{$answer_l} ) {
my $answer_str = join("\n", @{$answer_l});
index 93ff49d7a66b72e2fd26eb916a75483da16c3d28..1a40c23a0f1d270f2b0e7ca3bdcd14033b0370dc 100644 (file)
use Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(create_xml_hash send_msg_hash2address get_content_from_xml_hash add_content2xml_hash create_xml_string encrypt_msg decrypt_msg create_ciphering transform_msg2hash get_time send_msg get_where_statement get_select_statement get_update_statement get_limit_statement get_orderby_statement);
+@EXPORT = qw(create_xml_hash get_content_from_xml_hash add_content2xml_hash create_xml_string encrypt_msg decrypt_msg create_ciphering transform_msg2hash get_time send_msg get_where_statement get_select_statement get_update_statement get_limit_statement get_orderby_statement);
use strict;
use warnings;
index 9924be37fde3d8e287acd668383e523834b314ee..6c44e134aa7c6ae02913d1447a5c374528c37f92 100644 (file)
# DESCRIPTION: handels the proceeded distribution to the appropriated functions
#===============================================================================
sub process_incoming_msg {
- my ($msg, $msg_hash) = @_ ;
+ my ($msg, $msg_hash, $remote_ip) = @_ ;
my $error = 0;
my $host_name;
my $host_key;
# process incoming msg
my $header = @{$msg_hash->{header}}[0];
- my $source = @{$msg_hash->{source}}[0];
my @target_l = @{$msg_hash->{target}};
&main::daemon_log("SIPackages: msg to process: $header", 3);
if( 1 == length @target_l) {
my $target = $target_l[0];
if( $target eq $server_address ) {
- if ($header eq 'new_passwd') {
- @out_msg_l = &new_passwd($msg_hash)
- } elsif ($header eq 'here_i_am') {
- @out_msg_l = &here_i_am($msg_hash)
- } elsif ($header eq 'who_has') {
- @out_msg_l = &who_has($msg_hash)
- } elsif ($header eq 'who_has_i_do') {
- @out_msg_l = &who_has_i_do($msg_hash)
- } elsif ($header eq 'got_ping') {
- @out_msg_l = &got_ping($msg_hash)
- } elsif ($header eq 'get_load') {
- @out_msg_l = &execute_actions($msg_hash)
+ if ($header eq 'new_key') {
+ @out_msg_l = &new_key($msg_hash)
+ } elsif ($header eq 'here_i_am') {
+ @out_msg_l = &here_i_am($msg_hash)
+ } elsif ($header eq 'who_has') {
+ @out_msg_l = &who_has($msg_hash)
+ } elsif ($header eq 'who_has_i_do') {
+ @out_msg_l = &who_has_i_do($msg_hash)
+ } elsif ($header eq 'got_ping') {
+ @out_msg_l = &got_ping($msg_hash)
+ } elsif ($header eq 'get_load') {
+ @out_msg_l = &execute_actions($msg_hash)
} elsif ($header eq 'detected_hardware') {
- @out_msg_l = &process_detected_hardware($msg_hash)
- } elsif ($header eq 'trigger_wake') {
- foreach (@{$msg_hash->{macAddress}}){
- &main::daemon_log("SIPackages: trigger wake for $_", 1);
- do_wake($_);
- }
+ @out_msg_l = &process_detected_hardware($msg_hash)
+ } elsif ($header eq 'trigger_wake') {
+ foreach (@{$msg_hash->{macAddress}}){
+ &main::daemon_log("SIPackages: trigger wake for $_", 1);
+ do_wake($_);
+ }
} else {
&main::daemon_log("ERROR: $header is an unknown core function", 1);
# RETURNS: nothing
# DESCRIPTION: process this incoming message
#===============================================================================
-sub new_passwd {
+sub new_key {
my ($msg_hash) = @_;
my @out_msg_l;
my $header = @{$msg_hash->{header}}[0];
my $source_name = @{$msg_hash->{source}}[0];
- my $source_key = @{$msg_hash->{new_passwd}}[0];
+ my $source_key = @{$msg_hash->{new_key}}[0];
my $query_res;
# check known_clients_db
diff --git a/gosa-si/server.conf b/gosa-si/server.conf
index 5f22d234ca8da756597d00bad90bd6f737c81af5..ac0d78d37c69ac6b9f6066ee85dce7bfa7b6816c 100644 (file)
--- a/gosa-si/server.conf
+++ b/gosa-si/server.conf
[server]
server_activ = on
+server_ip = 10.89.1.31
server_port = 20081
SIPackages_key = secret-server-password
max_clients = 5