1 package SIPackages;
3 use Exporter;
4 @ISA = ("Exporter");
6 # Each module has to have a function 'process_incoming_msg'. This function works as a interface to gosa-sd and receives the msg hash from gosa-sd. 'process_incoming_function checks, wether it has a function to process the incoming msg and forward the msg to it.
9 use strict;
10 use warnings;
11 use GOSA::GosaSupportDaemon;
12 use IO::Socket::INET;
13 use XML::Simple;
14 use Data::Dumper;
15 use Net::LDAP;
16 use Socket qw/PF_INET SOCK_DGRAM inet_ntoa sockaddr_in/;
18 BEGIN{}
19 END {}
21 my ($known_clients_file_name);
22 my ($server_activ, $server_ip, $server_mac_address, $server_port, $server_passwd, $max_clients, $ldap_uri, $ldap_base, $ldap_admin_dn, $ldap_admin_password);
23 my ($bus_activ, $bus_passwd, $bus_ip, $bus_port);
24 my $server;
25 my $network_interface;
26 my $no_bus;
27 my (@ldap_cfg, @pam_cfg, @nss_cfg, $goto_admin, $goto_secret);
30 my %cfg_defaults =
31 (
32 "server" =>
33 {"server_activ" => [\$server_activ, "on"],
34 "server_ip" => [\$server_ip, "0.0.0.0"],
35 "server_mac_address" => [\$server_mac_address, ""],
36 "server_port" => [\$server_port, "20081"],
37 "server_passwd" => [\$server_passwd, ""],
38 "max_clients" => [\$max_clients, 100],
39 "ldap_uri" => [\$ldap_uri, ""],
40 "ldap_base" => [\$ldap_base, ""],
41 "ldap_admin_dn" => [\$ldap_admin_dn, ""],
42 "ldap_admin_password" => [\$ldap_admin_password, ""],
43 },
44 "bus" =>
45 {"bus_activ" => [\$bus_activ, "on"],
46 "bus_passwd" => [\$bus_passwd, ""],
47 "bus_ip" => [\$bus_ip, ""],
48 "bus_port" => [\$bus_port, "20080"],
49 },
50 );
52 ### START #####################################################################
54 # read configfile and import variables
55 &read_configfile();
57 # detect interfaces and mac address
58 $network_interface= &get_interface_for_ip($server_ip);
59 $server_mac_address= &get_mac($network_interface);
61 # complete addresses
62 if( $server_ip eq "0.0.0.0" ) {
63 $server_ip = "127.0.0.1";
64 }
65 my $server_address = "$server_ip:$server_port";
66 my $bus_address = "$bus_ip:$bus_port";
68 # create general settings for this module
69 my $xml = new XML::Simple();
71 # register at bus
72 if ($main::no_bus > 0) {
73 $bus_activ = "off"
74 }
75 if($bus_activ eq "on") {
76 ®ister_at_bus();
77 }
79 ### functions #################################################################
82 sub get_module_info {
83 my @info = ($server_address,
84 $server_passwd,
85 $server,
86 $server_activ,
87 "socket",
88 );
89 return \@info;
90 }
93 #=== FUNCTION ================================================================
94 # NAME: read_configfile
95 # PARAMETERS: cfg_file - string -
96 # RETURNS: nothing
97 # DESCRIPTION: read cfg_file and set variables
98 #===============================================================================
99 sub read_configfile {
100 my $cfg;
101 if( defined( $main::cfg_file) && ( length($main::cfg_file) > 0 )) {
102 if( -r $main::cfg_file ) {
103 $cfg = Config::IniFiles->new( -file => $main::cfg_file );
104 } else {
105 print STDERR "Couldn't read config file!";
106 }
107 } else {
108 $cfg = Config::IniFiles->new() ;
109 }
110 foreach my $section (keys %cfg_defaults) {
111 foreach my $param (keys %{$cfg_defaults{ $section }}) {
112 my $pinfo = $cfg_defaults{ $section }{ $param };
113 ${@$pinfo[0]} = $cfg->val( $section, $param, @$pinfo[1] );
114 }
115 }
117 # Read non predefined sections
118 my $param;
119 if ($cfg->SectionExists('ldap')){
120 foreach $param ($cfg->Parameters('ldap')){
121 push (@ldap_cfg, "$param ".$cfg->val('ldap', $param));
122 }
123 }
124 if ($cfg->SectionExists('pam_ldap')){
125 foreach $param ($cfg->Parameters('pam_ldap')){
126 push (@pam_cfg, "$param ".$cfg->val('pam_ldap', $param));
127 }
128 }
129 if ($cfg->SectionExists('nss_ldap')){
130 foreach $param ($cfg->Parameters('nss_ldap')){
131 push (@nss_cfg, "$param ".$cfg->val('nss_ldap', $param));
132 }
133 }
134 if ($cfg->SectionExists('goto')){
135 $goto_admin= $cfg->val('goto', 'terminal_admin');
136 $goto_secret= $cfg->val('goto', 'terminal_secret');
137 } else {
138 $goto_admin= undef;
139 $goto_secret= undef;
140 }
142 }
144 #=== FUNCTION ================================================================
145 # NAME: get_interface_for_ip
146 # PARAMETERS: ip address (i.e. 192.168.0.1)
147 # RETURNS: array: list of interfaces if ip=0.0.0.0, matching interface if found, undef else
148 # DESCRIPTION: Uses proc fs (/proc/net/dev) to get list of interfaces.
149 #===============================================================================
150 sub get_interface_for_ip {
151 my $result;
152 my $ip= shift;
153 if ($ip && length($ip) > 0) {
154 my @ifs= &get_interfaces();
155 if($ip eq "0.0.0.0") {
156 $result = "all";
157 } else {
158 foreach (@ifs) {
159 my $if=$_;
160 if(get_ip($if) eq $ip) {
161 $result = $if;
162 }
163 }
164 }
165 }
166 return $result;
167 }
169 #=== FUNCTION ================================================================
170 # NAME: get_interfaces
171 # PARAMETERS: none
172 # RETURNS: (list of interfaces)
173 # DESCRIPTION: Uses proc fs (/proc/net/dev) to get list of interfaces.
174 #===============================================================================
175 sub get_interfaces {
176 my @result;
177 my $PROC_NET_DEV= ('/proc/net/dev');
179 open(PROC_NET_DEV, "<$PROC_NET_DEV")
180 or die "Could not open $PROC_NET_DEV";
182 my @ifs = <PROC_NET_DEV>;
184 close(PROC_NET_DEV);
186 # Eat first two line
187 shift @ifs;
188 shift @ifs;
190 chomp @ifs;
191 foreach my $line(@ifs) {
192 my $if= (split /:/, $line)[0];
193 $if =~ s/^\s+//;
194 push @result, $if;
195 }
197 return @result;
198 }
200 #=== FUNCTION ================================================================
201 # NAME: get_mac
202 # PARAMETERS: interface name (i.e. eth0)
203 # RETURNS: (mac address)
204 # DESCRIPTION: Uses ioctl to get mac address directly from system.
205 #===============================================================================
206 sub get_mac {
207 my $ifreq= shift;
208 my $result;
209 if ($ifreq && length($ifreq) > 0) {
210 if($ifreq eq "all") {
211 $result = "00:00:00:00:00:00";
212 } else {
213 my $SIOCGIFHWADDR= 0x8927; # man 2 ioctl_list
215 # A configured MAC Address should always override a guessed value
216 if ($server_mac_address and length($server_mac_address) > 0) {
217 $result= $server_mac_address;
218 }
220 socket SOCKET, PF_INET, SOCK_DGRAM, getprotobyname('ip')
221 or die "socket: $!";
223 if(ioctl SOCKET, $SIOCGIFHWADDR, $ifreq) {
224 my ($if, $mac)= unpack 'h36 H12', $ifreq;
226 if (length($mac) > 0) {
227 $mac=~ m/^([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/;
228 $mac= sprintf("%s:%s:%s:%s:%s:%s", $1, $2, $3, $4, $5, $6);
229 $result = $mac;
230 }
231 }
232 }
233 }
234 return $result;
235 }
237 #=== FUNCTION ================================================================
238 # NAME: get_ip
239 # PARAMETERS: interface name (i.e. eth0)
240 # RETURNS: (ip address)
241 # DESCRIPTION: Uses ioctl to get ip address directly from system.
242 #===============================================================================
243 sub get_ip {
244 my $ifreq= shift;
245 my $result= "";
246 my $SIOCGIFADDR= 0x8915; # man 2 ioctl_list
247 my $proto= getprotobyname('ip');
249 socket SOCKET, PF_INET, SOCK_DGRAM, $proto
250 or die "socket: $!";
252 if(ioctl SOCKET, $SIOCGIFADDR, $ifreq) {
253 my ($if, $sin) = unpack 'a16 a16', $ifreq;
254 my ($port, $addr) = sockaddr_in $sin;
255 my $ip = inet_ntoa $addr;
257 if ($ip && length($ip) > 0) {
258 $result = $ip;
259 }
260 }
262 return $result;
263 }
266 #=== FUNCTION ================================================================
267 # NAME: register_at_bus
268 # PARAMETERS: nothing
269 # RETURNS: nothing
270 # DESCRIPTION: creates an entry in known_daemons and send a 'here_i_am' msg to bus
271 #===============================================================================
272 sub register_at_bus {
274 # add bus to known_server_db
275 my $res = $main::known_server_db->add_dbentry( {table=>'known_server',
276 primkey=>'hostname',
277 hostname=>$bus_address,
278 status=>'bus',
279 hostkey=>$bus_passwd,
280 timestamp=>&get_time,
281 } );
282 my $msg_hash = &create_xml_hash("here_i_am", $server_address, $bus_address);
283 my $answer = "";
284 $answer = &send_msg_hash2address($msg_hash, $bus_address, $bus_passwd);
285 if ($answer == 0) {
286 &main::daemon_log("register at bus: $bus_address", 1);
287 } else {
288 &main::daemon_log("unable to send 'register'-msg to bus '$bus_address': $answer", 1);
289 }
290 return;
291 }
294 #=== FUNCTION ================================================================
295 # NAME: process_incoming_msg
296 # PARAMETERS: crypted_msg - string - incoming crypted message
297 # RETURNS: nothing
298 # DESCRIPTION: handels the proceeded distribution to the appropriated functions
299 #===============================================================================
300 sub process_incoming_msg {
301 my ($msg, $msg_hash) = @_ ;
302 my $error = 0;
303 my $host_name;
304 my $host_key;
305 my @out_msg_l;
307 # process incoming msg
308 my $header = @{$msg_hash->{header}}[0];
309 my $source = @{$msg_hash->{source}}[0];
310 my @target_l = @{$msg_hash->{target}};
312 &main::daemon_log("SIPackages: msg to process: $header", 3);
313 &main::daemon_log("$msg", 8);
315 if( 0 == length @target_l){
316 &main::daemon_log("ERROR: no target specified for msg $header", 1);
317 $error++;
318 }
320 if( 1 == length @target_l) {
321 my $target = $target_l[0];
322 if( $target eq $server_address ) {
323 if ($header eq 'new_passwd') { @out_msg_l = &new_passwd($msg_hash) }
324 elsif ($header eq 'here_i_am') { @out_msg_l = &here_i_am($msg_hash) }
325 elsif ($header eq 'who_has') { @out_msg_l = &who_has($msg_hash) }
326 elsif ($header eq 'who_has_i_do') { @out_msg_l = &who_has_i_do($msg_hash) }
327 elsif ($header eq 'got_ping') { @out_msg_l = &got_ping($msg_hash)}
328 elsif ($header eq 'get_load') { @out_msg_l = &execute_actions($msg_hash)}
329 else {
330 &main::daemon_log("ERROR: $header is an unknown core funktion", 1);
331 $error++;
332 }
333 }
334 }
336 if( $error == 0) {
337 if( 0 == @out_msg_l ) {
338 push(@out_msg_l, $msg);
339 }
340 }
342 return \@out_msg_l;
343 }
346 #=== FUNCTION ================================================================
347 # NAME: got_ping
348 # PARAMETERS: msg_hash - hash - hash from function create_xml_hash
349 # RETURNS: nothing
350 # DESCRIPTION: process this incoming message
351 #===============================================================================
352 sub got_ping {
353 my ($msg_hash) = @_;
355 my $source = @{$msg_hash->{source}}[0];
356 my $target = @{$msg_hash->{target}}[0];
357 my $header = @{$msg_hash->{header}}[0];
359 if(exists $main::known_daemons->{$source}) {
360 &main::add_content2known_daemons(hostname=>$source, status=>$header);
361 } else {
362 &main::add_content2known_clients(hostname=>$source, status=>$header);
363 }
365 return;
366 }
369 #=== FUNCTION ================================================================
370 # NAME: new_passwd
371 # PARAMETERS: msg_hash - ref - hash from function create_xml_hash
372 # RETURNS: nothing
373 # DESCRIPTION: process this incoming message
374 #===============================================================================
375 sub new_passwd {
376 my ($msg_hash) = @_;
377 my @out_msg_l;
379 my $header = @{$msg_hash->{header}}[0];
380 my $source_name = @{$msg_hash->{source}}[0];
381 my $source_key = @{$msg_hash->{new_passwd}}[0];
382 my $query_res;
384 # check known_clients_db
385 my $sql_statement = "SELECT * FROM known_clients WHERE hostname='$source_name'";
386 $query_res = $main::known_clients_db->select_dbentry( $sql_statement );
387 if( 1 == keys %{$query_res} ) {
388 my $act_time = &get_time;
389 my $sql_statement= "UPDATE known_clients ".
390 "SET hostkey='$source_key', timestamp='$act_time' ".
391 "WHERE hostname='$source_name'";
392 my $res = $main::known_clients_db->update_dbentry( $sql_statement );
394 my $hash = &create_xml_hash("confirm_new_passwd", $server_address, $source_name);
395 my $out_msg = &create_xml_string($hash);
396 push(@out_msg_l, $out_msg);
397 }
399 # only do if host still not found
400 if( 0 == @out_msg_l ) {
401 # check known_server_db
402 $sql_statement = "SELECT * FROM known_server WHERE hostname='$source_name'";
403 $query_res = $main::known_server_db->select_dbentry( $sql_statement );
404 if( 1 == keys %{$query_res} ) {
405 my $act_time = &get_time;
406 my $sql_statement= "UPDATE known_server ".
407 "SET hostkey='$source_key', timestamp='$act_time' ".
408 "WHERE hostname='$source_name'";
409 my $res = $main::known_server_db->update_dbentry( $sql_statement );
411 my $hash = &create_xml_hash("confirm_new_passwd", $server_address, $source_name);
412 my $out_msg = &create_xml_string($hash);
413 push(@out_msg_l, $out_msg);
414 }
415 }
417 return @out_msg_l;
418 }
421 #=== FUNCTION ================================================================
422 # NAME: here_i_am
423 # PARAMETERS: msg_hash - hash - hash from function create_xml_hash
424 # RETURNS: nothing
425 # DESCRIPTION: process this incoming message
426 #===============================================================================
427 sub here_i_am {
428 my ($msg_hash) = @_;
429 my @out_msg_l;
430 my $out_hash;
432 my $source = @{$msg_hash->{source}}[0];
433 my $mac_address = @{$msg_hash->{mac_address}}[0];
435 # number of known clients
436 my $nu_clients= $main::known_clients_db->count_dbentries('known_clients');
438 # check wether client address or mac address is already known
439 my $sql_statement= "SELECT * FROM known_clients WHERE hostname='$source'";
440 my $db_res= $main::known_clients_db->select_dbentry( $sql_statement );
442 if ( 1 == keys %{$db_res} ) {
443 &main::daemon_log("WARNING: $source is already known as a client", 1);
444 &main::daemon_log("WARNING: values for $source are being overwritten", 1);
445 $nu_clients --;
446 }
448 # number of actual activ clients
449 my $act_nu_clients = $nu_clients;
451 &main::daemon_log("number of actual activ clients: $act_nu_clients", 5);
452 &main::daemon_log("number of maximal allowed clients: $max_clients", 5);
454 if($max_clients <= $act_nu_clients) {
455 my $out_hash = &create_xml_hash("denied", $server_address, $source);
456 &add_content2xml_hash($out_hash, "denied", "I_cannot_take_any_more_clients!");
457 my $passwd = @{$msg_hash->{new_passwd}}[0];
458 &send_msg_hash2address($out_hash, $source, $passwd);
459 return;
460 }
462 # new client accepted
463 my $new_passwd = @{$msg_hash->{new_passwd}}[0];
465 # create entry in known_clients
466 my $events = @{$msg_hash->{events}}[0];
469 # add entry to known_clients_db
470 my $res = $main::known_clients_db->add_dbentry( {table=>'known_clients',
471 primkey=>'hostname',
472 hostname=>$source,
473 events=>$events,
474 macaddress=>$mac_address,
475 status=>'registered',
476 hostkey=>$new_passwd,
477 timestamp=>&get_time,
478 } );
480 if ($res != 0) {
481 &main::daemon_log("ERROR: cannot add entry to known_clients: $res");
482 return;
483 }
485 # return acknowledgement to client
486 $out_hash = &create_xml_hash("registered", $server_address, $source);
487 my $register_out = &create_xml_string($out_hash);
488 push(@out_msg_l, $register_out);
490 # notify registered client to bus
491 if( $bus_activ eq "on") {
492 # fetch actual bus key
493 my $sql_statement= "SELECT * FROM known_server WHERE status='bus'";
494 my $query_res = $main::known_server_db->select_dbentry( $sql_statement );
495 my $hostkey = $query_res->{1}->{'hostkey'};
497 # send update msg to bus
498 $out_hash = &create_xml_hash("new_client", $server_address, $bus_address, $source);
499 my $new_client_out = &create_xml_string($out_hash);
500 push(@out_msg_l, $new_client_out);
501 &main::daemon_log("send bus msg that client '$source' has registerd at server '$server_address'", 3);
502 }
504 # give the new client his ldap config
505 my $new_ldap_config_out = &new_ldap_config($source);
506 if( $new_ldap_config_out ) {
507 push(@out_msg_l, $new_ldap_config_out);
508 }
511 return @out_msg_l;
512 }
515 #=== FUNCTION ================================================================
516 # NAME: who_has
517 # PARAMETERS: msg_hash - hash - hash from function create_xml_hash
518 # RETURNS: nothing
519 # DESCRIPTION: process this incoming message
520 #===============================================================================
521 sub who_has {
522 my ($msg_hash) = @_ ;
524 # what is your search pattern
525 my $search_pattern = @{$msg_hash->{who_has}}[0];
526 my $search_element = @{$msg_hash->{$search_pattern}}[0];
527 &main::daemon_log("who_has-msg looking for $search_pattern $search_element", 7);
529 # scanning known_clients for search_pattern
530 my @host_addresses = keys %$main::known_clients;
531 my $known_clients_entries = length @host_addresses;
532 my $host_address;
533 foreach my $host (@host_addresses) {
534 my $client_element = $main::known_clients->{$host}->{$search_pattern};
535 if ($search_element eq $client_element) {
536 $host_address = $host;
537 last;
538 }
539 }
541 # search was successful
542 if (defined $host_address) {
543 my $source = @{$msg_hash->{source}}[0];
544 my $out_msg = &create_xml_hash("who_has_i_do", $server_address, $source, "mac_address");
545 &add_content2xml_hash($out_msg, "mac_address", $search_element);
546 &send_msg_hash2address($out_msg, $bus_address);
547 }
548 return;
549 }
552 sub who_has_i_do {
553 my ($msg_hash) = @_ ;
554 my $header = @{$msg_hash->{header}}[0];
555 my $source = @{$msg_hash->{source}}[0];
556 my $search_param = @{$msg_hash->{$header}}[0];
557 my $search_value = @{$msg_hash->{$search_param}}[0];
558 print "\ngot msg $header:\nserver $source has client with $search_param $search_value\n";
559 }
562 #=== FUNCTION ================================================================
563 # NAME: new_ldap_config
564 # PARAMETERS: address - string - ip address and port of a host
565 # RETURNS: nothing
566 # DESCRIPTION: send to address the ldap configuration found for dn gotoLdapServer
567 #===============================================================================
568 sub new_ldap_config {
569 my ($address) = @_ ;
571 my $sql_statement= "SELECT * FROM known_clients WHERE hostname='$address'";
572 my $res = $main::known_clients_db->select_dbentry( $sql_statement );
574 # check hit
575 my $hit_counter = keys %{$res};
576 if( not $hit_counter == 1 ) {
577 &main::daemon_log("ERROR: more or no hit found in known_clients_db by query by '$address'", 1);
578 }
580 my $macaddress = $res->{1}->{macaddress};
581 my $hostkey = $res->{1}->{hostkey};
583 if (not defined $macaddress) {
584 &main::daemon_log("ERROR: no mac address found for client $address", 1);
585 return;
586 }
588 # Build LDAP connection
589 my $ldap = Net::LDAP->new($ldap_uri);
590 if( not defined $ldap ) {
591 &main::daemon_log("ERROR: cannot connect to ldap: $ldap_uri", 1);
592 return;
593 }
596 # Bind to a directory with dn and password
597 my $mesg= $ldap->bind($ldap_admin_dn, $ldap_admin_password);
599 # Perform search
600 $mesg = $ldap->search( base => $ldap_base,
601 scope => 'sub',
602 attrs => ['dn', 'gotoLdapServer'],
603 filter => "(&(objectClass=GOhard)(macaddress=$macaddress))");
604 $mesg->code && die $mesg->error;
606 # Sanity check
607 if ($mesg->count != 1) {
608 &main::daemon_log("WARNING: client mac address $macaddress not found/not unique in ldap search", 1);
609 &main::daemon_log("\tbase: $ldap_base", 1);
610 &main::daemon_log("\tscope: sub", 1);
611 &main::daemon_log("\tattrs: dn, gotoLdapServer", 1);
612 &main::daemon_log("\tfilter: (&(objectClass=GOhard)(macaddress=$macaddress))", 1);
613 return;
614 }
616 my $entry= $mesg->entry(0);
617 my $dn= $entry->dn;
618 my @servers= $entry->get_value("gotoLdapServer");
619 my @ldap_uris;
620 my $server;
621 my $base;
623 # Do we need to look at an object class?
624 if ($#servers < 1){
625 $mesg = $ldap->search( base => $ldap_base,
626 scope => 'sub',
627 attrs => ['dn', 'gotoLdapServer'],
628 filter => "(&(objectClass=gosaGroupOfNames)(member=$dn))");
629 $mesg->code && die $mesg->error;
631 # Sanity check
632 if ($mesg->count != 1) {
633 &main::daemon_log("WARNING: no LDAP information found for client mac $macaddress", 1);
634 return;
635 }
637 $entry= $mesg->entry(0);
638 $dn= $entry->dn;
639 @servers= $entry->get_value("gotoLdapServer");
640 }
642 @servers= sort (@servers);
644 foreach $server (@servers){
645 $base= $server;
646 $server =~ s%^[^:]+:[^:]+:(ldap.*://[^/]+)/.*$%$1%;
647 $base =~ s%^[^:]+:[^:]+:ldap.*://[^/]+/(.*)$%$1%;
648 push (@ldap_uris, $server);
649 }
651 # Unbind
652 $mesg = $ldap->unbind;
654 # Assemble data package
655 my %data = ( 'ldap_uri' => \@ldap_uris, 'ldap_base' => $base,
656 'ldap_cfg' => \@ldap_cfg, 'pam_cfg' => \@pam_cfg,'nss_cfg' => \@nss_cfg );
658 # Need to append GOto settings?
659 if (defined $goto_admin and defined $goto_secret){
660 $data{'goto_admin'}= $goto_admin;
661 $data{'goto_secret'}= $goto_secret;
662 }
664 # Send information
665 send_msg("new_ldap_config", $server_address, $address, \%data, $hostkey);
667 return;
668 }
671 #=== FUNCTION ================================================================
672 # NAME: execute_actions
673 # PARAMETERS: msg_hash - hash - hash from function create_xml_hash
674 # RETURNS: nothing
675 # DESCRIPTION: invokes the script specified in msg_hash which is located under
676 # /etc/gosad/actions
677 #===============================================================================
678 sub execute_actions {
679 my ($msg_hash) = @_ ;
680 my $configdir= '/etc/gosad/actions/';
681 my $result;
683 my $header = @{$msg_hash->{header}}[0];
684 my $source = @{$msg_hash->{source}}[0];
685 my $target = @{$msg_hash->{target}}[0];
687 if((not defined $source)
688 && (not defined $target)
689 && (not defined $header)) {
690 &main::daemon_log("ERROR: Entries missing in XML msg for gosad actions under /etc/gosad/actions");
691 } else {
692 my $parameters="";
693 my @params = @{$msg_hash->{$header}};
694 my $params = join(", ", @params);
695 &main::daemon_log("execute_actions: got parameters: $params", 5);
697 if (@params) {
698 foreach my $param (@params) {
699 my $param_value = (&get_content_from_xml_hash($msg_hash, $param))[0];
700 &main::daemon_log("execute_actions: parameter -> value: $param -> $param_value", 7);
701 $parameters.= " ".$param_value;
702 }
703 }
705 my $cmd= $configdir.$header."$parameters";
706 &main::daemon_log("execute_actions: executing cmd: $cmd", 7);
707 $result= "";
708 open(PIPE, "$cmd 2>&1 |");
709 while(<PIPE>) {
710 $result.=$_;
711 }
712 close(PIPE);
713 }
715 # process the event result
718 return;
719 }
722 1;