summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c3c91c6)
raw | patch | inline | side by side (parent: c3c91c6)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 1 Feb 2008 15:02:55 +0000 (15:02 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 1 Feb 2008 15:02:55 +0000 (15:02 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8731 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-si/client.conf b/gosa-si/client.conf
index 0c65e2cad9685d7b0ef6882ecddbab632e29cfb2..6827a7c8d57ee868ac02163bb615cb9605b7c3b4 100644 (file)
--- a/gosa-si/client.conf
+++ b/gosa-si/client.conf
pid_file = /var/run/gosa-si-client.pid
[client]
+client_ip = 10.89.1.31
client_port = 20083
[server]
server_ip = 127.0.0.1
server_port = 20081
-server_passwd = secret-server-password
+server_key = secret-server-password
server_timeout = 5
server_domain = intranet.gonicus.de
diff --git a/gosa-si/gosa-si-bus b/gosa-si/gosa-si-bus
index dd848c182c3b4ade9d9ae1dd35a1e7a4edc7564d..2c7be1ac5771733be8dc096de1053c8d7f3d5708 100755 (executable)
--- a/gosa-si/gosa-si-bus
+++ b/gosa-si/gosa-si-bus
"child_max" => [\$child_max, 10],
"child_min" => [\$child_min, 3],
"child_timeout" => [\$child_timeout, 180],
- "bus_known_server_file_name" => [\$bus_known_server_file_name, "/var/lib/gosa-si/bus_known_server.db"]
+ "bus_known_server_file_name" => [\$bus_known_server_file_name, "/var/lib/gosa-si/gosa-si-bus_known_server.db"]
},
"bus" =>
{"bus_activ" => [\$bus_activ, "on"],
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 461c15498e4cb73cb113153516f69b202d8e3f7f..16beffc07c0e8cb99bcceb2e49a2c3fde505526e 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
}
if( $error == 0 ) {
-
# send xml msg
print $socket $crypted_msg."\n";
my $query_res = $known_server_db->select_dbentry( $sql_statement );
while( my ($hit_num, $hit) = each %{ $query_res } ) {
my $host_name = $hit->{hostname};
- my $host_key = $hit->{hostkey};
- $answer =~ s/KNOWN_SERVER/$host_name/g;
+ my $host_key = $hit->{hostkey};
+ $answer =~ s/KNOWN_SERVER/$host_name/g;
&send_msg_to_target($answer, $host_name, $host_key);
}
-
- print STDERR $answer_target."\n";
-
}
else {
# answer is for one specific host
index e54da9aa072138e489ab2889808a578908430b2e..b58fe246aa2c96c232cdd0f533e4d0f66437466c 100644 (file)
}
&main::daemon_log("GosaPackages: $header job successfully added to job queue", 3);
- return "<xml><answer1>$res</answer1></xml>";
+ return "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>$res</answer1></xml>";
}
sub db_res_2_xml {
my ($db_res) = @_ ;
- my $xml = "<xml>";
+ my $xml = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target>";
my $len_db_res= keys %{$db_res};
my $res_hash = $main::job_db->select_dbentry($sql_statement);
my $count = keys(%{$res_hash});
- $out_xml= "<xml><count>$count</count></xml>";
+ $out_xml= "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><count>$count</count></xml>";
return $out_xml;
}
}
# prepare xml answer
- my $out_xml = "<xml><answer1>$res</answer1></xml>";
+ my $out_xml = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>$res</answer1></xml>";
return $out_xml;
}
if( not $db_res > 0 ) { $error++; };
if( $error == 0 ) {
- $out_xml = "<xml><answer1>0</answer1></xml>";
+ $out_xml = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>0</answer1></xml>";
}
return $out_xml;
my ($msg) = @_ ;
my $msg_hash = &transform_msg2hash($msg);
my $error= 0;
- my $out_xml= "<xml><answer1>1</answer1></xml>";
+ my $out_xml= "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>1</answer1></xml>";
my @len_hash = keys %{$msg_hash};
if( 0 == @len_hash) { $error++; };
}
if( $error == 0) {
- $out_xml = "<xml><answer1>0</answer1></xml>";
+ $out_xml = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>0</answer1></xml>";
}
return $out_xml;
}
-#sub update_timestamp_jobdb_entry {
-# my ($msg) = @_ ;
-# my $msg_hash = &transform_msg2hash($msg);
-#
-# # prepare query sql statement
-# my $update_hash = {table=>$main::job_queue_table_name };
-# if( exists $msg_hash->{where} ) {
-# $update_hash->{where} = $msg_hash->{where};
-# } else {
-# $update_hash->{where} = [];
-# }
-#
-# if( not exists $msg_hash->{update}[0]->{timestamp} ) {
-# return "<xml><answer1>1</answer1></xml>";
-# }
-#
-# $update_hash->{update} = [ { timestamp=>$msg_hash->{update}[0]->{timestamp} } ];
-#
-# # execute db query
-# my $db_res = $main::job_db->update_dbentry($update_hash);
-#
-# # transform db answer to error returnment
-# my $res;
-# if( $db_res > 0 ) {
-# $res = 0 ;
-# } else {
-# $res = 1;
-# }
-#
-# # prepare xml answer
-# my $out_xml = "<xml><answer1>$res</answer1></xml>";
-# return $out_xml;
-#
-#}
-
1;
index de952229e7e986747b0ba24dca9d8800ebc3ad2a..93ff49d7a66b72e2fd26eb916a75483da16c3d28 100644 (file)
my $xml = new XML::Simple();
-sub process_incoming_msg {
- return;
-}
-
sub daemon_log {
my ($msg, $level) = @_ ;
&main::daemon_log($msg, $level);
# RETURNS: nothing
# DESCRIPTION: ????
#===============================================================================
-sub send_msg_hash2address ($$$){
- my ($msg_hash, $address, $passwd) = @_ ;
-
- # fetch header for logging
- my $header = @{$msg_hash->{header}}[0];
-
- # generate xml string
- my $msg_xml = &create_xml_string($msg_hash);
-
- # create ciphering object
- my $act_cipher = &create_ciphering($passwd);
-
- # encrypt xml msg
- my $crypted_msg = &encrypt_msg($msg_xml, $act_cipher);
-
- # opensocket
- my $socket = &open_socket($address);
- if(not defined $socket){
- daemon_log("cannot send '$header'-msg to $address , server not reachable", 5);
- return 1;
- }
-
- # send xml msg
- print $socket $crypted_msg."\n";
-
- close $socket;
-
- daemon_log("send '$header'-msg to $address", 1);
- daemon_log("message:\n$msg_xml", 8);
- return 0;
-}
+#sub send_msg_hash2address ($$$){
+# my ($msg_hash, $address, $passwd) = @_ ;
+#
+# # fetch header for logging
+# my $header = @{$msg_hash->{header}}[0];
+#
+# # generate xml string
+# my $msg_xml = &create_xml_string($msg_hash);
+#
+# # create ciphering object
+# my $act_cipher = &create_ciphering($passwd);
+#
+# # encrypt xml msg
+# my $crypted_msg = &encrypt_msg($msg_xml, $act_cipher);
+#
+# # opensocket
+# my $socket = &open_socket($address);
+# if(not defined $socket){
+# daemon_log("cannot send '$header'-msg to $address , server not reachable", 5);
+# return 1;
+# }
+#
+# # send xml msg
+# print $socket $crypted_msg."\n";
+#
+# close $socket;
+#
+# daemon_log("send '$header'-msg to $address", 1);
+# daemon_log("message:\n$msg_xml", 8);
+# return 0;
+#}
#=== FUNCTION ================================================================
# value - list - for all other keys in xml hash
# DESCRIPTION:
#===============================================================================
-sub get_content_from_xml_hash {
- my ($xml_ref, $element) = @_ ;
- #my $result = $main::xml_ref->{$element};
- #if( $element eq "header" || $element eq "target" || $element eq "source") {
- # return @$result[0];
- #}
- my @result = $xml_ref->{$element};
- return \@result;
-}
+#sub get_content_from_xml_hash {
+# my ($xml_ref, $element) = @_ ;
+# #my $result = $main::xml_ref->{$element};
+# #if( $element eq "header" || $element eq "target" || $element eq "source") {
+# # return @$result[0];
+# #}
+# my @result = $xml_ref->{$element};
+# return \@result;
+#}
#=== FUNCTION ================================================================
# DESCRIPTION: crypts the incoming message with the Crypt::Rijndael module
#===============================================================================
sub encrypt_msg {
- my ($msg, $my_cipher) = @_;
- if(not defined $my_cipher) { print "no cipher object\n"; }
+# my ($msg, $my_cipher) = @_;
+# if(not defined $my_cipher) { print "no cipher object\n"; }
+# {
+# use bytes;
+# $msg = "\0"x(16-length($msg)%16).$msg;
+# }
+# $msg = $my_cipher->encrypt($msg);
+# chomp($msg = &encode_base64($msg));
+#
+# # there are no newlines allowed inside msg
+# $msg=~ s/\n//g;
+#
+# return $msg;
+ my ($msg, $key) = @_;
+ my $my_cipher = &create_ciphering($key);
{
use bytes;
$msg = "\0"x(16-length($msg)%16).$msg;
}
$msg = $my_cipher->encrypt($msg);
chomp($msg = &encode_base64($msg));
-
# there are no newlines allowed inside msg
$msg=~ s/\n//g;
-
return $msg;
+
}
# DESCRIPTION: decrypts the incoming message with the Crypt::Rijndael module
#===============================================================================
sub decrypt_msg {
- my ($msg, $my_cipher) = @_ ;
- if(defined $msg && defined $my_cipher) {
- $msg = &decode_base64($msg);
- }
+# my ($msg, $my_cipher) = @_ ;
+#
+# if(defined $msg && defined $my_cipher) {
+# $msg = &decode_base64($msg);
+# }
+# $msg = $my_cipher->decrypt($msg);
+# $msg =~ s/\0*//g;
+# return $msg;
+ my ($msg, $key) = @_ ;
+ $msg = &decode_base64($msg);
+ my $my_cipher = &create_ciphering($key);
$msg = $my_cipher->decrypt($msg);
$msg =~ s/\0*//g;
return $msg;
# RETURNS: socket IO::Socket::INET
# DESCRIPTION: open a socket to PeerAddr
#===============================================================================
-sub open_socket {
- my ($PeerAddr, $PeerPort) = @_ ;
- if(defined($PeerPort)){
- $PeerAddr = $PeerAddr.":".$PeerPort;
- }
- my $socket;
- $socket = new IO::Socket::INET(PeerAddr => $PeerAddr,
- Porto => "tcp",
- Type => SOCK_STREAM,
- Timeout => 5,
- );
- if(not defined $socket) {
- return;
- }
- &daemon_log("open_socket: $PeerAddr", 7);
- return $socket;
-}
+#sub open_socket {
+# my ($PeerAddr, $PeerPort) = @_ ;
+# if(defined($PeerPort)){
+# $PeerAddr = $PeerAddr.":".$PeerPort;
+# }
+# my $socket;
+# $socket = new IO::Socket::INET(PeerAddr => $PeerAddr,
+# Porto => "tcp",
+# Type => SOCK_STREAM,
+# Timeout => 5,
+# );
+# if(not defined $socket) {
+# return;
+# }
+# &daemon_log("open_socket: $PeerAddr", 7);
+# return $socket;
+#}
sub get_time {
index 867101e0f168d1428cb427cfbadb172527b85d08..cbfc25cd329b0c0ed64ba83dfa555aa7a401fe1d 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
{
$sock = new Socket_Client("127.0.0.1","20081",TRUE,1);
-#$sock = new Socket_Client("169.254.2.248","9999",TRUE,1);
$sock->setEncryptionKey("secret-gosa-password");
if($sock->connected()){
# add
#$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>19700101000001</timestamp> </xml>";
#$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
-#$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
+#$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source> <target>10.89.1.155:20081</target><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
# delete
#$data = "<xml> <header>gosa_delete_jobdb_entry</header><where><clause><phrase><id>3</id></phrase></clause></where></xml>";
#$data = "<xml> <header>gosa_count_jobdb</header></xml>";
# clear
-#$data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
+$data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
# set gosa-si-client to 'activated'
-$data = "<xml> <header>gosa_set_activated_for_installation</header> <target>127.0.0.1:20083</target> <source>127.0.0.1:20081</source> </xml>";
+#$data = "<xml> <header>gosa_set_activated_for_installation</header> <target>127.0.0.1:20083</target> <source>127.0.0.1:20081</source> </xml>";
$sock->write($data);