Vamos instalar o
MySQL:
# cd /usr/ports/databases/mysql50-server/
# make install clean
Hora de rodar o mysql (confirmar o arquivo rc.conf acima):
# /usr/local/etc/rc.d/mysql-server start
# /usr/local/bin/mysql_install_db
Configurar a senha de root:
# /usr/local/bin/mysqladmin -u root password 'new-password'
Teste o mysql:
# mysql -p
Enter password:
Vamos preparar o banco de dados com suas respectivas tabelas:
mysql>
create database radius;
mysql>
use database;
Criando as tabelas
Criando as tabelas de autenticação (cole o conteúdo abaixo no terminal do MySQL):
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 '',
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)
) ;
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))
) ;
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))
) ;
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))
) ;
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))
) ;
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))
) ;
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)
) ;
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)
);
mysql>
exit