|
@@ -86,13 +86,38 @@ RadiusHostDataSource(const DatabaseConnection::ParameterMap& parameters) {
|
|
if (rh == NULL) {
|
|
if (rh == NULL) {
|
|
isc_throw(isc::Exception, "Failed to initialize Radius client");
|
|
isc_throw(isc::Exception, "Failed to initialize Radius client");
|
|
}
|
|
}
|
|
- res = rc_add_config(rh, "authserver", "127.0.0.1", NULL, 0);
|
|
|
|
|
|
+ res = rc_add_config(rh, "auth_order", "radius", NULL, 0);
|
|
if (res != 0) {
|
|
if (res != 0) {
|
|
- isc_throw(isc::Exception, "Failed to initialize Radius client");
|
|
|
|
|
|
+ isc_throw(isc::Exception, "Failed to configure Radius auth_order");
|
|
|
|
+ }
|
|
|
|
+ /* TODO: just define manually the few attributes we need */
|
|
|
|
+ res = rc_add_config(rh, "dictionary", "/usr/share/radcli/dictionary", NULL, 0);
|
|
|
|
+ if (res != 0) {
|
|
|
|
+ isc_throw(isc::Exception, "Failed to configure Radius dictionary");
|
|
}
|
|
}
|
|
res = rc_add_config(rh, "radius_timeout", "1", NULL, 0);
|
|
res = rc_add_config(rh, "radius_timeout", "1", NULL, 0);
|
|
- res = rc_add_config(rh, "radius_retries", "2", NULL, 0);
|
|
|
|
- res = rc_add_config(rh, "serv-type", "udp", NULL, 0);
|
|
|
|
|
|
+ if (res != 0) {
|
|
|
|
+ isc_throw(isc::Exception, "Failed to configure Radius timeout");
|
|
|
|
+ }
|
|
|
|
+ res = rc_add_config(rh, "radius_retries", "1", NULL, 0);
|
|
|
|
+ if (res != 0) {
|
|
|
|
+ isc_throw(isc::Exception, "Failed to configure Radius retries");
|
|
|
|
+ }
|
|
|
|
+ res = rc_add_config(rh, "authserver", "127.0.0.1:1812:mysecret", NULL, 0);
|
|
|
|
+ if (res != 0) {
|
|
|
|
+ isc_throw(isc::Exception, "Failed to configure Radius authserver");
|
|
|
|
+ }
|
|
|
|
+ // Test and apply config (this also setups the necessary structures to
|
|
|
|
+ // send requests to the radius server)
|
|
|
|
+ res = rc_test_config(rh, "kea");
|
|
|
|
+ if (res != 0) {
|
|
|
|
+ isc_throw(isc::Exception, "Failed to apply radcli configuration");
|
|
|
|
+ }
|
|
|
|
+ // Load dictionary
|
|
|
|
+ res = rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"));
|
|
|
|
+ if (res != 0) {
|
|
|
|
+ isc_throw(isc::Exception, "Failed to read Radius dictionary");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
RadiusHostDataSource::~RadiusHostDataSource() {
|
|
RadiusHostDataSource::~RadiusHostDataSource() {
|