Имеется биллинг УТМ5 и 3 сервера доступа cisco серии 7200. И в связи с этим встала проблема, что не добросовестные абоненты делятся логином с друзьями и сидят одновременно на 3х разных серверах.
Попытки что-то выжать из радиуса в комплекте с утм ни к чему не привели и было принято решение попробовать freeradius.
Полазив по нетаповскому форуму были найдены конфиги и произведен тестовый запуск, но радиус продолжает пускать уже подключенных клиентов.
Вот конфиг sql.conf:
Код: Выделить всё
sql {
driver = "rlm_sql_mysql"
server = "127.0.0.1"
login = "root"
password = "pass"
radius_db = "UTM"
port = "3306"
sqltracefile = "/usr/local/etc/raddb/log/sqltrace.sql"
sqltrace = yes
num_sql_socks = 5
connect_failure_retry_delay = 60
sql_user_name = "%{User-Name}"
#nas_query = ""
#authorize_check_query="SELECT ip_groups.ip_group_id, ip_groups.uname, 'Password', ip_groups.upass, ':=' FROM UTM.ip_groups, UTM.iptraffic_service_links, UTM.service_links, UTM.accounts WHERE ip_groups.uname = '%{SQL-User-Name}' AND ip_groups.is_deleted='0' AND iptraffic_service_links.is_deleted='0' AND service_links.is_deleted='0' AND accounts.is_deleted='0' AND accounts.is_blocked='0' AND ip_groups.ip_group_id=iptraffic_service_links.ip_group_id AND iptraffic_service_links.id=service_links.id AND service_links.account_id=accounts.id AND (ip_groups.allowed_cid='%{Calling-Station-Id}' OR ip_groups.allowed_cid='')"
#authorize_reply_query = "SELECT id,uname,'Framed-IP-Address',INET_NTOA((ip+0x100000000) % 0x100000000) AS ip,'=' FROM UTM.ip_groups WHERE uname = '%{SQL-User-Name}' AND is_deleted = '0' ORDER BY id DESC"
#accounting_stop_query="INSERT INTO dhs_sessions_log (account_id, recv_date, last_update_date, Framed_IP_Address, NAS_Port, Acct_Delay_Time, Acct_Session_Id, NAS_Port_Type, User_Name, Service_Type, Framed_Protocol, NAS_IP_Address, NAS_Id, Acct_Status_Type, Acct_Input_Packets, Acct_Input_Octets, Acct_Output_Packets, Acct_Output_Octets, Acct_Session_Time, Called_Station_Id, Calling_Station_Id) SELECT basic_account, (%l-%{Acct-Session-Time}), '%l', ((inet_aton('%{Framed-IP-Address}') &0xFFFFFFFF)-4294967296), '%{NAS-Port}', '%{Acct-Delay-Time}', '%{Acct-Session-Id}', '%{NAS-Port-Type}', '%{SQL-User-Name}', '%{Service-Type}', '%{Framed-Protocol}', ((inet_aton('%{NAS-IP-Address}')&0xFFFFFFFF)-4294967296), '%{NAS-IP-Address}', '2', '%{Acct-Output-Packets}', '%{Acct-Output-Octets}', '%{Acct-Input-Packets}', '%{Acct-Input-Octets}', '%{Acct-Session-Time}', '%{Tunnel-Server-Endpoint}', '%{Calling-Station-Id}%{Tunnel-Client-Endpoint}' FROM users WHERE login='%{SQL-User-Name}';"
authorize_check_query="SELECT ip_groups.ip_group_id, ip_groups.uname,'User-Password',ip_groups.upass,':=', max(recv_date) FROM UTM.ip_groups, UTM.iptraffic_service_links, UTM.service_links, UTM.accounts, UTM.dhs_sessions_log WHERE ip_groups.uname = '%{SQL-User-Name}' AND ip_groups.is_deleted='0' AND iptraffic_service_links.is_deleted='0' AND service_links.is_deleted='0' AND accounts.is_deleted='0' AND accounts.is_blocked='0' AND ip_groups.ip_group_id=iptraffic_service_links.ip_group_id AND iptraffic_service_links.id=service_links.id AND service_links.account_id=accounts.id AND dhs_sessions_log.Acct_Status_Type=2 AND dhs_sessions_log.User_Name='%{SQL-User-Name}' UNION SELECT ip_groups.ip_group_id, ip_groups.uname,'Simultaneous-Use','1',':=', max(recv_date) FROM UTM.ip_groups, UTM.iptraffic_service_links, UTM.service_links, UTM.accounts, UTM.dhs_sessions_log WHERE ip_groups.uname = '%{SQL-User-Name}' AND ip_groups.is_deleted='0' AND iptraffic_service_links.is_deleted='0' AND service_links.is_deleted='0' AND accounts.is_deleted='0' AND accounts.is_blocked='0' AND ip_groups.ip_group_id=iptraffic_service_links.ip_group_id AND iptraffic_service_links.id=service_links.id AND service_links.account_id=accounts.id AND dhs_sessions_log.Acct_Status_Type=2 AND dhs_sessions_log.User_Name='%{SQL-User-Name}'"
authorize_reply_query="SELECT ip_group_id, uname, 'Framed-IP-Address', inet_ntoa(ip_groups.ip & 0xFFFFFFFF) AS a, '=' FROM UTM.ip_groups WHERE uname = '%{SQL-User-Name}' AND is_deleted='0' UNION SELECT ip_group_id, uname, 'Acct-Interim-Interval', '60' as a, '=' FROM ip_groups WHERE uname = '%{SQL-User-Name}' AND is_deleted='0'"
accounting_start_query = "INSERT INTO dhs_sessions_log (account_id, slink_id, recv_date,last_update_date,Framed_IP_Address, NAS_Port, Acct_Delay_Time, Acct_Session_Id, NAS_Port_Type, User_Name, Service_Type, Framed_Protocol, NAS_IP_Address, NAS_Id, Acct_Status_Type, Acct_Input_Packets, Acct_Input_Octets, Acct_Input_Gigawords, Acct_Output_Packets,Acct_Output_Octets, Acct_Output_Gigawords, Acct_Session_Time, Acct_Terminate_Cause, Called_Station_Id, Calling_Station_Id ) VALUES ( (select account_id from service_links where id = ( select id from iptraffic_service_links where ip_group_id = ( select ip_group_id from ip_groups where uname = '%{SQL-User-Name}' and is_deleted <> '1' ))), ( select id from iptraffic_service_links where ip_group_id = ( select ip_group_id from ip_groups where uname = '%{SQL-User-Name}' and is_deleted <> '1' )), '%l','0', (INET_ATON(CONCAT_WS('.',SUBSTRING_INDEX('%{Framed-IP-Address}','.',-1),SUBSTRING_INDEX(SUBSTRING_INDEX('%{Framed-IP-Address}','.',-2),'.',1),SUBSTRING_INDEX(SUBSTRING_INDEX('%{Framed-IP-Address}','.',2),'.',-1),SUBSTRING_INDEX('%{Framed-IP-Address}','.',1)))), '%{NAS-Port}', '%{Acct-Delay-Time}', '%{Acct-Session-Id}', '%{NAS-Port-Type}', '%{SQL-User-name}', '%{Service-Type}', '%{Framed-Protocol}', (INET_ATON(CONCAT_WS('.',SUBSTRING_INDEX('%{NAS-IP-Address}','.',-1),SUBSTRING_INDEX(SUBSTRING_INDEX('%{NAS-IP-Address}','.',-2),'.',1),SUBSTRING_INDEX(SUBSTRING_INDEX('%{NAS-IP-Address}','.',2),'.',-1),SUBSTRING_INDEX('%{NAS-IP-Address}','.',1)))), '%{NAS-IP-Address}', '1', '%{Acct-Input-Packets:-0}', '%{Acct-Input-Octets:-0}', '%{Acct-Input-Gigawords:-0}', '%{Acct-Output-Packets:-0}', '%{Acct-Output-Octets:-0}', '%{Acct-Output-Gigawords:-0}', '%{Acct-Session-Time:-0}', '%{Acct-Terminate-Cause:-0}', '%{Tunnel-Server-Endpoint}', '%{Calling-Station-Id}%{Tunnel-Client-Endpoint}' );"
accounting_update_query = "UPDATE dhs_sessions_log SET last_update_date=UNIX_TIMESTAMP('%S'), Acct_Status_Type='3', Acct_Input_Packets ='%{Acct-Input-Packets}', Acct_Input_Octets ='%{Acct-Input-Octets}', Acct_Input_Gigawords ='%{Acct-Input-Gigawords}', Acct_Output_Packets ='%{Acct-Output-Packets}', Acct_Output_Octets ='%{Acct-Output-Octets}', Acct_Output_Gigawords ='%{Acct-Output-Gigawords}', Acct_Terminate_Cause='%{Acct-Terminate-Cause}', Acct_Session_Time ='%{Acct-Session-Time}' WHERE Acct_Session_Id = '%{Acct-Session-Id}'"
accounting_stop_query = "UPDATE dhs_sessions_log SET last_update_date=UNIX_TIMESTAMP('%S'), Acct_Status_Type='2', Acct_Input_Packets ='%{Acct-Input-Packets}', Acct_Input_Octets ='%{Acct-Input-Octets}', Acct_Input_Gigawords ='%{Acct-Input-Gigawords}', Acct_Output_Packets ='%{Acct-Output-Packets}', Acct_Output_Octets ='%{Acct-Output-Octets}', Acct_Output_Gigawords ='%{Acct-Output-Gigawords}', Acct_Terminate_Cause='%{Acct-Terminate-Cause}', Acct_Session_Time ='%{Acct-Session-Time}' WHERE Acct_Session_Id = '%{Acct-Session-Id}'"
simul_count_query = "SELECT COUNT(*) FROM dhs_sessions_log WHERE User_Name='%{SQL-User-Name}' AND (Acct_Status_Type = '3' OR Acct_Status_Type = '1') "
simul_verify_query = "SELECT COUNT(*) FROM dhs_sessions_log WHERE User_Name='%{SQL-User-Name}' AND (Acct_Status_Type = '3' OR Acct_Status_Type = '1') "
}