Showing posts with label daloradius. Show all posts
Showing posts with label daloradius. Show all posts

Friday, March 24, 2017

INTEGRASI FREERADIUS + LDAP-ZIMBRA + MIKROTIK DENGAN DALORADIUS SEBAGAI USER MANAJEMEN NYA

Bismillah ,.. insyaallah hari ini saya akan mencoba menulis tentang freeradius yang saya coba integrasikan dengan mikrotik (untuk login di hotspot mikrotik) , backend ldap zimbra dan untuk pencatatan report nye menggunakan daloradius , untuk zimbra nya saya anggap sudah berjalan dengan normal dan kita tinggal mengecek parameter ldap nya , ok bismillah , pertama kita update dan upgrade server ubuntu nya dahulu (saya menggunakan ubuntu server 14.04 lts , tidak saya tulis di judul karena terlalu panjang :) )

Update server ubuntu
root@ubuntu:~# apt-get update

root@ubuntu:~# apt-get upgrade

Install LAMP server (untuk daloradius nya)
root@ubuntu:~# apt-get install apache2 php5 mysql-server

Install Freeradius dengan Modul yang di butuhkan

karena kita akan menggunakan ldap zimbra sebagai backend user nya dan daloradius sebagai reporting nya maka kita install freeradius-mysql dan freeradius-ldap
root@ubuntu:~# apt-get install freeradius freeradius-mysql freeradius-utils freeradius-common freeradius-ldap
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libfreeradius2 libltdl7 libperl5.18
Suggested packages:
freeradius-postgresql freeradius-krb5
The following NEW packages will be installed:
freeradius freeradius-common freeradius-ldap freeradius-mysql
freeradius-utils libfreeradius2 libltdl7 libperl5.18
0 upgraded, 8 newly installed, 0 to remove and 3 not upgraded.
Need to get 895 kB of archives.
After this operation, 4094 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

Install Modul / library PHP yang di butuhkan daloradius

pengalaman saya sebelum install di ubuntu 14.04 di ubuntu 12 kita akan memukan kendala ketika install dalo radius versi terbaru dengan php 5.3 , beberapa library sangat sulit diinstall seperti php-pear dan php-db
root@ubuntu:~# apt-get install php5-gd php-db php-pear
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
libjpeg-turbo8 libjpeg8 libtiff5 libvpx1 libxpm4
Suggested packages:
libgd-tools php5-dev
The following NEW packages will be installed:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0
libjpeg-turbo8 libjpeg8 libtiff5 libvpx1 libxpm4 php-db php-pear php5-gd
0 upgraded, 13 newly installed, 0 to remove and 3 not upgraded.
Need to get 2622 kB of archives.
After this operation, 10.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Download dan ekstrak  daloradius 

disini saya menggunakan daloradius versi daloradius-0.9-9.tar.gz  , bisa di download di sini  kemudian ekstrak , untuk memudahkan silahkan di rename folder nya
root@ubuntu:/var/www/html# tar zxvf daloradius-0.9-9.tar.gz
root@ubuntu:/var/www/html# mv daloradius-0.9-9 daloradius

Buat database dan import skema database dari daloradius
root@ubuntu:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.5.54-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create databases radius;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'databases radius' at line 1
mysql> CREATE DATABASE radius;
Query OK, 1 row affected (0.00 sec)

mysql> quit
Bye
root@ubuntu:~#

import skema database daloradius
root@ubuntu:/var/www/html/daloradius/contrib/db# mysql -u root -p radius < fr2-mysql-daloradius-and-freeradius.sql 
Enter password:
root@ubuntu:/var/www/html/daloradius/contrib/db#

Konfigurasi

# edit file radiusd.conf
root@ubuntu:/var/www/html/daloradius# pico /etc/freeradius/radiusd.conf

fauth = no <---- ( Ubah menjadi “yes” )
authbadpass = no <----( Ubah menjadi “yes” )
authgoodpass = no<----( Ubah menjadi “yes” )

proxy_request = yes <----( Ubah menjadi “no” )

#$INCLUDE sql.conf <---- ( Hilangkan # )

# edit file sql.conf
root@ubuntu:/var/www/html/daloradius# pico /etc/freeradius/sql.conf

# Connection info:
server = “localhost”
#port = 3306
login = “root”
password = “” <----(password root mysql anda)
# Database table configuration for everything except Oracle
radius_db = “radius”
#readclient = yes –> ( Hilangkan tanda pagar # )

#buat baru file clients.conf , yang lama di backup dulu
root@ubuntu:/etc/freeradius# mv clients.conf clients.conf.old

root@ubuntu:/var/www/html/daloradius# pico /etc/freeradius/clients.conf

client 192.168.10.0/29 {   <-- ganti ip dengan network ip server radius
secret = test123ok    <--  ini yang nanti di set di mikrotik nya
shortname = private-network-akses
}

#edit file site-enabled.conf
root@ubuntu:/etc/freeradius# pico sites-enabled/default

uncomment   di beberapa baris  ,

  1. authorize    --> uncomment bagian ldap#
    # The ldap module will set Auth-Type to LDAP if it has not
    # already been set
    ldap

  2. accounting   --> uncomment bagian sql#
    # Log traffic to an SQL database.
    #
    # See "Accounting queries" in sql.conf
    sql

  3. session --> uncoment bagian sqlsession {
    radutmp#
    # See "Simultaneous Use Checking Queries" in sql.conf
    sql
    }

  4. post-auth --> uncomment bagian sql dan ldap#
    # After authenticating the user, do another SQL query.
    #
    # See "Authentication Logging Queries" in sql.conf
    sql#
    # Instead of sending the query to the SQL server,
    # write it into a log file.
    #
    # sql_log#
    # Un-comment the following if you have set
    # 'edir_account_policy_check = yes' in the ldap module sub-section of
    # the 'modules' section.
    #
    ldap


kemudian simpan ,

edit file  /etc/freeradius/modules/ldap  untuk menyessuaikan paramater ldap , contoh untuk kasus saya adalah ldap-zimbra
root@ubuntu:~# pico /etc/freeradius/modules/ldap

ldap {
#
# Note that this needs to match the name in the LDAP
# server certificate, if you're using ldaps.
server = "192.168.112.211"
identity = "uid=zimbra,cn=admins,cn=zimbra"
password = passwordldapzimbra
#basedn = "ou=people,dc=domainkamu,dc=com"
basedn = "ou=people,dc=domainkamu,dc=com"
filter = "(uid=%{%{Stripped-User-Name}:-%{User-Name}})"
#base_filter = "(objectclass=radiusprofile)"
#identity = "cn=admin,o=My Org,c=UA"
#password = mypass
#basedn = "o=My Org,c=UA"
#filter = "(uid=%{%{Stripped-User-Name}:-%{User-Name}})"
#base_filter = "(objectclass=radiusprofile)"

 

untuk cek parameter ldap di zimbra bisa dengn perintah

" zmlocalconfig -s zimbra_ldap_password   " dengan user zimbra.

restart service freeradius
root@ubuntu:~# service freeradius restart

# Konfigurasi mikrotik

ke radius kemudian tambah radius isikan

address = ip server radius nya

secret = yang sudah di definisikan di clients.conf (di kasus saya testing123ok)



kemudian ke hotspot server profile bagian radius  centang  use radius dan accounting



Testing user Mysql

akses ke http://ipservernya/daloradius

user: administrator

password : radius

ke config --> Maintenance --> Test user connectivity  , sebelum nya add user terlebih dahulu





Testing User LDAP



contoh user ldap yang aktif



 

selamat mencoba semoga bermanfaat ,... :)

referensi :

http://blog.unpatti.ac.id/ridom/computer-networking/mikrotik-hotspot-dengan-freeradius-dan-daloradiu

http://runnov.blogs.uny.ac.id/2016/08/06/impelementasi-dan-konfigurasi-mikrotik-hotspot-freeradius-mysql-dan-ldap/

Daloradius error " DB Error : Extension Not found "

Beberapa hari yang lalu saya mencoba meninstall daloradius , installasi lancar hanya ketika terkahir di coba setelah login dapat pesan "Database connection error   Error message DB Error : Extension Not found "  seerti gambar berikut

  , solusi nya  ternyata cukup install php-myadmin saja ternya , menurut team support dari  daloradius nya  https://sourceforge.net/p/daloradius/discussion/684102/thread/7ea43f3c/  , jadi langsung saja  apt-get install
root@ubuntu:~# apt-get install phpmyadmin

dan hasil nya , OK   :)



 

semoga bermanfaat  :)