radius.init 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh /etc/rc.common
  2. START=30
  3. USE_PROCD=1
  4. NAME=radius
  5. radius_start() {
  6. local cfg="$1"
  7. config_get_bool disabled "$cfg" disabled 0
  8. [ "$disabled" -gt 0 ] && return
  9. config_get_bool ipv6 "$cfg" ipv6 1
  10. config_get log_level "$cfg" log_level 3
  11. config_get ca "$cfg" ca_cert
  12. config_get key "$cfg" key
  13. config_get cert "$cfg" cert
  14. config_get users "$cfg" users
  15. config_get clients "$cfg" clients
  16. config_get auth_port "$cfg" auth_port 1812
  17. config_get acct_port "$cfg" acct_port 1813
  18. config_get identity "$cfg" identity "$(cat /proc/sys/kernel/hostname)"
  19. procd_open_instance $cfg
  20. procd_set_param command /usr/sbin/hostapd-radius \
  21. -l "$log_level" -C "$ca" \
  22. -c "$cert" -k "$key" \
  23. -s "$clients" -u "$users" \
  24. -p "$auth_port" -P "$acct_port" \
  25. -i "$identity"
  26. [ "$ipv6" -gt 0 ] && procd_append_param command -6
  27. procd_set_param stdout 1
  28. procd_set_param stderr 1
  29. procd_close_instance
  30. }
  31. start_service() {
  32. config_load radius
  33. config_foreach radius_start radius
  34. }
  35. service_triggers()
  36. {
  37. procd_add_reload_trigger "radius"
  38. }