5 de nov de 2008

Freeradius + DIalupAdmin

instalar debian minimo
apt-get install freeradius freeradius-dialupadmin php4-mysql mysql-server libdate-manip-perl -y

cd /var/www/
ln -s /usr/share/freeradius-dialupadmin/htdocs dialupadmin

debian:/var/www# mysql -h 127.1 -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.0.32-Debian_7etch6-log Debian etch distribution


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

mysql>


##mysql> CREATE USER radius ;

##mysql> GRANT ALL PRIVILEGES ON *.* TO radius WITH GRANT OPTION;

##debian:/var/www# mysql -h 127.1 -u radius -p
##Enter password:



mysql> CREATE DATABASE radius;
Query OK, 1 row affected (0.00 sec)

mysql> quit


nano
mysql-radius-dialupadmin.sql

###########################################################################
# db_mysql.sql rlm_sql - FreeRADIUS SQL Module #
# #
# Database schema for MySQL rlm_sql module #
# #
# To load: #
# mysql -uroot -prootpass radius <> #
###########################################################################
#
# Table structure for table 'radacct'
#

CREATE TABLE radacct (
RadAcctId bigint(21) NOT NULL auto_increment,
AcctSessionId varchar(32) NOT NULL default '',
AcctUniqueId varchar(32) NOT NULL default '',
UserName varchar(64) NOT NULL default '',
userinfo varchar(64) NOT NULL default '',
Realm varchar(64) default '',
NASIPAddress varchar(15) NOT NULL default '',
NASPortId varchar(15) default NULL,
NASPortType varchar(32) default NULL,
AcctStartTime datetime NOT NULL default '0000-00-00 00:00:00',
AcctStopTime datetime NOT NULL default '0000-00-00 00:00:00',
AcctSessionTime int(12) default NULL,
AcctAuthentic varchar(32) default NULL,
ConnectInfo_start varchar(50) default NULL,
ConnectInfo_stop varchar(50) default NULL,
AcctInputOctets bigint(12) default NULL,
AcctOutputOctets bigint(12) default NULL,
CalledStationId varchar(50) NOT NULL default '',
CallingStationId varchar(50) NOT NULL default '',
AcctTerminateCause varchar(32) NOT NULL default '',
ServiceType varchar(32) default NULL,
FramedProtocol varchar(32) default NULL,
FramedIPAddress varchar(15) NOT NULL default '',
AcctStartDelay int(12) default NULL,
AcctStopDelay int(12) default NULL,
PRIMARY KEY (RadAcctId),
KEY UserName (UserName),
KEY FramedIPAddress (FramedIPAddress),
KEY AcctSessionId (AcctSessionId),
KEY AcctUniqueId (AcctUniqueId),
KEY AcctStartTime (AcctStartTime),
KEY AcctStopTime (AcctStopTime),
KEY NASIPAddress (NASIPAddress)
) ;

#
# Table structure for table 'radcheck'
#

CREATE TABLE radcheck (
id int(11) unsigned NOT NULL auto_increment,
UserName varchar(64) NOT NULL default '',
Attribute varchar(32) NOT NULL default '',
op char(2) NOT NULL DEFAULT '==',
Value varchar(253) NOT NULL default '',
PRIMARY KEY (id),
KEY UserName (UserName(32))
) ;

#
# Table structure for table 'radgroupcheck'
#

CREATE TABLE radgroupcheck (
id int(11) unsigned NOT NULL auto_increment,
GroupName varchar(64) NOT NULL default '',
Attribute varchar(32) NOT NULL default '',
op char(2) NOT NULL DEFAULT '==',
Value varchar(253) NOT NULL default '',
PRIMARY KEY (id),
KEY GroupName (GroupName(32))
) ;

#
# Table structure for table 'radgroupreply'
#

CREATE TABLE radgroupreply (
id int(11) unsigned NOT NULL auto_increment,
GroupName varchar(64) NOT NULL default '',
Attribute varchar(32) NOT NULL default '',
op char(2) NOT NULL DEFAULT '=',
Value varchar(253) NOT NULL default '',
PRIMARY KEY (id),
KEY GroupName (GroupName(32))
) ;

#
# Table structure for table 'radreply'
#

CREATE TABLE radreply (
id int(11) unsigned NOT NULL auto_increment,
UserName varchar(64) NOT NULL default '',
Attribute varchar(32) NOT NULL default '',
op char(2) NOT NULL DEFAULT '=',
Value varchar(253) NOT NULL default '',
PRIMARY KEY (id),
KEY UserName (UserName(32))
) ;


#
# Table structure for table 'usergroup'
#

CREATE TABLE usergroup (
UserName varchar(64) NOT NULL default '',
GroupName varchar(64) NOT NULL default '',
priority int(11) NOT NULL default '1',
KEY UserName (UserName(32))
) ;

#
# Table structure for table 'radpostauth'
#

CREATE TABLE radpostauth (
id int(11) NOT NULL auto_increment,
user varchar(64) NOT NULL default '',
pass varchar(64) NOT NULL default '',
reply varchar(32) NOT NULL default '',
date timestamp(14) NOT NULL,
PRIMARY KEY (id)
) ;

######################################################################
#
# The next table is commented out because it is not
# currently used in the server.
#

#
# Table structure for table 'dictionary'
#
#CREATE TABLE dictionary (
# id int(10) DEFAULT '0' NOT NULL auto_increment,
# Type varchar(30),
# Attribute varchar(64),
# Value varchar(64),
# Format varchar(20),
# Vendor varchar(32),
# PRIMARY KEY (id)
#);

#
# Table structure for table 'nas'
#
CREATE TABLE nas (
id int(10) NOT NULL auto_increment,
nasname varchar(128) NOT NULL,
shortname varchar(32),
type varchar(30) DEFAULT 'other',
ports int(5),
secret varchar(60) DEFAULT 'secret' NOT NULL,
community varchar(50),
description varchar(200) DEFAULT 'RADIUS Client',
PRIMARY KEY (id),
KEY nasname (nasname)
);


---= Salvar o arquivo e entao executar:::
mysql -u root radius <>
depois editar o arquivo :::

nano /etc/freeradius-dialupadmin/admin.conf
alterando as linhas:
sql_type: mysql
sql_server: localhost
sql_port: 3306

sql_username: root
sql_password:
sql_database: radius

e um pouco mais a baixo:

sql_debug: false


<<<<<< enter="">


nano -w /usr/share/freeradius/dictionary
adicionar: $INCLUDE dictionary.valemount
salvar e sair do arquivo

nano -w
/usr/share/freeradius/dictionary.valemount
>>>>>>>>>> com o seguinte:

#
# Valemount Networks Corporation specific radius attributes
# networks@valemount.com
#
# $Id: dictionary.valemount,v 1.1.2.1 2004/06/03 15:27:40 aland Exp $
#

VENDOR ValemountNetworks 16313

BEGIN-VENDOR ValemountNetworks

# Rates to give PPPoE customers, can be used in Authentication replies,
# in bits/s
ATTRIBUTE VNC-PPPoE-CBQ-RX 1 integer
ATTRIBUTE VNC-PPPoE-CBQ-TX 2 integer

# Fallback support for each direction. (1 / 0)
ATTRIBUTE VNC-PPPoE-CBQ-RX-Fallback 3 integer
ATTRIBUTE VNC-PPPoE-CBQ-TX-Fallback 4 integer

ATTRIBUTE VNC-Splash 10 integer

VALUE VNC-Splash Show 1
VALUE VNC-Splash No-Show 0

END-VENDOR ValemountNetworks

>>>>>>>>> fim do arquivo


reboot... para nao ficar reiniciando todos os servicos... que saco ...


entrar no dialupadmin em:


http://ipdoservidor/dialupadmin

entre em adicionar grupo e siga a imagem ao lado.