# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = WITH_PROXY \
- WITH_ACCOUNTING \
WITH_STATS \
HAVE_JSON
*/
#ifndef WITHOUT_PROXY
# define WITH_PROXY (1)
-#else
-# define WITHOUT_COA (1)
-#endif
-
-#ifndef WITHOUT_ACCOUNTING
-# define WITH_ACCOUNTING (1)
#endif
#ifndef WITHOUT_STATS
#ifdef WITH_STATS
fr_stats_t auth; //!< Authentication stats.
-# ifdef WITH_ACCOUNTING
fr_stats_t acct; //!< Accounting stats.
-# endif
#endif
fr_time_delta_t response_window; //!< How long the client has to respond.
{
default_feature_cs = cs;
- dependency_feature_add(cs, "accounting",
-#ifdef WITH_ACCOUNTING
- true
-#else
- false
-#endif
- );
+ dependency_feature_add(cs, "accounting", true);
dependency_feature_add(cs, "authentication", true);
{ 0, 0, 0, 0, 0, 0, 0, 0 }}
fr_stats_t radius_auth_stats = FR_STATS_INIT;
-#ifdef WITH_ACCOUNTING
fr_stats_t radius_acct_stats = FR_STATS_INIT;
-#endif
#ifdef WITH_PROXY
fr_stats_t proxy_auth_stats = FR_STATS_INIT;
-#ifdef WITH_ACCOUNTING
fr_stats_t proxy_acct_stats = FR_STATS_INIT;
#endif
-#endif
void request_stats_final(REQUEST *request)
{
if (!request->packet) return;
if ((request->listener->type != RAD_LISTEN_NONE) &&
-#ifdef WITH_ACCOUNTING
(request->listener->type != RAD_LISTEN_ACCT) &&
-#endif
(request->listener->type != RAD_LISTEN_AUTH)) return;
/* don't count statistic requests */
#define INC_AUTH(_x) radius_auth_stats._x++;request->listener->stats._x++;request->client->auth._x++;
#undef INC_ACCT
-#ifdef WITH_ACCOUNTING
#define INC_ACCT(_x) radius_acct_stats._x++;request->listener->stats._x++;request->client->acct._x++
-#else
-#define INC_ACCT(_x)
-#endif
/*
* Update the statistics.
INC_AUTH(total_access_challenges);
goto auth_stats;
-#ifdef WITH_ACCOUNTING
case FR_CODE_ACCOUNTING_RESPONSE:
INC_ACCT(total_responses);
fr_stats_bins(&radius_acct_stats,
request->packet->timestamp,
request->reply->timestamp);
break;
-#endif
/*
* No response, it must have been a bad
break;
-#ifdef WITH_ACCOUNTING
case FR_CODE_ACCOUNTING_REQUEST:
if (request->reply->id == -1) {
INC_ACCT(total_bad_authenticators);
INC_ACCT(total_packets_dropped);
}
break;
-#endif
default:
break;
#endif
break;
-#ifdef WITH_ACCOUNTING
case FR_CODE_ACCOUNTING_REQUEST:
#if 0
proxy_acct_stats.total_requests += request->proxy->packet->count;
request->proxy->home_server->stats.total_requests += request->proxy->packet->count;
#endif
break;
-#endif
default:
break;
#endif
goto proxy_stats;
-#ifdef WITH_ACCOUNTING
case FR_CODE_ACCOUNTING_RESPONSE:
#if 0
proxy_acct_stats.total_responses++;
&request->proxy->reply->timestamp);
#endif
break;
-#endif
default:
#if 0
#endif
-#ifdef WITH_ACCOUNTING
/*
* Accounting
*/
{ 0, 0 }
};
#endif
-#endif
static fr_stats2vp client_authvp[] = {
{ FR_FREERADIUS_TOTAL_ACCESS_REQUESTS, offsetof(fr_stats_t, total_requests) },
{ 0, 0 }
};
-#ifdef WITH_ACCOUNTING
static fr_stats2vp client_acctvp[] = {
{ FR_FREERADIUS_TOTAL_ACCOUNTING_REQUESTS, offsetof(fr_stats_t, total_requests) },
{ FR_FREERADIUS_TOTAL_ACCOUNTING_RESPONSES, offsetof(fr_stats_t, total_responses) },
{ FR_FREERADIUS_TOTAL_ACCT_UNKNOWN_TYPES, offsetof(fr_stats_t, total_unknown_types) },
{ 0, 0 }
};
-#endif
#define ADD_TO_REPLY(_attr, _vendor) \
do { \
request_stats_addvp(request, authvp, &radius_auth_stats);
}
-#ifdef WITH_ACCOUNTING
/*
* Accounting
*/
((flag->vp_uint32 & 0xc0) == 0)) {
request_stats_addvp(request, acctvp, &radius_acct_stats);
}
-#endif
#ifdef WITH_PROXY
/*
request_stats_addvp(request, proxy_authvp, &proxy_auth_stats);
}
-#ifdef WITH_ACCOUNTING
/*
* Proxied accounting requests.
*/
((flag->vp_uint32 & 0x20) == 0)) {
request_stats_addvp(request, proxy_acctvp, &proxy_acct_stats);
}
-#endif
#endif
/*
request_stats_addvp(request, client_authvp,
&client->auth);
}
-#ifdef WITH_ACCOUNTING
if ((flag->vp_uint32 & 0x02) != 0) {
request_stats_addvp(request, client_acctvp,
&client->acct);
}
-#endif
} /* else client wasn't found, don't echo it back */
}
request_stats_addvp(request, authvp, &this->stats);
}
-#ifdef WITH_ACCOUNTING
if (((flag->vp_uint32 & 0x02) != 0) &&
((request->listener->type == RAD_LISTEN_ACCT) ||
(request->listener->type == RAD_LISTEN_NONE))) {
request_stats_addvp(request, acctvp, &this->stats);
}
-#endif
}
#ifdef WITH_PROXY
&home->stats);
}
-#ifdef WITH_ACCOUNTING
if (((flag->vp_uint32 & 0x02) != 0) &&
(home->type == HOME_TYPE_ACCT)) {
request_stats_addvp(request, proxy_acctvp,
&home->stats);
}
-#endif
}
#endif /* WITH_PROXY */
}
} fr_stats_ema_t;
extern fr_stats_t radius_auth_stats;
-#ifdef WITH_ACCOUNTING
extern fr_stats_t radius_acct_stats;
-#endif
#ifdef WITH_PROXY
extern fr_stats_t proxy_auth_stats;
-#ifdef WITH_ACCOUNTING
extern fr_stats_t proxy_acct_stats;
#endif
-#endif
void radius_stats_init(int flag);
void request_stats_final(REQUEST *request);
{ FR_CONF_OFFSET("bucket", FR_TYPE_STRING | FR_TYPE_REQUIRED, rlm_couchbase_t, bucket) },
{ FR_CONF_OFFSET("username", FR_TYPE_STRING, rlm_couchbase_t, username) },
{ FR_CONF_OFFSET("password", FR_TYPE_STRING, rlm_couchbase_t, password) },
-#ifdef WITH_ACCOUNTING
+
{ FR_CONF_OFFSET("acct_key", FR_TYPE_TMPL, rlm_couchbase_t, acct_key), .dflt = "radacct_%{%{Acct-Unique-Session-Id}:-%{Acct-Session-Id}}", .quote = T_DOUBLE_QUOTED_STRING },
{ FR_CONF_OFFSET("doctype", FR_TYPE_STRING, rlm_couchbase_t, doctype), .dflt = "radacct" },
{ FR_CONF_OFFSET("expire", FR_TYPE_UINT32, rlm_couchbase_t, expire), .dflt = 0 },
-#endif
+
{ FR_CONF_OFFSET("user_key", FR_TYPE_TMPL, rlm_couchbase_t, user_key), .dflt = "raduser_%{md5:%{tolower:%{%{Stripped-User-Name}:-%{User-Name}}}}", .quote = T_DOUBLE_QUOTED_STRING },
{ FR_CONF_OFFSET("read_clients", FR_TYPE_BOOL, rlm_couchbase_t, read_clients) }, /* NULL defaults to "no" */
{ FR_CONF_POINTER("client", FR_TYPE_SUBSECTION, NULL), .subcs = (void const *) client_config },
return rcode;
}
-#ifdef WITH_ACCOUNTING
/** Write accounting data to Couchbase documents
*
* Handle accounting requests and store the associated data into JSON documents
/* return */
return rcode;
}
-#endif
/** Detach the module
.detach = mod_detach,
.methods = {
[MOD_AUTHORIZE] = mod_authorize,
-#ifdef WITH_ACCOUNTING
[MOD_ACCOUNTING] = mod_accounting,
-#endif
},
};
return RLM_MODULE_OK;
}
-#ifdef WITH_ACCOUNTING
/*
* Massage the request before recording it or proxying it
*/
{
return RLM_MODULE_OK;
}
-#endif
/*
.methods = {
[MOD_AUTHENTICATE] = mod_authenticate,
[MOD_AUTHORIZE] = mod_authorize,
-#ifdef WITH_ACCOUNTING
[MOD_PREACCT] = mod_preacct,
[MOD_ACCOUNTING] = mod_accounting,
-#endif
},
};
const char *func_authorize; //!< Name of function to run on authorization.
const char *func_authenticate; //!< Name of function to run on authentication.
-#ifdef WITH_ACCOUNTING
const char *func_preacct; //!< Name of function to run on preacct.
const char *func_accounting; //!< Name of function to run on accounting.
-#endif
const char *func_post_auth; //!< Name of function to run after authentication.
const char *func_xlat; //!< Name of function to be called for string expansions.
} rlm_lua_t;
{ FR_CONF_OFFSET("func_detach", FR_TYPE_STRING, rlm_lua_t, func_detach), NULL},
{ FR_CONF_OFFSET("func_authorize", FR_TYPE_STRING, rlm_lua_t, func_authorize), NULL},
{ FR_CONF_OFFSET("func_authenticate", FR_TYPE_STRING, rlm_lua_t, func_authenticate), NULL},
-#ifdef WITH_ACCOUNTING
{ FR_CONF_OFFSET("func_accounting", FR_TYPE_STRING, rlm_lua_t, func_accounting), NULL},
{ FR_CONF_OFFSET("func_preacct", FR_TYPE_STRING, rlm_lua_t, func_preacct), NULL},
-#endif
{ FR_CONF_OFFSET("func_xlat", FR_TYPE_STRING, rlm_lua_t, func_xlat), NULL},
{ FR_CONF_OFFSET("func_post_auth", FR_TYPE_STRING, rlm_lua_t, func_post_auth), NULL},
RLM_MRUBY_FUNC(authorize)
RLM_MRUBY_FUNC(authenticate)
RLM_MRUBY_FUNC(post_auth)
-#ifdef WITH_ACCOUNTING
RLM_MRUBY_FUNC(preacct)
RLM_MRUBY_FUNC(accounting)
-#endif
/*
[MOD_AUTHENTICATE] = mod_authenticate,
[MOD_AUTHORIZE] = mod_authorize,
[MOD_POST_AUTH] = mod_post_auth,
-#ifdef WITH_ACCOUNTING
[MOD_PREACCT] = mod_preacct,
[MOD_ACCOUNTING] = mod_accounting,
-#endif
},
};
{ NULL }
};
-#ifdef WITH_ACCOUNTING
/*
* Zap all users on a NAS from the radutmp file.
*/
return rcode;
}
-#endif
/* globally exported name */
extern module_t rlm_radutmp;
.inst_size = sizeof(rlm_radutmp_t),
.config = module_config,
.methods = {
-#ifdef WITH_ACCOUNTING
[MOD_ACCOUNTING] = mod_accounting,
-#endif
},
};
return rcode;
}
-#ifdef WITH_ACCOUNTING
-
/*
* Accounting: Insert or update session data in our sql table
*/
return RLM_MODULE_NOOP;
}
-#endif
-
/*
* Postauth: Write a record of the authentication attempt
*/
.detach = mod_detach,
.methods = {
[MOD_AUTHORIZE] = mod_authorize,
-#ifdef WITH_ACCOUNTING
[MOD_ACCOUNTING] = mod_accounting,
-#endif
[MOD_POST_AUTH] = mod_post_auth
},
};
return RLM_MODULE_OK;
}
-#ifdef WITH_ACCOUNTING
/*
* Massage the request before recording it or proxying it
*/
return RLM_MODULE_OK;
}
-#endif
/*
* Write accounting information to this modules database.
.methods = {
[MOD_AUTHENTICATE] = mod_authenticate,
[MOD_AUTHORIZE] = mod_authorize,
-#ifdef WITH_ACCOUNTING
[MOD_PREACCT] = mod_preacct,
[MOD_ACCOUNTING] = mod_accounting,
-#endif
},
.method_names = (module_method_names_t[]){
{ "recv", "Access-Challenge", mod_return },