Konfigurasi Freeradius dan Mysql Pada Ubuntu 18.04
======================================================================
Install Freeradius Server
======================================================================
sudo apt-get update && sudo apt-get upgrade
* install freeradius 3
sudo apt-get install freeradius -y
* check freeradius files
sudo ls -la /etc/freeradius/3.0/
* check versi freeradius
freeradius -v
Konfigurasi file freeradius clients.conf
sudo nano /etc/freeradius/3.0/clients.conf
konfigurasi NAS nya.
tambahkan:
client test-client{
ipaddr = 192.168.1.64/24
secret = testrad123!
nas_type = other
}
simpan!
* restart freeradius
sudo /etc/init.d/freeradius restart
* konfiguasi file users freeradius
sudo nano /etc/freeradius/3.0/users
tambahkan:
test-user-local Cleartext-Password := "hello"
Reply-Message := "Hello, %{User-Name}"
simpan!
============================================================
* Test Freeradius local di terminal 1
sudo /etc/init.d/freeradius stop
* debug freeradius
sudo freeradius -X
* Test Freeradius local di terminal 2
radtest test-user-local hello 127.0.0.1 0 testing123
* Test Freeradius local di terminal 2 lagi
radtest test-user-local hello 127.0.0.1 0 testing123
Pengujian dengan User local berhasil, dan tahap selanjutnya mengunakan user dari database mysql.
======================================================================
Install Freeradius-mysql
======================================================================
sudo apt-get install freeradius-mysql
sudo apt-get install mysql-server
mysql -u root -p
create database radius_users;
sudo mysql -uroot -p radius_users < /etc/freeradius/3.0/mods-config/sql/main/mysql/schema.sql
nano /etc/freeradius/3.0/mods-config/sql/main/mysql/setup.sql
ubah radius menjadi radius_users
sudo mysql -uroot -p radius_users < /etc/freeradius/3.0/mods-config/sql/main/mysql/setup.sql
nano /etc/freeradius/3.0/mods-available/sql
edit
dialect = "mysql"
driver = "rlm_sql_mysql"
server = "localhost"
port = 3306
login = "radius"
password = "radpass"
radius_db = "radius_users"
logfile = ${logdir}/sqllog.sql
* konfigurasi freeradius to use mysql: enable sql module
ln -s /etc/freeradius/3.0/mods-available/sql /etc/freeradius/3.0/mods-enabled/sql
* enable SQL: authorize section
nano /etc/freeradius/3.0/sites-available/default
edit di
authorize{
-sql menjadi sql
}
accounting{
-sql menjadi sql
}
simpan!
* konfigurasi inner tunnel vitual server
nano /etc/freeradius/3.0/sites-available/inner-tunnel
edit di
authorize{
-sql menjadi sql
}
* create a SHA256 hash on linux ubuntu
echo -n test | sha256sum
lalu copy test yg telah di encrypt ke database
hasil encrypt: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
* create a test user in mysql database
mysql -u root -p
use radius_users
INSERT INTO radcheck (username,attribute,op,value) VALUES ("bob","SHA2-Password",":=","test yang sudah di encrypt");
select * from radcheck;
pengujian user di database radius
- Start freeradius in debug di terminal 1
sudo /etc/init.d/freeradius stop
* debug freeradius
sudo freeradius -X
- Check terminal 2
radtest bob test 127.0.0.1 1812 testing123
Dandi Wahyudi, AMd. T
Sumber Youtube : https://www.youtube.com/watch?v=WG8cfrxebQ8