Currently, logging level of the RADIUS server is a constant corresponding to the highest verbosity (EXCESSIVE, ALL), but when running as a system service, the output is discarded. This commit makes logging verbosity configurable by `log_level` option and redirects all logs to `logd`. Possible levels are defined in hostap sources: https://w1.fi/cgit/hostap/tree/src/utils/wpa_debug.h?id=012a893c469157d5734f6f33953497ea6e3b0169#n23 Their reference is inlined in `radius.config` file. Default value for logging verbosity is INFO (even if the `-l` flag isn't specified). Signed-off-by: Dávid Benko <davidbenko@davidbenko.dev> Link: https://github.com/openwrt/openwrt/pull/18089 Signed-off-by: Robert Marko <robimarko@gmail.com>
47 lines
1 KiB
Bash
47 lines
1 KiB
Bash
#!/bin/sh /etc/rc.common
|
|
|
|
START=30
|
|
|
|
USE_PROCD=1
|
|
NAME=radius
|
|
|
|
radius_start() {
|
|
local cfg="$1"
|
|
|
|
config_get_bool disabled "$cfg" disabled 0
|
|
|
|
[ "$disabled" -gt 0 ] && return
|
|
|
|
config_get_bool ipv6 "$cfg" ipv6 1
|
|
config_get log_level "$cfg" log_level 3
|
|
config_get ca "$cfg" ca_cert
|
|
config_get key "$cfg" key
|
|
config_get cert "$cfg" cert
|
|
config_get users "$cfg" users
|
|
config_get clients "$cfg" clients
|
|
config_get auth_port "$cfg" auth_port 1812
|
|
config_get acct_port "$cfg" acct_port 1813
|
|
config_get identity "$cfg" identity "$(cat /proc/sys/kernel/hostname)"
|
|
|
|
procd_open_instance $cfg
|
|
procd_set_param command /usr/sbin/hostapd-radius \
|
|
-l "$log_level" -C "$ca" \
|
|
-c "$cert" -k "$key" \
|
|
-s "$clients" -u "$users" \
|
|
-p "$auth_port" -P "$acct_port" \
|
|
-i "$identity"
|
|
[ "$ipv6" -gt 0 ] && procd_append_param command -6
|
|
procd_set_param stdout 1
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
}
|
|
|
|
start_service() {
|
|
config_load radius
|
|
config_foreach radius_start radius
|
|
}
|
|
|
|
service_triggers()
|
|
{
|
|
procd_add_reload_trigger "radius"
|
|
}
|