Difference between revisions of "WiFi: HotSpot - CoovaChilli Instalasi Radius Server"

From OnnoWiki
Jump to navigation Jump to search
(New page: Install Radius server and Database sudo apt-get install freeradius freeradius-mysql Create database to store usernames and passwords mysql -u root -p Enter password:mysqladminsecret mys...)
 
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
Install Radius server and Database
+
Instalasi Radius Server dan Database
  
sudo apt-get install freeradius freeradius-mysql
+
sudo apt-get install freeradius freeradius-mysql
  
Create database to store usernames and passwords
+
Buat [[database]] untuk menyimpan username dan password
  
mysql -u root -p
+
mysql -u root -p
Enter password:mysqladminsecret
+
Enter password:
mysql> CREATE DATABASE radius;
+
CREATE DATABASE radius;
mysql> quit   
+
quit   
  
Propergate database with tables created by the maker's of freeradius
+
Asumsi password root mysql adalah 123456. Lanjutkan dengan perintah
  
zcat /usr/share/doc/freeradius/examples/mysql.sql.gz | mysql -u root -p radius
+
sudo su -
Enter password:mysqladminsecret
+
mysql -u root -p123456 radius < /etc/freeradius/sql/mysql/schema.sql
 +
mysql -u root -p123456 radius < /etc/freeradius/sql/mysql/nas.sql
  
Note: for freeradius 2
+
Asumsi password user radius untuk akses [[database]] radius adalah radius, maka perintahnya adalah
mysql -u root -p radius < /etc/freeradius/sql/mysql/schema.sql
 
mysql -u root -p radius < /etc/freeradius/sql/mysql/nas.sql
 
  
mysql -u root -p
+
mysql -u root -p
Enter password:mysqladminsecret
+
Enter password:
mysql> GRANT ALL PRIVILEGES ON radius.* TO 'radius'@'localhost' IDENTIFIED BY 'mysqlsecret';
+
GRANT ALL PRIVILEGES ON radius.* TO 'radius'@'localhost' IDENTIFIED BY 'radius';
mysql> FLUSH PRIVILEGES;
+
GRANT ALL PRIVILEGES ON radius.* TO 'radius' IDENTIFIED BY 'radius';
mysql> quit
+
FLUSH PRIVILEGES;
 +
quit
  
Tell freeradius where to find the database
+
Set supaya FreeRadius dapat mengakses [[database]]
  
nano -w /etc/freeradius/sql.conf
+
vi /etc/freeradius/sql.conf
  
server = "localhost"
+
server = "localhost"
login  = "radius"
+
login  = "radius"
password = "mysqlsecret"  
+
password = "radius"
 +
radius_db = "radius"
  
 
Set FreeRadius server client password
 
Set FreeRadius server client password
  
nano -w /etc/freeradius/clients.conf
+
vi /etc/freeradius/clients.conf
  
client 127.0.0.1 {
+
client 127.0.0.1 {
    secret = radiussecret
+
    secret = tesing123
}
+
}
  
Testing default file setup
+
==Test Setup==
  
The default FreeRadius setup authorize's usernames and passwords from a "file" found in /etc/freeradius/users. We should test the default FreeRadius setup before we change the authorization link from "file" to "sql" (mysql).
+
Username & password user Radius dapat dilihat di /etc/freeradius/users. Kita perlu mentest apakah setup FreeRadius berjalan dengan baik sebelum kita mengubah link dari "file" ke "sql".
  
Add username an password to our user "file". edit "John Doe"
+
Tambahkan username & password ke "file". masukan "John Doe"
  
nano -w /etc/freeradius/users
+
vi /etc/freeradius/users
  
 
uncomment
 
uncomment
  
"John Doe"     Auth-Type := Local, User-Password == "hello"
+
"John Doe"     Cleartext-Password := "hello"
              Reply-Message = "Hello, %u"
+
                Reply-Message = "Hello, %{User-Name}"
  
At this point you need to reboot your ubuntu box
+
atau
  
reboot
+
"John Doe"    Auth-Type := Local, User-Password == "hello"
 +
                Reply-Message = "Hello, %u"
  
Check FreeRadius config files.
+
Sampai titik ini sebaiknya anda me-reboot [[Server]] [[Ubuntu]]
  
sudo /etc/init.d/freeradius stop
+
sudo reboot
sudo freeradius -XXX
 
  
If all goes well the last line should display
+
Check file konfigurasi melalui
  
Mon Jun 29 15:24:34 2009 : Debug: Ready to process requests.
+
sudo /etc/init.d/freeradius stop
 +
sudo freeradius -XXX
  
Ctrl+C to exit.
+
Jika semua berjalan dengan baik maka akan tampil
  
Start FreeRadius again
+
Wed Apr  7 11:33:51 2010 : Debug: Ready to process requests.
  
sudo /etc/init.d/freeradius start
+
Tekan tombol Ctrl+C untuk exit. Restart FreeRadius
 +
 
 +
sudo /etc/init.d/freeradius start
  
 
Test password authorization to "file"
 
Test password authorization to "file"
  
sudo radtest "John Doe" hello 127.0.0.1 0 radiussecret
+
sudo radtest "John Doe" hello 127.0.0.1 0 testing123
 +
 
 +
Jika semua berjalan dengan baik kita akan memperoleh jawaban
 +
 
 +
Sending Access-Request of id 182 to 127.0.0.1 port 1812
 +
User-Name = "John Doe"
 +
User-Password = "hello"
 +
NAS-IP-Address = 127.0.1.1
 +
NAS-Port = 0
 +
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=182, length=37
 +
Reply-Message = "Hello, John Doe"
  
If all goes well you should get a reply
 
  
Sending Access-Request of id 136 to 127.0.0.1 port 1812
+
==Ubah Authorisasi ke SQL==
        User-Name = "John Doe"
 
        User-Password = "hello"
 
        NAS-IP-Address = 255.255.255.255
 
        NAS-Port = 0
 
rad_recv: Access-Accept packet from host 127.0.0.1:1812, id=136, length=37
 
        Reply-Message = "Hello, John Doe"
 
  
change authorization to sql
+
Jika percobaan di atas berhasil dengan baik kita dapat mulai mengubah konfigurasi authorisasi dari "file" ke "sql". Edit file
  
If the above tests worked we can now change authorization from "file" to "sql" nano -w /etc/freeradius/radiusd.conf Change:
+
vi /etc/freeradius/radiusd.conf
  
files
+
$INCLUDE ${confdir}/sql.conf
 
  
to
+
Edit
 
  
# files
+
vi /etc/freeradius/sites-available/default
  
# sql
+
authorize {
+
        preprocess
 +
        chap
 +
        suffix
 +
        eap
 +
        #files
 +
        sql
 +
}
 +
authenticate {
 +
        Auth-Type PAP {
 +
          pap
 +
        }
 +
        Auth-Type CHAP {
 +
          chap
 +
        }
 +
        eap
 +
}
 +
accounting {
 +
        detail
 +
        radutmp
 +
        sql ### tambahkan manual
 +
}
 +
session {
 +
        sql ### tambahkan manual
 +
}
  
to
+
==Menambahkan User==
 
  
sql
+
Perintah untuk menambahkan user ke [[database]]
  
note for freeradius2:
+
echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('mysqltest', 'Password', 'testsecret');" | mysql -u radius -p radius
nano -w /etc/freeradius/sites-available/default
+
Enter password:mysqlsecret
  
Note: You can only use one authorisation method at a time, not both. Therefore "files" section needs to be commented out otherwise free radius will still try to authorize with /etc/freeradius/users "file" instead of "sql"
+
Atau jika password radius mysql adalah radius dapat menggunakan perintah
SQL Logging
 
  
If you want to use software packages like ezRADIUS or Dialup Admin you need to enable logging to sql
+
echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('mysqltest', 'Password', 'testsecret');" | mysql -u radius -pradius radius
  
nano -w /etc/freeradius/sql.conf
+
Default CoovaChilli menggunakan username 'chillispot' dan password 'chillispot' untuk login ke Radius. Hal ini di definisikan di file konfigurasi /etc/chilli/config
  
sql {
+
HS_ADMUSR=chillispot
        driver = "rlm_sql_mysql"
+
HS_ADMPWD=chillispot
        server = "localhost"
 
        login = "radius"
 
        password = "mysqlsecret"
 
        radius_db = "radius"
 
        [...]
 
        # Set to 'yes' to read radius clients from the database ('nas' table)
 
        readclient = yes ###change manually
 
}
 
  
nano -w /etc/freeradius/radiusd.conf
+
Tambahkan user tersebut di tabel radcheck melalui perintah
 
note for freeradius2:
 
for the line $INCLUDE... -> /etc/freeradius/radiusd.conf
 
nano -w /etc/freeradius/sites-available/default
 
  
        $INCLUDE ${confdir}/sql.conf
+
echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('chillispot', 'Password', 'chillispot');" | mysql -u radius -p radius
authorize {
+
Enter password:mysqlsecret
        preprocess
 
        chap
 
        suffix
 
        eap
 
        #files
 
        sql
 
}
 
authenticate {
 
        Auth-Type PAP {
 
          pap
 
        }
 
        Auth-Type CHAP {
 
          chap
 
        }
 
        eap
 
}
 
accounting {
 
        detail
 
        radutmp
 
        sql ###change manually
 
}
 
session {
 
        sql ###change manually
 
}
 
  
Add users
+
Atau jika password radius mysql adalah radius dapat menggunakan perintah
  
echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('mysqltest', 'Password', 'testsecret');" | mysql -u radius -p radius
+
echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('chillispot', 'Password', 'chillispot');" | mysql -u radius -pradius radius
Enter password:mysqlsecret
 
  
coovachilli uses the username 'chillispot' with the password 'chillispot' for logging into the radius by default. Add this user in the table radcheck too.
+
==Test Sambungan Dengan Authentikasi Database==
  
its defined in the default config file /etc/chilli/config
+
Restart Radius
  
HS_ADMUSR=chillispot
+
sudo /etc/init.d/freeradius restart
HS_ADMPWD=chillispot
 
  
echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('chillispot', 'Password', 'chillispot');" | mysql -u radius -p radius
+
test sambungan ke Radius asumsinya password Radius Server "testing123"
Enter password:mysqlsecret
 
  
Restart Radius
+
sudo radtest mysqltest testsecret 127.0.0.1 0 testing123
 +
sudo radtest chillispot chillispot 127.0.0.1 0 testing123
 +
 
 +
Jika berjalan dengan baik kita akan melihat response Access-Accept sebagai berikut:
 +
 
 +
Sending Access-Request of id 1 to 127.0.0.1 port 1812
 +
User-Name = "mysqltest"
 +
User-Password = "testsecret"
 +
NAS-IP-Address = 127.0.1.1
 +
NAS-Port = 0
 +
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=1, length=20
  
sudo /etc/init.d/freeradius restart
+
==Referensi==
  
Test link
+
* http://www.untruth.org/~josh/security/radius/radius-auth.html - Analisa Authentikasi RADIUS
  
sudo radtest mysqltest testsecret 127.0.0.1 0 radiussecret
+
==Pranala Menarik==
sudo radtest chillispot chillispot 127.0.0.1 0 radiussecret
 
  
If all goes well you should receive an Access-Accept response like this:
+
* [[WiFi: HotSpot - CoovaChilli Pendahuluan]]
 +
* [[WiFi: HotSpot - CoovaChilli Kebutuhan Hardware dan Software]]
 +
* [[WiFi: HotSpot - CoovaChilli Instalasi Radius Server]]
 +
* [[WiFi: HotSpot - Instalasi CoovaChilli]]
 +
* [[WiFi: HotSpot - CoovaChilli Instalasi Firewall]]
 +
* [[WiFi: HotSpot - CoovaChilli Instalasi Apache dan SSL]]
 +
* [[WiFi: HotSpot - CoovaChilli Fitur dan Keterangan Tambahan]]
 +
* [[WiFi: HotSpot]]
  
Sending Access-Request of id 180 to 127.0.0.1 port 1812
+
[[Category: WiFi]]
        User-Name = "mysqltest"
+
[[Category: HotSpot]]
        User-Password = "testsecret"
+
[[Category: CoovaChilli]]
        NAS-IP-Address = 255.255.255.255
 
        NAS-Port = 0
 
rad_recv: Access-Accept packet from host 127.0.0.1:1812, id=180, length=20
 

Latest revision as of 06:50, 29 March 2012

Instalasi Radius Server dan Database

sudo apt-get install freeradius freeradius-mysql

Buat database untuk menyimpan username dan password

mysql -u root -p
Enter password:
CREATE DATABASE radius;
quit  

Asumsi password root mysql adalah 123456. Lanjutkan dengan perintah

sudo su -
mysql -u root -p123456 radius < /etc/freeradius/sql/mysql/schema.sql
mysql -u root -p123456 radius < /etc/freeradius/sql/mysql/nas.sql

Asumsi password user radius untuk akses database radius adalah radius, maka perintahnya adalah

mysql -u root -p
Enter password:
GRANT ALL PRIVILEGES ON radius.* TO 'radius'@'localhost' IDENTIFIED BY 'radius';
GRANT ALL PRIVILEGES ON radius.* TO 'radius' IDENTIFIED BY 'radius';
FLUSH PRIVILEGES;
quit

Set supaya FreeRadius dapat mengakses database

vi /etc/freeradius/sql.conf
server = "localhost"
login  = "radius"
password = "radius"
radius_db = "radius"

Set FreeRadius server client password

vi /etc/freeradius/clients.conf
client 127.0.0.1 {
    secret = tesing123
}

Test Setup

Username & password user Radius dapat dilihat di /etc/freeradius/users. Kita perlu mentest apakah setup FreeRadius berjalan dengan baik sebelum kita mengubah link dari "file" ke "sql".

Tambahkan username & password ke "file". masukan "John Doe"

vi /etc/freeradius/users

uncomment

"John Doe"      Cleartext-Password := "hello"
                Reply-Message = "Hello, %{User-Name}"

atau

"John Doe"     Auth-Type := Local, User-Password == "hello"
               Reply-Message = "Hello, %u"

Sampai titik ini sebaiknya anda me-reboot Server Ubuntu

sudo reboot

Check file konfigurasi melalui

sudo /etc/init.d/freeradius stop
sudo freeradius -XXX

Jika semua berjalan dengan baik maka akan tampil

Wed Apr  7 11:33:51 2010 : Debug: Ready to process requests.

Tekan tombol Ctrl+C untuk exit. Restart FreeRadius

sudo /etc/init.d/freeradius start

Test password authorization to "file"

sudo radtest "John Doe" hello 127.0.0.1 0 testing123

Jika semua berjalan dengan baik kita akan memperoleh jawaban

Sending Access-Request of id 182 to 127.0.0.1 port 1812 
	User-Name = "John Doe" 
	User-Password = "hello"
	NAS-IP-Address = 127.0.1.1
	NAS-Port = 0
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=182, length=37
	Reply-Message = "Hello, John Doe"


Ubah Authorisasi ke SQL

Jika percobaan di atas berhasil dengan baik kita dapat mulai mengubah konfigurasi authorisasi dari "file" ke "sql". Edit file

vi /etc/freeradius/radiusd.conf
$INCLUDE ${confdir}/sql.conf

Edit

vi /etc/freeradius/sites-available/default
authorize {
        preprocess
        chap
        suffix
        eap
        #files
        sql
}
authenticate {
        Auth-Type PAP {
          pap
        }
        Auth-Type CHAP {
          chap
        }
        eap
}
accounting {
        detail
        radutmp
        sql ### tambahkan manual
}
session {
        sql ### tambahkan manual
}

Menambahkan User

Perintah untuk menambahkan user ke database

echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('mysqltest', 'Password', 'testsecret');" | mysql -u radius -p radius
Enter password:mysqlsecret

Atau jika password radius mysql adalah radius dapat menggunakan perintah

echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('mysqltest', 'Password', 'testsecret');" | mysql -u radius -pradius radius

Default CoovaChilli menggunakan username 'chillispot' dan password 'chillispot' untuk login ke Radius. Hal ini di definisikan di file konfigurasi /etc/chilli/config

HS_ADMUSR=chillispot
HS_ADMPWD=chillispot

Tambahkan user tersebut di tabel radcheck melalui perintah

echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('chillispot', 'Password', 'chillispot');" | mysql -u radius -p radius
Enter password:mysqlsecret

Atau jika password radius mysql adalah radius dapat menggunakan perintah

echo "INSERT INTO radcheck (UserName, Attribute, Value) VALUES ('chillispot', 'Password', 'chillispot');" | mysql -u radius -pradius radius

Test Sambungan Dengan Authentikasi Database

Restart Radius

sudo /etc/init.d/freeradius restart

test sambungan ke Radius asumsinya password Radius Server "testing123"

sudo radtest mysqltest testsecret 127.0.0.1 0 testing123
sudo radtest chillispot chillispot 127.0.0.1 0 testing123

Jika berjalan dengan baik kita akan melihat response Access-Accept sebagai berikut:

Sending Access-Request of id 1 to 127.0.0.1 port 1812
	User-Name = "mysqltest"
	User-Password = "testsecret"
	NAS-IP-Address = 127.0.1.1
	NAS-Port = 0
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=1, length=20

Referensi

Pranala Menarik