diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-06-22 12:10:38 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-06-22 12:10:38 (GMT) |
commit | c0311d98481b783f1d24dd6c59fe25ce994a090d (patch) | |
tree | dafb02e27d2000fabcca60ac096a5f5368973c83 | |
parent | 22e7b78685747ded288642f25fefee7c57d3645a (diff) | |
download | monitoring-plugins-c0311d98481b783f1d24dd6c59fe25ce994a090d.tar.gz |
check_radius: Support FreeRADIUS Client library
Allow for using the FreeRADIUS Client library instead of radiusclient or
radiusclient-ng. The latter two projects are dead.
Closes #1231.
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | REQUIREMENTS | 10 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | plugins/check_radius.c | 21 |
4 files changed, 30 insertions, 13 deletions
@@ -7,6 +7,7 @@ This file documents the major additions and syntax changes between releases. | |||
7 | check_ide_smart now defaults to plugin output, original output appended with -v | 7 | check_ide_smart now defaults to plugin output, original output appended with -v |
8 | Extra-Opts are now enabled by default | 8 | Extra-Opts are now enabled by default |
9 | check_swap now supports a configurable state when there is no swap | 9 | check_swap now supports a configurable state when there is no swap |
10 | check_radius now supports the FreeRADIUS Client library | ||
10 | 11 | ||
11 | FIXES | 12 | FIXES |
12 | Don't let e.g. check_http's -C option reset SSL version if e.g. -S 1 -C 5 is specified | 13 | Don't let e.g. check_http's -C option reset SSL version if e.g. -S 1 -C 5 is specified |
diff --git a/REQUIREMENTS b/REQUIREMENTS index 994764c..303fd62 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS | |||
@@ -50,14 +50,16 @@ check_dbi: | |||
50 | http://libdbi.sourceforge.net/ | 50 | http://libdbi.sourceforge.net/ |
51 | 51 | ||
52 | check_radius: | 52 | check_radius: |
53 | - Requires the radiusclient-ng library available from: | 53 | - Requires the FreeRADIUS Client library available from: |
54 | http://freeradius.org/freeradius-client/ | ||
55 | - As an alternative, the radiusclient-ng library may be used: | ||
54 | http://sourceforge.net/projects/radiusclient-ng.berlios/ | 56 | http://sourceforge.net/projects/radiusclient-ng.berlios/ |
55 | - This plugin also works with the original radiusclient library from | 57 | - This plugin also works with the original radiusclient library from |
56 | ftp://ftp.cityline.net/pub/radiusclient/ | 58 | ftp://ftp.cityline.net/pub/radiusclient/ |
57 | RPM (rpmfind): radiusclient 0.3.2, radiusclient-devel-0.3.2 | 59 | RPM (rpmfind): radiusclient 0.3.2, radiusclient-devel-0.3.2 |
58 | Unless you're using a distro-maintained version of this library you | 60 | However, you probably want to use the FreeRADIUS Client library, as |
59 | probably want to use radiusclient-ng. The original radiusclient library is | 61 | both radiusclient and radiusclient-ng are unmaintained and have known |
60 | unmaintained and has many known issues, particularly with 64bit systems. | 62 | issues. |
61 | 63 | ||
62 | check_snmp: | 64 | check_snmp: |
63 | - Requires the NET-SNMP package available from | 65 | - Requires the NET-SNMP package available from |
diff --git a/configure.ac b/configure.ac index a7501ab..9aaa515 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -286,8 +286,15 @@ AS_IF([test "x$with_radius" != "xno"], [ | |||
286 | RADIUSLIBS="-lradiusclient-ng" | 286 | RADIUSLIBS="-lradiusclient-ng" |
287 | AC_SUBST(RADIUSLIBS) | 287 | AC_SUBST(RADIUSLIBS) |
288 | else | 288 | else |
289 | AC_MSG_WARN([Skipping radius plugin]) | 289 | AC_CHECK_LIB(freeradius-client,rc_read_config) |
290 | AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) | 290 | if test "$ac_cv_lib_freeradius_client_rc_read_config" = "yes"; then |
291 | EXTRAS="$EXTRAS check_radius\$(EXEEXT)" | ||
292 | RADIUSLIBS="-lfreeradius-client" | ||
293 | AC_SUBST(RADIUSLIBS) | ||
294 | else | ||
295 | AC_MSG_WARN([Skipping radius plugin]) | ||
296 | AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).]) | ||
297 | fi | ||
291 | fi | 298 | fi |
292 | fi | 299 | fi |
293 | LIBS="$_SAVEDLIBS" | 300 | LIBS="$_SAVEDLIBS" |
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 3481f0c..9394d26 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
@@ -36,9 +36,10 @@ const char *email = "devel@monitoring-plugins.org"; | |||
36 | #include "utils.h" | 36 | #include "utils.h" |
37 | #include "netutils.h" | 37 | #include "netutils.h" |
38 | 38 | ||
39 | #ifdef HAVE_LIBRADIUSCLIENT_NG | 39 | #if defined(HAVE_LIBFREERADIUS_CLIENT) |
40 | #include <freeradius-client.h> | ||
41 | #elif defined(HAVE_LIBRADIUSCLIENT_NG) | ||
40 | #include <radiusclient-ng.h> | 42 | #include <radiusclient-ng.h> |
41 | rc_handle *rch = NULL; | ||
42 | #else | 43 | #else |
43 | #include <radiusclient.h> | 44 | #include <radiusclient.h> |
44 | #endif | 45 | #endif |
@@ -47,11 +48,14 @@ int process_arguments (int, char **); | |||
47 | void print_help (void); | 48 | void print_help (void); |
48 | void print_usage (void); | 49 | void print_usage (void); |
49 | 50 | ||
50 | /* libradiusclient(-ng) wrapper functions */ | 51 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) |
51 | #ifdef HAVE_LIBRADIUSCLIENT_NG | ||
52 | #define my_rc_conf_str(a) rc_conf_str(rch,a) | 52 | #define my_rc_conf_str(a) rc_conf_str(rch,a) |
53 | #define my_rc_send_server(a,b) rc_send_server(rch,a,b) | 53 | #define my_rc_send_server(a,b) rc_send_server(rch,a,b) |
54 | #ifdef HAVE_LIBFREERADIUS_CLIENT | ||
55 | #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,(a)->secret,e,f) | ||
56 | #else | ||
54 | #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,e,f) | 57 | #define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,e,f) |
58 | #endif | ||
55 | #define my_rc_own_ipaddress() rc_own_ipaddress(rch) | 59 | #define my_rc_own_ipaddress() rc_own_ipaddress(rch) |
56 | #define my_rc_avpair_add(a,b,c,d) rc_avpair_add(rch,a,b,c,-1,d) | 60 | #define my_rc_avpair_add(a,b,c,d) rc_avpair_add(rch,a,b,c,-1,d) |
57 | #define my_rc_read_dictionary(a) rc_read_dictionary(rch, a) | 61 | #define my_rc_read_dictionary(a) rc_read_dictionary(rch, a) |
@@ -72,6 +76,10 @@ void print_usage (void); | |||
72 | 76 | ||
73 | int my_rc_read_config(char *); | 77 | int my_rc_read_config(char *); |
74 | 78 | ||
79 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) | ||
80 | rc_handle *rch = NULL; | ||
81 | #endif | ||
82 | |||
75 | char *server = NULL; | 83 | char *server = NULL; |
76 | char *username = NULL; | 84 | char *username = NULL; |
77 | char *password = NULL; | 85 | char *password = NULL; |
@@ -142,11 +150,10 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. | |||
142 | int | 150 | int |
143 | main (int argc, char **argv) | 151 | main (int argc, char **argv) |
144 | { | 152 | { |
145 | UINT4 service; | ||
146 | char msg[BUFFER_LEN]; | 153 | char msg[BUFFER_LEN]; |
147 | SEND_DATA data; | 154 | SEND_DATA data; |
148 | int result = STATE_UNKNOWN; | 155 | int result = STATE_UNKNOWN; |
149 | UINT4 client_id; | 156 | uint32_t client_id, service; |
150 | char *str; | 157 | char *str; |
151 | 158 | ||
152 | setlocale (LC_ALL, ""); | 159 | setlocale (LC_ALL, ""); |
@@ -392,7 +399,7 @@ print_usage (void) | |||
392 | 399 | ||
393 | int my_rc_read_config(char * a) | 400 | int my_rc_read_config(char * a) |
394 | { | 401 | { |
395 | #ifdef HAVE_LIBRADIUSCLIENT_NG | 402 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) |
396 | rch = rc_read_config(a); | 403 | rch = rc_read_config(a); |
397 | return (rch == NULL) ? 1 : 0; | 404 | return (rch == NULL) ? 1 : 0; |
398 | #else | 405 | #else |