diff mbox

[OpenWrt-Devel] hostapd: add RADIUS mac authentication

Message ID 20150715184908.3be2464f@samsung
State Changes Requested
Delegated to: Felix Fietkau
Headers show

Commit Message

Cezary Jackiewicz July 15, 2015, 4:49 p.m. UTC
Allow to use radius server to mac authentication. 
Config section:
  ..
  option 'macfilter' 'radius'
  option 'auth_server' '192.168.1.100'
  option 'auth_secret' 'RadiusPassword'
  option 'auth_port' '1812'


Tested with freeradius and Coova/radproxy.

Signed-off-by: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>  
---
diff mbox

Patch

diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
index a3ffd93..bca9631 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -419,6 +419,22 @@  hostapd_set_bss_options() {
 			append bss_conf "macaddr_acl=0" "$N"
 			append bss_conf "deny_mac_file=$_macfile" "$N"
 		;;
+		radius)
+			append bss_conf "macaddr_acl=2" "$N"
+
+			json_get_vars auth_server auth_secret auth_port
+
+			# legacy compatibility
+			[ -n "$auth_server" ] || json_get_var auth_server server
+			[ -n "$auth_port" ] || json_get_var auth_port port
+			[ -n "$auth_secret" ] || json_get_var auth_secret key
+
+			set_default auth_port 1812
+
+			append bss_conf "auth_server_addr=$auth_server" "$N"
+			append bss_conf "auth_server_port=$auth_port" "$N"
+			append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
+		;;
 		*)
 			_macfile=""
 		;;