summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aeaf2d0)
raw | patch | inline | side by side (parent: aeaf2d0)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 30 Jan 2008 12:14:44 +0000 (12:14 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 30 Jan 2008 12:14:44 +0000 (12:14 +0000) |
Interface and LDAP settings are now configured through config file.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8660 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8660 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/modules/ArpHandler.pm | patch | blob | history | |
gosa-si/server.conf | patch | blob | history |
index 0849c5dd08f2c1c66ee5ae7fe8069dd7bd607e65..539273a0634d7debd647bf5b29ccefd1c406bc97 100644 (file)
END{}
-my ($timeout, $mailto, $mailfrom, $user, $group);
-my %daemon_children;
-my ($ldap, $bind_phrase, $password, $ldap_base, $interface) ;
+#my ($timeout, $mailto, $mailfrom, $user, $group);
+my ($arp_activ, $arp_interface, $ldap_uri, $ldap_base, $ldap_admin_dn, $ldap_admin_password);
my $hosts_database={};
my $resolver=Net::DNS::Resolver->new;
+my $ldap;
+
+my %cfg_defaults =
+(
+"arp" => {
+ "arp_activ" => [\$arp_activ, "on"],
+ "arp_interface" => [\$arp_interface, "all"],
+ "ldap_uri" => [\$ldap_uri, ""],
+ "ldap_base" => [\$ldap_base, ""],
+ "ldap_admin_dn" => [\$ldap_admin_dn, ""],
+ "ldap_admin_password" => [\$ldap_admin_password, ""],
+ },
+);
-$ldap_base = "dc=gonicus,dc=de" ;
-$interface = "all";
+#=== FUNCTION ================================================================
+# NAME: read_configfile
+# PARAMETERS: cfg_file - string -
+# RETURNS: nothing
+# DESCRIPTION: read cfg_file and set variables
+#===============================================================================
+sub read_configfile {
+ my $cfg;
+ if( defined( $main::cfg_file) && ( length($main::cfg_file) > 0 )) {
+ if( -r $main::cfg_file ) {
+ $cfg = Config::IniFiles->new( -file => $main::cfg_file );
+ } else {
+ print STDERR "Couldn't read config file!";
+ }
+ } else {
+ $cfg = Config::IniFiles->new() ;
+ }
+ foreach my $section (keys %cfg_defaults) {
+ foreach my $param (keys %{$cfg_defaults{ $section }}) {
+ my $pinfo = $cfg_defaults{ $section }{ $param };
+ ${@$pinfo[0]} = $cfg->val( $section, $param, @$pinfo[1] );
+ }
+ }
+}
sub get_module_info {
my @info = (undef,
"socket",
);
+ &read_configfile();
# Don't start if some of the modules are missing
- if($start_service) {
+ if(($arp_activ eq 'on') && $start_service) {
eval {
$ldap = Net::LDAP->new("ldap.intranet.gonicus.de");
};
}
# When interface is not configured (or 'all'), start arpwatch on all possible interfaces
- if ((!defined($interface)) || $interface eq 'all') {
+ if ((!defined($arp_interface)) || $arp_interface eq 'all') {
foreach my $device(&get_interfaces) {
# TODO: Need a better workaround for IPv4-to-IPv6 bridges
if($device =~ m/^sit\d+$/) {
}
}
} else {
- foreach my $device(split(/[\s,]+/, $interface)) {
+ foreach my $device(split(/[\s,]+/, $arp_interface)) {
&main::daemon_log("Starting ArpWatch on $device", 1);
POE::Session->create(
inline_states => {
);
}
}
+ } else {
+ &main::daemon_log("ArpHandler disabled. Not starting any capture processes");
}
return \@info;
}
diff --git a/gosa-si/server.conf b/gosa-si/server.conf
index fa53b42c5e2a4ecdec8e107bbd4f06d1bc05a2c1..05647e0f63aa53bdcca283d4c0553a2f04018dfa 100644 (file)
--- a/gosa-si/server.conf
+++ b/gosa-si/server.conf
server_event_dir = /usr/lib/gosa-si/server/events
[arp]
-arp_activ = off
-arp_fifo_path = /var/run/gosa-si/arp-notify
+arp_activ = on
+arp_interface = all
+ldap_uri = localhost
+ldap_base = dc=example,dc=com
+ldap_admin_dn = cn=ldapadmin,dc=example,dc=com
+ldap_admin_password = secret
[gosa]
gosa_activ = on