2 Called-Station-Id authorize unlang filtering question

tmihalicek tomislav.mihalicek at gmail.com
Mon Sep 20 12:22:07 CEST 2010


Hi everyone ...

I need to put up a certain scenario for radius. I have 2 Called-Station-Id
numbers 111111 an 122222, first number should always be accepted 
for auth users, the second one should be accessed after the user hits 10
hours quota on first number. 

I was wonder if this configuration is the right way.

server dialup {

authorize {
        preprocess
        expiration
        logintime
        if (Called-Station-Id == "111111") {
                sql_dialup
                pap
        }

        elsif (Called-Station-Id == "122222" && "%{sql_dialup: SELECT
SUM(acctsessiontime) FROM radacct_dialup \
                WHERE YEAR(acctstarttime) = YEAR(CURDATE()) AND
MONTH(acctstarttime) = MONTH(CURDATE()) \
                AND username = '%{SQL-User-Name}' HAVING
SUM(acctsessiontime) < 36000}") {
                sql_dialup
                pap
                update control {
                        Auth-Type := Reject
		}
		update replay {
			Reply-Message := "10 hour quota still not reached"
		}

	        elsif (Called-Station-Id == "122222" && "%{sql_dialup: SELECT
SUM(acctsessiontime) FROM radacct_dialup \
                WHERE YEAR(acctstarttime) = YEAR(CURDATE()) AND
MONTH(acctstarttime) = MONTH(CURDATE()) \
                AND username = '%{SQL-User-Name}' HAVING
SUM(acctsessiontime) >= 36000}") {
                sql_dialup
                pap
                update control {
                        Auth-Type := Accept
                }
                update replay { 
                        Reply-Message := "10 hour quota reached, access
accepted"
                }

		else {
        		reject
        	}
}

...

post-auth {
        exec
        Post-Auth-Type REJECT {
                attr_filter.access_reject
                        update reply {
                        Reply-Message := "Access denied"
                        }
        }
}

}

-- 
View this message in context: http://freeradius.1045715.n5.nabble.com/2-Called-Station-Id-authorize-unlang-filtering-question-tp2846418p2846418.html
Sent from the FreeRadius - User mailing list archive at Nabble.com.



More information about the Freeradius-Users mailing list