CentOS 5.5 Freeradius 2.x MySQL 5.x

不解释,直接看配置

 

  1. [root@localhost ~]# date 
  2. Fri Jul  1 17:02:24 EDT 2011 
  3. [root@localhost ~]# 
  4. [root@localhost ~]# cat freeradius.log 
  5. yum update -y 
  6. yum search freeradius 
  7. yum -y install freeradius2 freeradius2-utils 
  8. yum search mysql- 
  9. yum -y install mysql  mysql-devel mysql-server 
  10. /etc/init.d/mysqld start 
  11. mysqladmin -u root password missuniverse110 
  12. chkconfig --level 235 radiusd on 
  13. ####test it works or not #### 
  14. vim /etc/raddb/users 
  15. test Cleartext-Password := "test" 
  16. ####"test" =username and The second test is password #### 
  17. radiusd -X #enable debug mode 
  18. radtest test test localhost 1812 testing123 #1812 can be set to '0' 
  19. ####radtest [-d raddb_directory] [-t pap/chap/mschap] [-x ] user password radius-server nas-port-number secret [ppphint] [nasname] #### 
  20. vim /etc/raddb/clients.conf ####Add NAS client 
  21. client 192.168.1.0/24 { 
  22.         secret  = missuniverse110 
  23.         shorname        = missuniverse110 
  24. } 
  25. ####Add NAS to  client list 
  26. vim /etc/raddb/users 
  27. #test Cleartext-Password := "test" 
  28. ####commment out this line 
  29. yum -y install freeradius2-mysql 
  30. ####Add mysql support 
  31. cat /etc/raddb/sql/mysql/admin.sql 
  32. ###WARNING: You should change 'localhost' and 'radpass', Also update raddb/sql.conf  with the new RADIUS password 
  33. vim /etc/raddb/sql/mysql/admin.sql 
  34. CREATE USER 'radius'@'192.168.1.10'; 
  35. SET PASSWORD FOR 'radius'@'192.168.1.10' = PASSWORD('missuniverse110'); 
  36. GRANT SELECT ON radius.* TO 'radius'@'192.168.1.10'; 
  37. GRANT ALL on radius.radacct TO 'radius'@'192.168.1.10'; 
  38. GRANT ALL on radius.radpostauth TO 'radius'@'192.168.1.10'; 
  39. vim /etc/raddb/sql.conf 
  40. change the password 'radpass' to 'missunivese110' 
  41. mysql -u root -p 
  42. mysql>create database radius; 
  43. mysql>exit 
  44. mysql -u root -p radius < /etc/raddb/sql/mysql/admin.sql 
  45. mysql -u root -p radius < /etc/raddb/sql/mysql/schema.sql 
  46. mysql -u root -p radius < /etc/raddb/sql/mysql/nas.sql 
  47. mysql -u root -p radius < /etc/raddb/sql/mysql/ippool.sql 
  48.  
  49.  
  50.  
  51. ###import the tables nas.sql and schema.sql inside the  /etc/raddb/sql/mysql/ Dir 
  52.  
  53. ###radiusd.conf 
  54. vim /etc/raddb/radiusd.conf 
  55. uncomment $INCLUDE sql.conf 
  56. ###sql.conf 
  57. vim /etc/raddb/sql.conf 
  58. # Connection info: 
  59.         server = "192.168.1.10" 
  60.         #port = 3306 
  61.         login = "radius" 
  62.         password = "missuniverse110" 
  63.  
  64.         # Database table configuration for everything except Oracle 
  65.         radius_db = "radius" 
  66. ###dialup.conf 
  67.  vim /etc/raddb/sql/mysql/dialup.conf 
  68.  # Uncomment simul_count_query to enable simultaneous use checking 
  69.         simul_count_query = "SELECT COUNT(*) \ 
  70.                              FROM ${acct_table1} \ 
  71.                              WHERE username = '%{SQL-User-Name}' \ 
  72.                              AND acctstoptime IS NULL" 
  73. # vim /etc/raddb/sites-available/default 
  74. In section authorize, 
  75. Comment out line 152 
  76. #files 
  77. Uncomment line 159 
  78. sql 
  79. In section preacct, 
  80. Comment out line 331 
  81. #files 
  82. In section accounting, 
  83. Uncomment line 365 
  84. sql 
  85. In section session, 
  86. Uncomment line 396 
  87. sql 
  88. ####### 
  89. Then comment the next lines: files inside authorize section, detail, unix and radutmp inside accounting section and radutmp inside session section. 
  90. ################### 
  91. # vim /etc/raddb/sites-enabled/inner-tunnel 
  92. In section authorize, 
  93. Comment out line 111 
  94. #files 
  95. Uncomment line 118 
  96. sql 
  97. ####################### 
  98. Add a test user 
  99. # mysql -u root -p 
  100. mysql> use radius; 
  101. mysql> INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('hacker','Password',hackerlslz); 
  102. radiusd -X 
  103. radtest hacker hackerlslz 192.168.1.10 1812 testing123 
  104. ####192.168.1.10服务器IP 
  105.  
  106. 参考资料: 
  107.  
  108. http://freeradius.org/doc/ 
  109.  
  110. http://freeradius.org/radiusd/man/ 
  111.  
  112. http://wiki.freeradius.org/New-Wiki 
  113.  
  114. http://wiki.freeradius.org/ 
  115.  
  116. http://www.untruth.org/~josh/security/radius/radius-auth.html 
  117.  
  118. http://hi.baidu.com/dd_taiyangxue/blog/item/a1a3807b003c2bfb2f73b338.html 
  119.  
  120. http://blog.sina.com.cn/s/blog_6151984a0100eyiv.html 
  121.  
  122. http://blog.sina.com.cn/s/blog_6151984a0100eyix.html 
  123.  
  124. Freeradius Web GUI: 
  125.  
  126. http://sourceforge.net/projects/dialup-admin/ 
  127.  
  128. http://sourceforge.net/projects/daloradius/