radius.init 846 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 ca "$cfg" ca_cert
  10. config_get key "$cfg" key
  11. config_get cert "$cfg" cert
  12. config_get users "$cfg" users
  13. config_get clients "$cfg" clients
  14. config_get auth_port "$cfg" auth_port 1812
  15. config_get acct_port "$cfg" acct_port 1813
  16. config_get identity "$cfg" identity "$(cat /proc/sys/kernel/hostname)"
  17. procd_open_instance $cfg
  18. procd_set_param command /usr/sbin/hostapd-radius \
  19. -C "$ca" \
  20. -c "$cert" -k "$key" \
  21. -s "$clients" -u "$users" \
  22. -p "$auth_port" -P "$acct_port" \
  23. -i "$identity"
  24. procd_close_instance
  25. }
  26. start_service() {
  27. config_load radius
  28. config_foreach radius_start radius
  29. }
  30. service_triggers()
  31. {
  32. procd_add_reload_trigger "radius"
  33. }