Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
gzwimax
帖子: 3
注册时间: 2008-06-05 18:22
送出感谢: 0
接收感谢: 0

Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

#1

帖子 gzwimax » 2008-08-06 9:16

1.Download freeradius软件!
http://freeradius.org/download.html

2.安装mysql数据库
建议Ubuntu下用“新立得软件包管理器”安装mysql 5.0,需先安装mysql数据库,因为freeradius会查找相关库文件。

3.安装freeradius
root@ns:/software# cd /software/
root@ns:/software# ls free*
freeradius-server-2.0.5.tar.gz
root@ns:/software# tar -zxvf freeradius-server-2.0.5.tar.gz
root@ns:/software# ls free*
freeradius-server-2.0.5.tar.gz
freeradius-server-2.0.5
root@ns:/software# cd freeradius-server-2.0.5
root@ns:/software/freeradius-server-2.0.5# ./configure
root@ns:/software/freeradius-server-2.0.5#make
root@ns:/software/freeradius-server-2.0.5#make install

4.测试freeradius是否正常安装!
root@ns:/software/freeradius-server-2.0.5# radiusd -X
Listening on authentication address * port 1812
Listening on accounting address * port 1813
Listening on proxy address * port 1814
Ready to process requests.
出现以上信息证明freeradius安装正常!

5.配置数据库
root@ns:/etc#
root@ns:/etc# cd /usr/local/etc/raddb/sql/mysql
root@ns:/usr/local/etc/raddb/sql/mysql#
root@ns:/usr/local/etc/raddb/sql/mysql# ls
admin.sql counter.conf dialup.conf ippool.conf ippool.sql nas.sql schema.sql
root@ns:/usr/local/etc/raddb/sql/mysql#
root@ns:/usr/local/etc/raddb/sql/mysql# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.0.51a-3ubuntu5.2 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database radius;
Query OK, 1 row affected (0.02 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| radius |
+--------------------+
4 rows in set (0.00 sec)

mysql> exit
root@ns:/usr/local/etc/raddb/sql/mysql#
root@ns:/usr/local/etc/raddb/sql/mysql# mysql -uroot -p radius<schema.sql
root@ns:/usr/local/etc/raddb/sql/mysql# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.0.51a-3ubuntu5.2 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use radius;
mysql> insert into radgroupreply (groupname,attribute,op,value) values ('user','Auth-Type',':=','Local');
mysql> insert into radgroupreply (groupname,attribute,op,value) values ('user','Service-Type','=','Framed-User');
mysql> insert into radgroupreply (groupname,attribute,op,value) values ('user','Framed-IP-Netmask','=','255.255.255.255');
mysql> insert into radgroupcheck (groupname, attribute, op, value) values ("user", "Auth-Type", ":=", "Local");
mysql> insert into radcheck (username,attribute,op,value) values ('test-user1','User-Password','==','test-passwd1');
mysql> insert into usergroup(username,groupname) values('test-user1','user');

6.测试freeradius与mysql是否正常运行
(1)打开一个终端,运行radiusd -X
root@ns:/etc# radiusd -X
radiusd: #### Opening IP addresses and Ports ####
listen {
type = "auth"
ipaddr = *
port = 0
}
listen {
type = "acct"
ipaddr = *
port = 0
}
Listening on authentication address * port 1812
Listening on accounting address * port 1813
Listening on proxy address * port 1814
Ready to process requests.
(2)新开一个终端用mysql数据库中的用户去测试
root@ns:/etc# radtest 'test-user1 test-password1 127.0.0.1 0 mysql
Sending Access-Request of id 26 to 127.0.0.1 port 1812
User-Name = "test-user1"
User-Password = "test-password"
NAS-IP-Address = 127.0.0.1
NAS-Port = 0
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=26, length=20
root@ns:/etc#
从以上信息可以看出,freeradius与mysql的联动已经成功!

freeradius与mysql安装并调试好之后,就要和设备联动,例如VPN帐号的论证可以通过freeradius服务器认证,只需要在设备上配置AAA认证使用radius服务器认证,选项有:
freeradius server ip、freeradius server port(authentication默认1276)、secret password。
最后测试!(PS:步骤稍微省略了一点,有问题可以跟帖!)
hshl1214
帖子: 1
注册时间: 2008-12-10 0:00
送出感谢: 0
接收感谢: 0

Re: Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

#2

帖子 hshl1214 » 2008-12-18 0:06

楼主在使用SQL认证时都 改了freeradius的哪些配置文件?能具体说说 么 ?我 用 的 是 2.13,SQL的 配置文件位置变化了 ,我 不 知道对 不对 ,而且配置了 之后 ,启用radius -X提示:
Could not link driver rlm_sql_mysql: rlm_sql_mysql.so: cannot open shared object file: No such file or directory
Make sure it (and all its dependent libraries!) are in the search path of your system's ld.
/usr/local/etc/raddb/sql.conf[22]: Instantiation failed for module "sql"
/usr/local/etc/raddb/sites-enabled/default[152]: Failed to find module "sql".
/usr/local/etc/raddb/sites-enabled/default[62]: Errors parsing authorize section.

我 在 网上查 了 下 ,老 版本的 说 是在freeradius里有个modules目录里有这个文件,但是 我 的 没有 ,是 因为我的 MYSQL不是 源码编译安装的 么 ?
stormdemon
帖子: 8
注册时间: 2008-11-26 23:00
送出感谢: 0
接收感谢: 0

Re: Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

#3

帖子 stormdemon » 2009-09-22 13:50

按照楼主的方法
在编译安装后出现
root@liux-laptop:/home/liux/freeradius# radiusd -X
radiusd: error while loading shared libraries: libfreeradius-radius-2.1.7.so: cannot open shared object file: No such file or directory
ddww
帖子: 3
注册时间: 2009-10-19 11:41
送出感谢: 0
接收感谢: 0

Re: Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

#4

帖子 ddww » 2009-11-10 14:18

Just try to execute "ldconfig" and retry...
ddww
帖子: 3
注册时间: 2009-10-19 11:41
送出感谢: 0
接收感谢: 0

Re: Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

#5

帖子 ddww » 2009-11-11 14:34

三楼的问题四楼可以解决
但是我在通过freeradius + mysql 认证时
出现了如下错误
Could not link driver rlm_sql_mysql: rlm_sql_mysql.so: cannot open shared object file: No such file or directory
Make sure it (and all its dependent libraries!) are in the search path of your system's ld.
/usr/local/etc/raddb/sql.conf[22]: Instantiation failed for module "sql"
/usr/local/etc/raddb/sites-enabled/default[159]: Failed to find module "sql".
/usr/local/etc/raddb/sites-enabled/default[62]: Errors parsing authorize section
按照如下的解决方法试了一下
http://www.linuxsir.org/bbs/showthread.php?t=289484

我的# apt-cache search freeradius mysql 搜索结果为空
压根就没有那个freeradius-mysql - MySQL module for FreeRADIUS server
真是急死人了
ddww
帖子: 3
注册时间: 2009-10-19 11:41
送出感谢: 0
接收感谢: 0

Re: Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

#6

帖子 ddww » 2009-11-11 16:33

这个问题是无法找到mysql 的库文件和头文件,在fedora上面找到并解决了 ,
为什么Ubuntu这么好的东西,只能找到mysql的库文件但找不到msql 的头文件呢?

[root@localhost raddb]# cd /usr/include/mysql/
[root@localhost mysql]# ls
chardefs.h my_attribute.h my_no_pthread.h mysqld_ername.h sql_common.h
decimal.h my_config.h my_pthread.h mysqld_error.h sql_state.h
errmsg.h my_config_i386.h my_sys.h ndb sslopt-case.h
history.h my_dbug.h my_xml.h raid.h sslopt-longopts.h
keycache.h my_dir.h mysql.h readline.h sslopt-vars.h
keymaps.h my_getopt.h mysql_com.h rlmbutil.h tilde.h
m_ctype.h my_global.h mysql_embed.h rlprivate.h typelib.h
m_string.h my_list.h mysql_time.h rlshell.h xmalloc.h
my_alloc.h my_net.h mysql_version.h rltypedefs.h
vs_608_cyz
帖子: 5
注册时间: 2009-12-07 14:55
送出感谢: 0
接收感谢: 0

Re: Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

#7

帖子 vs_608_cyz » 2009-12-10 10:53

楼主求教:
为什么我开启服务的时候提示这个啊!!
radiusd: #### Opening IP addresses and Ports ####
listen {
type = "auth"
ipaddr = *
port = 0
Failed binding to authentication address * port 1812: Address already in use
/usr/local/etc/raddb/radiusd.conf[240]: Error binding to port for 0.0.0.0 port 1812
cpeng
帖子: 7
注册时间: 2009-06-05 1:50
送出感谢: 0
接收感谢: 0

Re: Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

#8

帖子 cpeng » 2010-03-16 19:57

ddww 写了:三楼的问题四楼可以解决
但是我在通过freeradius + mysql 认证时
出现了如下错误
Could not link driver rlm_sql_mysql: rlm_sql_mysql.so: cannot open shared object file: No such file or directory
Make sure it (and all its dependent libraries!) are in the search path of your system's ld.
/usr/local/etc/raddb/sql.conf[22]: Instantiation failed for module "sql"
/usr/local/etc/raddb/sites-enabled/default[159]: Failed to find module "sql".
/usr/local/etc/raddb/sites-enabled/default[62]: Errors parsing authorize section
按照如下的解决方法试了一下
http://www.linuxsir.org/bbs/showthread.php?t=289484

我的# apt-cache search freeradius mysql 搜索结果为空
压根就没有那个freeradius-mysql - MySQL module for FreeRADIUS server
真是急死人了
命令:
sudo apt-get install freeradius-mysql

你是不是把后面的说明也当命令了哦??
www.dearshe.com
bluewithcg
帖子: 6
注册时间: 2010-07-09 14:53
送出感谢: 0
接收感谢: 0

Re: Ubuntu 8.04下安装freeradius,并使用freeradius实现用户论证!

#9

帖子 bluewithcg » 2010-09-20 16:00

各位兄弟能帮我看看么?谢谢了
viewtopic.php?f=54&t=293833
回复

回到 “服务器基础应用”