在modules里面添加attr_rewrite,内容为
1 2 3 4 5 6 7 8 9 10 | attr_rewrite sanereplymessage { attribute = Reply-Message searchin = reply searchfor = "\n|\r" replacewith = "" ignore_case = no new_attribute = no max_matches = 10 append = no } |
然后修改default,在sql前面增加sanereplymessage
1 2 3 4 5 6 | Post-Auth-Type REJECT { .. sanereplymessage sql .. } |
最后按照FreeRADIUS 2.x 记录认证者信息 修改usr/local/etc/raddb/sql/mysql/dialup.conf
1 2 3 4 5 6 | postauth_query = "INSERT INTO ${postauth_table} \ (username, pass, reply, authdate, calledstationid, nasipaddress, replymessage) \ VALUES ( \ '%{User-Name}', \ '%{%{User-Password}:-%{Chap-Password}}', \ '%{reply:Packet-Type}', '%S', '%{Calling-Station-Id}', '%{NAS-IP-Address}', '%{Module-Failure-Message}-%{reply:Reply-Message}')" |
Freeradius 3.x 下修改raddb/mods-config/sql/main/mysql/queries.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | post-auth { # Write SQL queries to a logfile. This is potentially useful for bulk inserts # when used with the rlm_sql_null driver. # logfile = ${logdir}/post-auth.sql query = "\ INSERT INTO ${..postauth_table} \ (username, pass, reply, authdate, calledstationid, nasipaddress, replymessage, nasidentifier) \ VALUES ( \ '%{SQL-User-Name}', \ '%{%{User-Password}:-%{Chap-Password}}', \ '%{reply:Packet-Type}', \ '%S', '%{Calling-Station-Id}', '%{NAS-IP-Address}', '%{reply:Reply-Message}', '%{NAS-Identifier}')" } |