Ubuntu + Freeradius + Mysql
Ubuntu + Freeradius + Mysql
Install semua package melalui repository dan isi konfigurasi yang diminta root@jo:/home/jo# apt-get install apache2 php5-common php5-gd php-pear php-db libapache2mod-php5 php5-mysql php5-mcrypt phpmyadmin mysql-server-5.0 mysql-client-5.0 freeradius freeradius-mysql Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: apache2-mpm-prefork apache2-utils apache2.2-common dbconfig-common defoma fontconfig-config freeradius-common freeradius-utils libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libfontconfig1 libfreeradius2 libfreetype6 libgd2-xpm libhtml-template-perl libjpeg62 libltdl7 libmcrypt4 libmysqlclient15off libnet-daemon-perl libperl5.10 libplrpc-perl libpng12-0 libpq5 libssl0.9.8 libt1-5 libxpm4 mysql-client mysql-common mysql-server-core-5.0 perl perl-base perl-modules php5-cli ssl-cert ttf-dejavu ttf-dejavu-core ttf-dejavu-extra Suggested packages: apache2-doc apache2-suexec apache2-suexec-custom defoma-doc psfontmgr x-ttcidfont-conf dfontmgr libft-perl freeradius-ldap freeradius-krb5 freeradius-postgresql dbishell libgd-tools libipc-sharedcache-perl libmcrypt-dev mcrypt mysql-doc-5.0 tinyca mailx perl-doc libterm-readline-gnu-perl libterm-readline-perl-perl php5-dev php4-dev mysql-server The following NEW packages will be installed: apache2 apache2-mpm-prefork apache2-utils apache2.2-common dbconfig-common defoma fontconfig-config freeradius freeradius-common freeradius-mysql freeradius-utils libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libfontconfig1 libfreeradius2 libfreetype6 libgd2-xpm libhtml-template-perl libjpeg62 libltdl7 libmcrypt4 libmysqlclient15off libnet-daemon-perl libperl5.10 libplrpc-perl libpng12-0 libpq5 libt1-5 libxpm4 mysql-client mysql-client-5.0 mysql-common mysql-server-5.0 mysql-server-core-5.0 php-db php-pear php5-cli php5-common php5-gd php5-mcrypt php5-mysql phpmyadmin ssl-cert ttf-dejavu ttf-dejavu-core ttf-dejavu-extra The following packages will be upgraded: libssl0.9.8 perl perl-base perl-modules 4 upgraded, 49 newly installed, 0 to remove and 72 not upgraded. Need to get 69.4MB of archives. After this operation, 169MB of additional disk space will be used. Do you want to continue [Y/n]? Y
Untuk konfigurasi apache2, php5 dan mysql-server-5 dan phpmyadmin dapat dicari diinternet. Selanjutnya adalah konfigurasi untuk freeradius
http://anto-chuakev.web.id/archives/category/linux/ubuntu-freeradius-mysql
http://msofian.blogspot.com/2008/10/hotspot-login-open-sources.html http://ipitulas.blogspot.com/
Buat database radius pada mysql-server dan usernya root@jo:/home/jo# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 60 Server version: 5.0.75-0ubuntu10.5 (Ubuntu) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database radius; Query OK, 1 row affected (0.01 sec) mysql> grant all on radius.* to radius@localhost identified by "JO"; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye
Sehubungan menggunakan freeradius 2.x, maka konfigurasi agak berbeda dengan freeradius 1.x. Lalu import table yang berada pada file /etc/freeradius/sql/mysql/schema.sql ke database radius root@jo:/home/jo# mysql -u root -p radius < /etc/freeradius/sql/mysql/schema.sql Enter password:
Buat table agar konfigurasi nas dapat ditambahkan pada database. Pengertian NAS dapat dilihat pada website http://wiki.freeradius.org/NAS root@jo:/home/jo# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 62 Server version: 5.0.75-0ubuntu10.5 (Ubuntu) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 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 Database changed mysql> 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)); Query OK, 0 rows affected (0.07 sec) mysql> exit Bye
Konfigurasikan /etc/freeradius/sql.conf agar dapat disesuaikan dengan perubahan yang sudah dilakukan root@jo:/home/jo# nano /etc/freeradius/sql.conf
Pada connection info # Connection info: server = localhost login = radius password = JO Uncomment pada readclients agar NAS dapat dibaca melalui database. readclients = yes
Uncomment sql pada bagian authorize{} # See Authorization Queries in sql.conf sql Uncomment sql pada bagian accounting{} # See Accounting queries in sql.conf sql Uncomment sql pada bagian session{} # See Simultaneous Use Checking Queries in sql.conf sql Uncomment sql pada bagian post-auth{} # See Authentication Logging Queries in sql.conf sql
Tambahkan user untuk mengetest bahwa server radius sudah berjalan dengan baik root@jo:/home/jo# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 64 Server version: 5.0.75-0ubuntu10.5 (Ubuntu) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 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 Database changed mysql> INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('sqltest', 'Password', 'testpwd'); Query OK, 1 row affected (0.00 sec) mysql> exit Bye
Pastikan bahwa konfigurasi radiusd.conf dalam keadaan benar, karena pada saat dicoba, terjadi masalah pada pid radiusnya root@jo:/home/jo# nano /etc/freeradius/radiusd.conf
Ubah run_dir ke path berikut run_dir = ${localstatedir}/run/freeradius Ubah pidfile ke nama file berikut pidfile = ${run_dir}/freeradius.pid
Jalankan server radius. Apabila ingin menggunakan mode debug, maka dapat menggunakan perintah freeradius -X root@jo:/home/jo# /etc/init.d/freeradius start * Starting FreeRADIUS daemon freeradius
[ OK ]