summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 354c7a5)
raw | patch | inline | side by side (parent: 354c7a5)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Dec 2007 12:48:19 +0000 (12:48 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Dec 2007 12:48:19 +0000 (12:48 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8044 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/contrib/daemon/gosa-sc b/contrib/daemon/gosa-sc
index 1cc276f11718b023d4c6e85410f681bb02ca30c0..3be13292237f7992d20e250ee5b2f374ea35b0e5 100755 (executable)
--- a/contrib/daemon/gosa-sc
+++ b/contrib/daemon/gosa-sc
use Fcntl;
use IO::Socket::INET;
-use Crypt::Rijndael;
+use Crypt::CBC;
+use Digest::MD5 qw(md5 md5_hex md5_base64);
use XML::Simple;
use Data::Dumper;
use Sys::Syslog qw( :DEFAULT setlogsock);
sub encrypt_msg {
my ($msg, $my_cipher) = @_;
if(not defined $my_cipher) { print "no cipher object\n"; }
- $msg =~ s/[\n]+//g;
- my $msg_length = length($msg);
- my $multiplier = int($msg_length / 16) + 1;
- my $extension = 16*$multiplier - $msg_length;
- $msg = "0"x$extension.$msg;
+
my $crypted_msg = $my_cipher->encrypt($msg);
- #my $crypted_msg = $msg;
+
return $crypted_msg;
}
# DESCRIPTION:
#===============================================================================
sub decrypt_msg {
- my ($crypted_msg, $my_cipher) =@_;
- my $msg = $my_cipher->decrypt($crypted_msg);
- $msg =~ s/^0*$//g;
+ my ($crypted_msg, $my_cipher) = @_ ;
+ my $msg = $my_cipher->decrypt($crypted_msg);
return $msg;
}
sub create_ciphering {
my ($passwd) = @_;
$passwd = substr("$passwd" x 32, 0, 32);
+ daemon_log("create_ciphering: new passwd: $passwd", 7);
+
+ my $iv = substr(md5_hex('GONICUS GmbH'),0, 16);
- my $my_cipher = Crypt::Rijndael->new($passwd , Crypt::Rijndael::MODE_CBC );
+ my $my_cipher = Crypt::CBC->new(-key=>$passwd ,
+ -cipher => 'Rijndael',
+ -iv => $iv,
+ -header => "none",
+ );
return $my_cipher;
}
diff --git a/contrib/daemon/gosa-sd b/contrib/daemon/gosa-sd
index 48fc1a4ed1e8c6c5f012c13b8872222572f701fb..22d7ed7d31d018bab4455bfe676699ec49193f54 100755 (executable)
--- a/contrib/daemon/gosa-sd
+++ b/contrib/daemon/gosa-sd
use Fcntl;
use IO::Socket::INET;
-use Crypt::Rijndael;
+use Crypt::CBC;
+use Digest::MD5 qw(md5 md5_hex md5_base64);
use XML::Simple;
use Data::Dumper;
use Sys::Syslog qw( :DEFAULT setlogsock);
sub encrypt_msg {
my ($msg, $my_cipher) = @_;
if(not defined $my_cipher) { print "no cipher object\n"; }
- $msg =~ s/[\n]+//g;
- my $msg_length = length($msg);
- my $multiplier = int($msg_length / 16) + 1;
- my $extension = 16*$multiplier - $msg_length;
- $msg = "0"x$extension.$msg;
+
my $crypted_msg = $my_cipher->encrypt($msg);
- #my $crypted_msg = $msg;
+
return $crypted_msg;
}
#===============================================================================
sub decrypt_msg {
my ($crypted_msg, $my_cipher) = @_ ;
- my $msg = $my_cipher->decrypt($crypted_msg);
- $msg =~ s/^0*//g;
+ my $msg = $my_cipher->decrypt($crypted_msg);
return $msg;
}
sub create_ciphering {
my ($passwd) = @_;
$passwd = substr("$passwd" x 32, 0, 32);
+ daemon_log("create_ciphering: new passwd: $passwd", 7);
- my $my_cipher = Crypt::Rijndael->new($passwd , Crypt::Rijndael::MODE_CBC );
+ my $iv = substr(md5_hex('GONICUS GmbH'),0, 16);
+
+ my $my_cipher = Crypt::CBC->new(-key=>$passwd ,
+ -cipher => 'Rijndael',
+ -iv => $iv,
+ -header => "none",
+ );
return $my_cipher;
}
} else {
my ($port, $iaddr) = unpack_sockaddr_in($other_end);
my $actual_ip = inet_ntoa($iaddr);
- daemon_log("accept client from $actual_ip", 5);
+ daemon_log("accept client at daemon socket from $actual_ip", 5);
my $in_msg = &read_from_socket($client);
if(defined $in_msg){
chomp($in_msg);
} else {
my ($port, $iaddr) = unpack_sockaddr_in($other_end);
my $actual_ip = inet_ntoa($iaddr);
- daemon_log("accept client from $actual_ip", 5);
+ daemon_log("accept client at gosa socket from $actual_ip", 5);
my $in_msg = <$client>;
#my $in_msg = &read_from_socket($client);
- #daemon_log(">>>>>>>>>>> frisch vom socket gelesen\n$in_msg\n",1);
+
+ daemon_log(">>>>>>>>>>> frisch vom socket gelesen\n!$in_msg!\n",1);
if(defined $in_msg){
chomp($in_msg);
&activating_child($in_msg, $actual_ip, $client);
index 483d3d1bf29ab8237ca38e208f5e884b2b23126f..b1e118f0e258fe82824f761c1cc33bf5d6ff5fca 100755 (executable)
use Time::HiRes qw( gettimeofday );
use IO::Socket::INET;
-use Crypt::Rijndael;
+use Crypt::CBC;
+use Digest::MD5 qw(md5 md5_hex md5_base64);
use XML::Simple;
use Data::Dumper;
use Sys::Syslog qw( :DEFAULT setlogsock);
sub create_ciphering {
my ($passwd) = @_;
$passwd = substr("$passwd" x 32, 0, 32);
- my $my_cipher = Crypt::Rijndael->new($passwd , Crypt::Rijndael::MODE_CBC );
+ daemon_log("create_ciphering: new passwd: $passwd", 7);
+
+ my $iv = substr(md5_hex('GONICUS GmbH'),0, 16);
+
+ my $my_cipher = Crypt::CBC->new(-key=>$passwd ,
+ -cipher => 'Rijndael',
+ -iv => $iv,
+ -header => "none",
+ );
return $my_cipher;
}
#===============================================================================
sub encrypt_msg {
my ($msg, $my_cipher) = @_;
- $msg =~ s/[\n]+//g;
- my $msg_length = length($msg);
- my $multiplier = int($msg_length / 16) + 1;
- my $extension = 16*$multiplier - $msg_length;
- $msg = "0"x$extension.$msg;
+ if(not defined $my_cipher) { print "no cipher object\n"; }
+
my $crypted_msg = $my_cipher->encrypt($msg);
- #my $crypted_msg = $msg;
+
return $crypted_msg;
}
# DESCRIPTION: decrypts the incoming message with the Crypt::Rijndael module
#===============================================================================
sub decrypt_msg {
- my ($crypted_msg, $my_cipher) =@_;
- my $len = length $crypted_msg;
- my $msg = $my_cipher->decrypt($crypted_msg);
- $msg =~ s/^0*//g;
+ my ($crypted_msg, $my_cipher) = @_ ;
+ my $msg = $my_cipher->decrypt($crypted_msg);
return $msg;
}
index cb22a9c5c8b756e219f54cbdea2cebc92cca079d..2435161c9b1891123a782cef45e0da36e75b60f9 100644 (file)
use strict;
use warnings;
+use Crypt::CBC;
BEGIN{
# create general settings for this module
my $gosa_cipher = &main::create_ciphering($main::gosa_passwd);
-
+#$gosa_cipher->set_iv("hallo");
sub get_module_tags {
my $msg_hash;
eval{
$msg = &main::decrypt_msg($crypted_msg, $gosa_cipher);
-
&main::daemon_log("GosaPackages: decrypted_msg: $msg", 7);
+
$msg_hash = $main::xml->XMLin($msg, ForceArray=>1);
};
if($@) {