[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# chkconfig mysqld on
[root@localhost ~]# chkconfig radius on
[root@localhost ~]# chkconfig radiusd on
[root@localhost ~]# cd /etc/raddb/ //这个主要是配置文件所在地
[root@localhost raddb]# ls
acct_users clients.conf.1 policy.conf sql//数据库文件.sql文件所在目录这个需要导入数据库。
attrs dictionary policy.txt sql.conf//sql配置文件
attrs.access_challenge eap.conf preproxy_users sql.conf.1
attrs.access_reject example.pl proxy.conf sqlippool.conf
attrs.accounting_response hints radiusd.conf//主配置文件 templates.conf
attrs.pre-proxy huntgroups radiusd.conf.1 users
certs ldap.attrmap sites-available users.1
clients.conf//客户端配置文件 modules sites-enabled
exec_prefix = /usr
sysconfdir = /etc
localstatedir = /var
sbindir = /usr/sbin
logdir = ${localstatedir}/log/radius
raddbdir = ${sysconfdir}/raddb
radacctdir = ${logdir}/radacct
run_dir = ${localstatedir}/run/${name}
user = radiusd
group = radiusd
type = auth
ipaddr = *
port = 0
}
ipaddr = *
port = 0
type = acct
}
extended_expressions = yes
destination = files
syslog_facility = daemon
auth_goodpass = no
max_attributes = 200
}
$INCLUDE proxy.conf
thread pool {
start_servers = 5
max_spare_servers = 10
}
exec
logintime
$INCLUDE sql.conf //这个是本人加入的
sql {
database = "mysql"
login = "root"//修改数据用户名为root
password = "123456"//密码为123456
acct_table1 = "radacct"
acct_table2 = "radacct"
authreply_table = "radreply"
groupreply_table = "radgroupreply"
deletestalesessions = yes
sqltracefile = ${logdir}/sqltrace.sql
nas_table = "nas"
}
ipaddr = 127.0.0.1
secret =testing123
shortname =test
nastype =other
}
192.168.40.39为NAS要地址
secret = testing123为密钥
shortname = test任意
nastype = other为你NAS设备的类型
9.配置httpd.conf /etc/httpd/conf/httpd.conf
文件添加两处如下:
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .html
# vi /etc/httpd/conf.d/radius.conf
<Directory /usr/share/dialup_admin/htdocs/>
Options None
order deny,allow
deny from all
allow from 127.0.0.1 192.168.40.39
</Directory>
在allow from 处添加你允许访问freeradius-dialupadmin的ip 用空格分开
修改apache的php.conf配置文件
# vi /etc/httpd/conf.d/php.conf
在未尾添加
AddType application/x-httpd-php .php .php3
10.配置主配置文件admin.conf文件
accounting.attrs auth.request naslist.conf user_edit.attrs
admin.conf //主配置 captions.conf naslist.conf.1 username.mappings
admin.conf.1 //为备份1 config.php3 naslist.conf.2
admin.conf.2 default.vals sql.attrmap
admin.conf.3 extra.ldap-attrmap sql.attrs
general_prefered_lang: en
general_prefered_lang_name: English
general_charset: iso-8859-1
general_base_dir: /usr/share/dialup_admin
general_radiusd_base_dir: /usr
general_domain: company.com
general_use_session: no
general_most_recent_fl: 30
general_realm_format: suffix
general_ldap_attrmap: /etc/raddb/ldap.attrmap
general_clients_conf: /etc/raddb/clients.conf
general_sql_attrmap: %{general_base_dir}/conf/sql.attrmap
general_accounting_attrs_file: %{general_base_dir}/conf/accounting.attrs
general_extra_ldap_attrmap: %{general_base_dir}/conf/extra.ldap-attrmap
general_username_mappings_file: %{general_base_dir}/conf/username.mappings
general_lib_type: mysql
general_user_edit_attrs_file: %{general_base_dir}/conf/user_edit.attrs
general_sql_attrs_file: %{general_base_dir}/conf/sql.attrs
general_default_file: %{general_base_dir}/conf/default.vals
general_finger_type: snmp
general_nas_type: cisco
general_snmpfinger_bin: %{general_base_dir}/bin/snmpfinger
general_sessionclear_bin: %{general_base_dir}/bin/clearsession
general_sessionclear_method: snmp
general_radclient_bin: /usr/bin/radclient
general_test_account_login: test
general_test_account_password: test
general_radius_server: localhost
general_radius_server_port: 1812
general_radius_server_auth_proto: chap
general_radius_server_secret: testing123
general_auth_request_file: %{general_base_dir}/conf/auth.request
general_encryption_method: clear
general_accounting_info_order: desc
general_stats_use_totacct: no
general_restrict_badusers_access: no
general_restrict_nasadmin_access: no
INCLUDE: %{general_base_dir}/conf/naslist.conf
INCLUDE: %{general_base_dir}/conf/captions.conf
ldap_base: dc=company,dc=com
ldap_binddn: cn=Directory Manager
ldap_bindpw: XXXXXXX
ldap_default_new_entry_suffix: ou=dialup,ou=guests,%{ldap_base}
ldap_default_dn: uid=default-dialup,%{ldap_base}
ldap_regular_profile_attr: dialupregularprofile
sql_server: localhost
sql_port: 3306
sql_username: root
sql_password: 123456
sql_database: radius
sql_accounting_table: radacct
#sql_badusers_table: badusers
sql_check_table: radcheck
sql_reply_table: radreply
#sql_user_info_table: userinfo
sql_groupcheck_table: radgroupcheck
sql_groupreply_table: radgroupreply
#sql_usergroup_table: radusergroup
sql_total_accounting_table: totacct
sql_nas_table: nas
sql_show_all_groups: true
sql_command: /usr/bin/mysql
general_snmp_type: net
general_snmpwalk_command: /usr/local/bin/snmpwalk
general_snmpget_command: /usr/local/bin/snmpget
#sql_debug: true
#sql_use_user_info_table: true
#sql_use_operators: true
sql_password_attribute: User-Password
sql_date_format: Y-m-d
sql_full_date_format: Y-m-d H:i:s
sql_row_limit: 40
sql_connect_timeout: 3
counter_default_weekly: none
counter_default_monthly: none
nas1_name: nas1.%{general_domain}
nas1_model: Computer
nas1_ip: 192.168.40.39
nas1_port_num: 16
nas1_community: public
//
as1_model: Computer 为nas类型
nas1_ip: 192.168.40.39 为nas ip
nas可添加多个修改nas号则可。
[root@localhost conf]# cat captions.conf//配置文件三
general_caption_finger_free_lines: free lines
12.配置mysql数据库和创建数据库radius
[root@localhost conf]# service mysqld start//启动mysqld服务
使用mysql库
mysql> use mysql
修改root密码
mysql> update user set password=password("123456") where user="root";
mysql> flush privileges;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| radius |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use radius;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
mysql> show tables;
+------------------+
| Tables_in_radius |
+------------------+
| nas |
| radacct |
| radcheck |
| radgroupcheck |
| radgroupreply |
| radippool |
| radpostauth |
| radreply |
| radusergroup |
+------------------+
9 rows in set (0.01 sec)
/etc/raddb/sql/mysql
[root@localhost mysql]# ls//把带.sql的文件全部倒入radius数据中
admin.sql cui.conf dialup.conf ippool.sql schema.sql wimax.sql
counter.conf cui.sql ippool.conf nas.sql wimax.conf
mysql> show databases;//查看数据库
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| radius |
| test |
+--------------------+
4 rows in set (0.00 sec)
Database changed
Empty set (0.00 sec)
mysql>source /etc/raddb/sql/mysql/admin.sql //利用source导入数据库
mysql>source /etc/raddb/sql/mysql/cui.sql
mysql>source /etc/raddb/sql/mysql/ippool.sql
mysql>source /etc/raddb/sql/mysql/as.sql
mysql>source /etc/raddb/sql/mysql/schema.sql
mysql>source /etc/raddb/sql/mysql/wimax.sql
mysql> show tables;
+------------------+
| Tables_in_radius |
+------------------+
| nas |
| radacct |
| radcheck |
| radgroupcheck |
| radgroupreply |
| radippool |
| radpostauth |
| radreply |
| radusergroup |
+------------------+
9 rows in set (0.00 sec)
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| username | varchar(64) | NO | MUL | | |
| groupname | varchar(64) | NO | | | |
| priority | int(11) | NO | | 1 | |
+-----------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
+-------------+--------------+------+-----+---------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------------+----------------+
| id | int(10) | NO | PRI | NULL | auto_increment |
| nasname | varchar(128) | NO | MUL | NULL | |
| shortname | varchar(32) | YES | | NULL | |
| type | varchar(30) | YES | | other | |
| ports | int(5) | YES | | NULL | |
| secret | varchar(60) | NO | | secret | |
| server | varchar(64) | YES | | NULL | |
| community | varchar(50) | YES | | NULL | |
| description | varchar(200) | YES | | RADIUS Client | |
+-------------+--------------+------+-----+---------------+----------------+
9 rows in set (0.00 sec)
接着创建radius用户
[root@localhost conf]#useradd radius
mysql> use mysql
修改radius密码
mysql> update user set password=password("radius") where user="radius";
mysql> flush privileges;
创建radius数据库用户
mysql> grant all privileges on radius.* to radius@localhost identified by "radius";
mysql> flush privileges;
mysql> exit
//
相信结果不会让你满意.因为服务器比较的是加密的值,所以服务器连接一定失败.这里需要说明的是flush privileges;这条命令起到了重新加载授权表.你也可以在shell下直接用mysqladmin -u root
1.insert into user(host,user,password) values('%','user_name',password("your password");
2.set password for user_name = password("your password")
以上两种方法都必须进行重载授权表.
3.当然你也可以在创建一个用户时直接设置密码,grant语句将为你自动加密口令.
如 grant all on *.* to user_name@% identified by "your password";
另外你也可以在shell环境下用mysqladmin程序来设置密码
如 mysqladmin -u root password "your password"
13.启动apache服务
Starting httpd: [ OK ]
[root@localhost mysql]# cat /var/www/html/test.php
<?php
phpinfo();
?>