freeradius 3.0 mysql_secfree
修改 radpostauth 的表結構:
mysql> drop table radpostauth;
mysql> CREATE TABLE radpostauth (
id int(11) NOT NULL auto_increment,
username varchar(64) NOT NULL default '',
nasipaddress varchar(15) NOT NULL default '',
nasname varchar(100) NOT NULL default '',
reply varchar(32) NOT NULL default '',
authdate timestamp NOT NULL,
PRIMARY KEY (id)
) ENGINE = INNODB;
修改 “raddb/mods-config/sql/main/mysql/queries.conf” 中的
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) \
VALUES ( \
'%{SQL-User-Name}', \
'%{%{User-Password}:-%{Chap-Password}}', \
'%{Calling-Station-Id}', \
'%{reply:Packet-Type}', \
'%S')"
}
為
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, nasipaddress, nasname, reply, authdate) \
VALUES ( \
'%{SQL-User-Name}', \
'%{Client-IP-Address}', \
'%{Calling-Station-Id}', \
'%{reply:Packet-Type}', \
'%S')"
}
其中 nasipaddress 是 Client-IP-Address, 是發起認證請求的來源 IP. 此處不能用 NAS-IP-Address, 因為 NAS-IP-Address 很多時候都是 “127.0.0.1” .
nasname 是 Calling-Station-Id, 它的用處可以看配置好后的兩條記錄:
mysql> select * from radpostauth;
+----+-------------+--------------+--------------+---------------+---------------------+
| id | username | nasipaddress | nasname | reply | authdate |
+----+-------------+--------------+--------------+---------------+---------------------+
| 1 | test_user | 192.168.1.3 | 192.168.56.1 | Access-Accept | 2014-04-25 10:31:42 |
| 2 | test_user | 192.168.1.3 | 192.168.56.1 | Access-Reject | 2014-04-25 10:32:07 |
+----+-------------+--------------+--------------+---------------+---------------------+
nasipaddress 為我個人電腦的 IP, nasname 為我個人電腦上用 NAT 方式配置虛機的 IP. 這兩個值結合可以教精確地定位認證請求來源.
總結
以上是生活随笔為你收集整理的freeradius 3.0 mysql_secfree的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python内置json模块的作用_py
- 下一篇: 三星u盘怎么量产工具下载 三星U盘量产工