diff --git a/modules/radius/docs/radius.txt b/modules/radius/docs/radius.txt index 4a76144043ca07252cd4f4d17e8d61e18757a9d0..1f26947145b2161423011379f732b62335ea4efc 100644 --- a/modules/radius/docs/radius.txt +++ b/modules/radius/docs/radius.txt @@ -18,22 +18,18 @@ authentication source which uses the `radius:Radius` module to 'radius:Radius', /* - * The hostname of the RADIUS server. - * Required. + * An array with the radius servers to use, up to 10. + * The options are: + * - hostname: the hostname of the radius server, or its IP address. Required. + * - port: the port of the radius server. Optional, defaults to 1812. + * - secret: the radius secret to use with this server. Required. */ - 'hostname' => 'radius.example.org', - - /* - * The port number of the radius server. - * Optional, defaults to 1812. - */ - 'port' => 1812, - - /* - * The shared secret which is used when contacting the RADUIS server. - * Required. - */ - 'secret' => 'topsecret', + 'servers' => array(array('hostname' => 'radius1.example.org', + 'port' => 1812, + 'secret' => 'topsecret'), + array('hostname' => 'radius2.example.org', + 'port' => 1812, + 'secret' => 'topsecret')), /* * The timeout for contacting the RADIUS server, in seconds. @@ -47,6 +43,12 @@ authentication source which uses the `radius:Radius` module to */ 'retries' => 3, + /* + * The NAS identifier to use when querying the radius server. + * Optional, defaults to the current host name. + */ + 'nas_identifier' => 'client.example.org', + /* * The attribute name we should store the username in. Ths username * will not be saved in any attribute if this is NULL. diff --git a/modules/radius/lib/Auth/Source/Radius.php b/modules/radius/lib/Auth/Source/Radius.php index 917b6c1f011282ba4f06802bfeb1ac3bfc47cf17..aa1d89a13e0aa8a790ca17876b844d7f5adbb4ff 100644 --- a/modules/radius/lib/Auth/Source/Radius.php +++ b/modules/radius/lib/Auth/Source/Radius.php @@ -115,6 +115,9 @@ class sspmod_radius_Auth_Source_Radius extends sspmod_core_Auth_UserPassBase { /* Try to add all radius servers, trigger a failure if no one works. */ $success = false; foreach ($this->servers as $server) { + if (!isset($server['port'])) { + $server['port'] = 1812; + } if (!radius_add_server($radius, $server['hostname'], $server['port'], $server['secret'], $this->timeout, $this->retries)) { SimpleSAML_Logger::info("Could not connect to server: ".radius_strerror($radius)); @@ -173,8 +176,8 @@ class sspmod_radius_Auth_Source_Radius extends sspmod_core_Auth_UserPassBase { } /* Use the received user name */ - if ($attr_name == RADIUS_USER_NAME) { - $attributes[$this->usernameAttribute] = array($attr_value); + if ($resa['attr'] == RADIUS_USER_NAME) { + $attributes[$this->usernameAttribute] = array($resa['data']); continue; }