Send Linux-ha-cvs mailing list submissions to
[email protected]
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
([email protected])
2. Linux-HA CVS: ldirectord by horms from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Tue, 15 Aug 2006 01:38:14 -0600 (MDT)
From: [email protected]
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:
ldirectord.in
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.
Signed-Off-By: Simon Horman <[EMAIL PROTECTED]>
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- ldirectord.in 15 Aug 2006 07:36:59 -0000 1.36
+++ ldirectord.in 15 Aug 2006 07:38:14 -0000 1.37
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-my($VERSION)=(qw$Id: ldirectord.in,v 1.36 2006/08/15 07:36:59 horms Exp $)[2];
+my($VERSION)=(qw$Id: ldirectord.in,v 1.37 2006/08/15 07:38:14 horms Exp $)[2];
######################################################################
# ldirectord http://www.vergenet.net/linux/ldirectord/
@@ -877,24 +877,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;
@@ -1956,7 +1964,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: 2
Date: Tue, 15 Aug 2006 01:40:50 -0600 (MDT)
From: [email protected]
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:
ldirectord.in
Log Message:
Add radius check
Cc: Ryan Williams <[EMAIL PROTECTED]>
Signed-Off-By: Horms <[EMAIL PROTECTED]>
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ldirectord.in 15 Aug 2006 07:38:14 -0000 1.37
+++ ldirectord.in 15 Aug 2006 07:40:50 -0000 1.38
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-my($VERSION)=(qw$Id: ldirectord.in,v 1.37 2006/08/15 07:38:14 horms Exp $)[2];
+my($VERSION)=(qw$Id: ldirectord.in,v 1.38 2006/08/15 07:40:50 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>
@@ -1018,6 +1032,7 @@
$vsrv{negotiatetimeout} = -1;
$vsrv{num_connects} = 0;
$vsrv{httpmethod} = "GET";
+ $vsrv{secret} = "";
push(@VIRTUAL, \%vsrv);
while(<CFGFILE>) {
$line++;
@@ -1077,6 +1092,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;
@@ -1127,8 +1145,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 "") {
@@ -1361,6 +1379,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";
}
@@ -2034,6 +2055,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") {
@@ -2385,6 +2409,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
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 33, Issue 43
********************************************