Send Linux-ha-cvs mailing list submissions to
        linux-ha-cvs@lists.linux-ha.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: ldirectord by horms from 
      (linux-ha-cvs@lists.linux-ha.org)
   2. Linux-HA CVS: ldirectord by horms from 
      (linux-ha-cvs@lists.linux-ha.org)
   3. Linux-HA CVS: ldirectord by horms from 
      (linux-ha-cvs@lists.linux-ha.org)


----------------------------------------------------------------------

Message: 1
Date: Tue, 15 Aug 2006 02:53:32 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : horms
Host    : 
Project : linux-ha
Module  : ldirectord

Dir     : linux-ha/ldirectord


Modified Files:
      Tag: STABLE_1_2
        ldirectord 


Log Message:
Handle signals outside of signal handlers

Make the signal handlers set flags, and then do the
dirty work later on. I'm surprised the old code never
fell over. Hopefully this doesn't break stuff.

Backport of 1.180 (ldirectord.in 1.36)

Signed-Off-By: Simon Horman <[EMAIL PROTECTED]>

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/Attic/ldirectord,v
retrieving revision 1.77.2.81
retrieving revision 1.77.2.82
diff -u -3 -r1.77.2.81 -r1.77.2.82
--- ldirectord  15 Aug 2006 08:51:56 -0000      1.77.2.81
+++ ldirectord  15 Aug 2006 08:53:32 -0000      1.77.2.82
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-my($VERSION)=(qw$Id: ldirectord,v 1.77.2.81 2006/08/15 08:51:56 horms Exp 
$)[2];
+my($VERSION)=(qw$Id: ldirectord,v 1.77.2.82 2006/08/15 08:53:32 horms Exp 
$)[2];
 
 ######################################################################
 # ldirectord                 http://www.vergenet.net/linux/ldirectord/
@@ -524,6 +524,8 @@
            $DAEMON_STATUS_STOPPING
            $DAEMON_STATUS_RELOADING
            $DAEMON_STATUS_ALL
+           $DAEMON_TERM
+           $DAEMON_HUP
            $opt_d
            $opt_h
            $pid
@@ -548,6 +550,8 @@
                           $DAEMON_STATUS_RELOADING;
 
 # default values
+$DAEMON_TERM      = undef;
+$DAEMON_HUP       = undef;
 $AUTOCHECK        = "no";
 $CHECKINTERVAL    = 10;
 $CHECKTIMEOUT     = 5;
@@ -814,30 +818,50 @@
 # If we get a sinal then log it and quit
 sub ld_handler_term
 {
-    my ($signal) = (@_);
-       if ($DAEMON_STATUS == $DAEMON_STATUS_STOPPING) {
+        my ($signal) = (@_);
+
+       if (defined $DAEMON_TERM) {
                $SIG{'__DIE__'} = "IGNORE";
                $SIG{"$signal"} = "IGNORE";
                die("Exit Handler Repeatedly Called\n");
        }
+       $DAEMON_TERM = $signal;
        $DAEMON_STATUS = $DAEMON_STATUS_STOPPING;
+}
 
+sub ld_process_term
+{
+       $DAEMON_STATUS = $DAEMON_STATUS_STOPPING;
        ld_cmd_children("stop", %LD_INSTANCE);
        ld_stop();
-       &ld_log("Linux Director Daemon terminated on signal: $signal");
+       &ld_log("Linux Director Daemon terminated on signal: $DAEMON_TERM");
        &ld_rm_file("$RUNPID.$CFGNAME.pid");
-       &ld_exit(0, "Linux Director Daemon terminated on signal: $signal");
+       &ld_exit(0, "Linux Director Daemon terminated on signal: $DAEMON_TERM");
 }
 
-
 sub ld_handler_hup
 {
-        my ($signal) = (@_);
-       &ld_log("Reloading Linux Director Daemon config on signal: $signal");
+       $DAEMON_HUP=1;
+}
+
+sub ld_process_hup
+{
+       &ld_log("Reloading Linux Director Daemon config on signal");
+       $DAEMON_HUP = undef;
        &reread_config();
 }
 
 
+sub check_signal
+{
+       if (defined $DAEMON_TERM) {
+               ld_process_term();
+       }
+       if (defined $DAEMON_HUP) {
+               ld_process_hup();
+       }
+}
+
 sub reread_config
 {
        @OLDVIRTUAL = @VIRTUAL;
@@ -1951,6 +1975,7 @@
 
                        REAL: foreach my $r (@$real) {
                                my $real_id = get_real_id_str($r, $v);
+                               check_signal();
                                foreach my $tmp_id (@real_checked) {
                                        if($real_id eq $tmp_id) {
                                                &ld_debug(3, "Already checked: 
real server=$real_id (virtual=$virtual_id)");
@@ -2019,11 +2044,15 @@
                        }
                        # $ua->wait($$v{checktimeout});
                }
+               check_signal();
                if (!check_cfgfile()) {
                        sleep $CHECKINTERVAL;
                }
                        
+               check_signal();
                ld_emailalert_resend();
+
+               check_signal();
        }
 }
 




------------------------------

Message: 2
Date: Tue, 15 Aug 2006 02:54:31 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : horms
Host    : 
Project : linux-ha
Module  : ldirectord

Dir     : linux-ha/ldirectord


Modified Files:
      Tag: STABLE_1_2
        ldirectord 


Log Message:
Use ld_cmd_children in reread_config

This cleans up the implementation of reread_config by making lists
(actually hash, but nevermind) of configs to start, stop and reload,
and using ld_cmd_children to effect this.

Backport of 1.181 (ldirectord.in 1.37)

Signed-Off-By: Simon Horman <[EMAIL PROTECTED]>

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/Attic/ldirectord,v
retrieving revision 1.77.2.82
retrieving revision 1.77.2.83
diff -u -3 -r1.77.2.82 -r1.77.2.83
--- ldirectord  15 Aug 2006 08:53:32 -0000      1.77.2.82
+++ ldirectord  15 Aug 2006 08:54:31 -0000      1.77.2.83
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-my($VERSION)=(qw$Id: ldirectord,v 1.77.2.82 2006/08/15 08:53:32 horms Exp 
$)[2];
+my($VERSION)=(qw$Id: ldirectord,v 1.77.2.83 2006/08/15 08:54:31 horms Exp 
$)[2];
 
 ######################################################################
 # ldirectord                 http://www.vergenet.net/linux/ldirectord/
@@ -866,24 +866,32 @@
 {
        @OLDVIRTUAL = @VIRTUAL;
        my %OLD_INSTANCE = %LD_INSTANCE;
+       my %RELOAD;
+       my %STOP;
+       my %START;
+       my $child;
        $DAEMON_STATUS = $DAEMON_STATUS_RELOADING;
        eval {
                &read_config();
-               my %NEW_INSTANCE = %LD_INSTANCE;
-               &ld_setup();
-               &ld_start();
-               my $child;
+
+               foreach $child (keys %LD_INSTANCE) {
+                       if (defined $OLD_INSTANCE{$child}) {
+                               $RELOAD{$child} = 1;
+                       }
+                       else {
+                               $START{$child} = 1;
+                       }
+               }
+
                foreach $child (keys %OLD_INSTANCE) {
-                       if (exists $NEW_INSTANCE{$child}) {
-                               delete $OLD_INSTANCE{$child};
-                               delete $NEW_INSTANCE{$child};
-                               if (system("$LDIRECTORD $child reload")) {
-                                       system("$LDIRECTORD $child start");
-                               }
+                       if (not defined $LD_INSTANCE{$child}) {
+                               $STOP{$child} = 1;
                        }
                }
-               &ld_cmd_children("stop", %OLD_INSTANCE);
-               &ld_cmd_children("start", %NEW_INSTANCE);
+
+               &ld_cmd_children("stop", %STOP);
+               &ld_cmd_children("reload_or_start", %RELOAD);
+               &ld_cmd_children("start", %START);
        };
        if ($@) {
                @VIRTUAL = @OLDVIRTUAL;
@@ -1945,7 +1953,14 @@
        # instantiate other ldirectord, if specified
        my $child;
        foreach $child (keys %children) {
-               &system_wrapper("$LDIRECTORD $child $cmd");
+               if ($cmd eq "reload_or_start") {
+                       if (&system_wrapper("$LDIRECTORD $child reload")) {
+                               &system_wrapper("$LDIRECTORD $child start");
+                       }
+               }
+               else {
+                       &system_wrapper("$LDIRECTORD $child $cmd");
+               }
        }
 }
 




------------------------------

Message: 3
Date: Tue, 15 Aug 2006 02:55:38 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : horms
Host    : 
Project : linux-ha
Module  : ldirectord

Dir     : linux-ha/ldirectord


Modified Files:
      Tag: STABLE_1_2
        ldirectord 


Log Message:
Add radius check

Backport of 1.182 (ldirectord.cf 1.38)

Cc: Ryan Williams <[EMAIL PROTECTED]>
Signed-Off-By: Horms <[EMAIL PROTECTED]>

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/Attic/ldirectord,v
retrieving revision 1.77.2.83
retrieving revision 1.77.2.84
diff -u -3 -r1.77.2.83 -r1.77.2.84
--- ldirectord  15 Aug 2006 08:54:31 -0000      1.77.2.83
+++ ldirectord  15 Aug 2006 08:55:37 -0000      1.77.2.84
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-my($VERSION)=(qw$Id: ldirectord,v 1.77.2.83 2006/08/15 08:54:31 horms Exp 
$)[2];
+my($VERSION)=(qw$Id: ldirectord,v 1.77.2.84 2006/08/15 08:55:37 horms Exp 
$)[2];
 
 ######################################################################
 # ldirectord                 http://www.vergenet.net/linux/ldirectord/
@@ -294,7 +294,7 @@
 On means no checking will take place and real servers will always be
 activated. Default is I<negotiate>.
 
-B<service = 
ftp>|B<smtp>|B<http>|B<pop>|B<pops>|B<nntp>|B<imap>|B<imaps>|B<ldap>|B<https>|B<dns>|B<mysql>|B<pgsql>|B<sip>|B<none>
+B<service = 
ftp>|B<smtp>|B<http>|B<pop>|B<pops>|B<nntp>|B<imap>|B<imaps>|B<ldap>|B<https>|B<dns>|B<radius>|B<mysql>|B<pgsql>|B<sip>|B<none>
 
 The type of service to monitor when using checktype=negotiate. None denotes
 a service that will not be monitored. 
@@ -326,6 +326,8 @@
 
 =item * Virtual server port is 995: pops
 
+=item * Virtual server port is 1812: radius
+
 =item * Virtual server port is 3306: mysql
 
 =item * Virtual server port is 5432: pgsql
@@ -388,6 +390,9 @@
 B<login = ">I<username>B<">
 
 Username to use to login to FTP, IMAP, LDAP, MySQL, POP, PostgreSQL.
+
+For Radius the passwd is used for the attribute User-Name.
+
 For SIP, the username is used as both the to and from address for an
 OPTIONS query.
 
@@ -412,6 +417,8 @@
 Password to use to login to FTP, IMAP, LDAP, MySQL, POP, PostgreSQL
 and SIP servers.
 
+For Radius the passwd is used for the attribute User-Password.
+
 Default:
 
 =over 4
@@ -432,6 +439,13 @@
 the query (set by B<receive> above) will be performed against.  This is a
 required setting.
 
+B<secret = ">I<radiussecret>B<">
+
+Secret to use for Radius servers, this is the secret used to perform an
+Access-Request with the username (set by B<login> above) and passwd (set by
+B<passwd> above).
+
+Default: empty string
 
 B<scheduler => I<scheduler_name>
 
@@ -1007,6 +1021,7 @@
                        $vsrv{negotiatetimeout} = -1;
                        $vsrv{num_connects} = 0;
                        $vsrv{httpmethod} = "GET";
+                       $vsrv{secret} = "";
                        push(@VIRTUAL, \%vsrv);
                        while(<CFGFILE>) {
                                $line++;
@@ -1066,6 +1081,9 @@
                                } elsif ($rcmd =~ /^database\s*=\s*\"(.*)\"/) {
                                        $1 =~ /(.+)/ or &config_error($line, 
"invalid database");
                                        $vsrv{database} = $1;
+                               } elsif ($rcmd =~ /^secret\s*=\s*\"(.*)\"/) {
+                                       $1 =~ /(.+)/ or &config_error($line, 
"invalid secret");
+                                       $vsrv{secret} = $1;
                                } elsif ($rcmd =~ /^load\s*=\s*\"(.*)\"/) {
                                        $1 =~ /(\w+)/ or &config_error($line, 
"invalid string for load testing");
                                        $vsrv{load} = $1;
@@ -1116,8 +1134,8 @@
                                        }
                                } elsif ($rcmd =~ /^service\s*=\s*(.*)/) {
                                        lc($1);
-                                       $1 =~ /(\w+)/ && ($1 eq "http" || $1 eq 
"https" || $1 eq "ldap" || $1 eq "ftp" || $1 eq "none" || $1 eq "smtp" || $1 eq 
"pop" || $1 eq "pops" || $1 eq "imap" || $1 eq "imaps" || $1 eq "nntp" || $1 eq 
"dns" || $1 eq "mysql" || $1 eq "pgsql" || $1 eq "sip")
-                                           or &config_error($line, "service 
must be http, https, ftp, smtp, pop, pops, imap, imaps, ldap, nntp, dns, mysql, 
pgsql, sip, or none");
+                                       $1 =~ /(\w+)/ && ($1 eq "http" || $1 eq 
"https" || $1 eq "ldap" || $1 eq "ftp" || $1 eq "none" || $1 eq "smtp" || $1 eq 
"pop" || $1 eq "pops" || $1 eq "imap" || $1 eq "imaps" || $1 eq "nntp" || $1 eq 
"dns" || $1 eq "mysql" || $1 eq "pgsql" || $1 eq "radius" || $1 eq "sip")
+                                           or &config_error($line, "service 
must be http, https, ftp, smtp, pop, pops, imap, imaps, ldap, nntp, dns, mysql, 
pgsql, radius, sip, or none");
                                        $vsrv{service} = $1;
                                        if($vsrv{service} eq "ftp" and 
                                                        $vsrv{login} eq "") {
@@ -1350,6 +1368,9 @@
                        elsif ($vsrv->{port} eq "53") {
                                $vsrv->{service} = "dns";
                        } 
+                       elsif ($vsrv->{port} eq "1812") {
+                               $vsrv->{service} = "radius";
+                       }
                        elsif ($vsrv->{port} eq "3306") {
                                $vsrv->{service} = "mysql";
                        } 
@@ -2023,6 +2044,9 @@
                                                $$r{num_connects} = 0 if 
(check_dns($v, $r));
                                        } elsif ($$v{service} eq "sip") {
                                                $$r{num_connects} = 0 if 
(check_sip($v, $r));
+                                       } elsif ($$v{service} eq "radius") {
+                                               $$r{num_connects} = 0 if 
(check_radius($v, $r));
+                                       }
                                        } elsif ($$v{service} eq "mysql") {
                                                $$r{num_connects} = 0 if 
(check_mysql($v, $r));
                                        } elsif ($$v{service} eq "pgsql") {
@@ -2374,6 +2398,48 @@
         return $status;
 }
 
+
+sub check_radius
+{
+        use Authen::Radius;
+
+        my ($v, $r) = @_;
+
+        &ld_debug(2, "Checking radius");
+
+        my $port=(defined $$v{checkport}?$$v{checkport}:$$r{port});
+        my $radius;
+        my $result = "";
+
+        eval {
+                local $SIG{'__DIE__'} = "DEFAULT";
+                local $SIG{'ALRM'} = sub { die "Timeout Alarm" };
+                &ld_debug(4, "Timeout is $$v{checktimeout}");
+                &ld_debug(2, "Starting Check");
+                alarm $$v{checktimeout};
+
+                &ld_debug(2, "Starting Radius");
+                $radius = new Authen::Radius(Host => "$$r{server}:$port",
+                                            Secret=>$$v{secret},
+                                            TimeOut=>$$v{checktimeout},
+                                            Errmode=>'die');
+                $result = $radius->check_pwd($$v{login}, $$v{passwd});
+                &ld_debug(2, "Finished Radius");
+                alarm 0; # Cancel the alarm
+        };
+        if ($result eq "") {
+                &service_set($v, $r, "down");
+                &ld_debug(3, "Deactivated service $$r{server}:$$r{port}: $@");
+                &ld_debug(3, "Radius Error: ".$radius->get_error);
+                return 0;
+        } else {
+                &service_set($v, $r, "up");
+                &ld_debug(3, "Activated service $$r{server}:$$r{port}");
+                return 1;
+        }
+}
+
+
 sub check_mysql
 {
        return check_sql(@_, "mysql", "database");




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
Linux-ha-cvs@lists.linux-ha.org
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 33, Issue 59
********************************************

Reply via email to