Table of Contents

Restrict connections by SSID

How does a quick-fix look

Ruckus-SSID = "Test2"

Since the quick fix did not fulfill all our desires we invented something which does: The SSIDs applet

The SSID applet

How do we do it?

RADIUSdesk_rewrite_called_station_id {
    if(Called-Station-Id =~ /^([0-9a-f]{2})[-:]?([0-9a-f]{2})[-:.]?([0-9a-f]{2})[-:]?([0-9a-f]{2})[-:.]?([0-9a-f]{2})[-:]?([0-9a-f]{2})[-:]?([-a-z0-9_. ]*)?/i){
        if("%{7}"){
            update control {
                Rd-Ssid-Value := "%{7}"
            }
            updated
        }
	else {
           noop
        } 
    }
    else {
         noop
    }
}
RADIUSdesk_user_ssid_check {
    #__We check if the user is flagged to only connect through certain SSIDs (Rd-Ssid-Check == 1)_
    #__If so we try to find the SSID and see if this ssid is allowed for the specific user________
 
    #If it is present....
    if("%{control:Rd-Ssid-Check}"){
        #If it is == 1
        if("%{control:Rd-Ssid-Check}" == 1){
            RADIUSdesk_rewrite_called_station_id
            if(updated){
                if("%{sql:SELECT COUNT(*) FROM user_ssids WHERE username= '%{request:User-Name}' AND ssidname= '%{control:Rd-Ssid-Value}'}" > 0){
                    ok
                }
                else {
                    update reply {
                         Reply-Message := "User %{request:User-Name} has not permission to connect through SSID: %{control:Rd-Ssid-Value}"
		     }
                     reject
                }
           }
           else {
               update reply{
                   Reply-Message := "No SSID available to evaluate SSID restriction"
               }
               reject
            }
        }
    }
}