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

Impelementasi dan Konfigurasi Mikrotik Hotspot, Freeradius, Mysql, dan Ldap.

11 Comments

  1. Salam Gan,

    Mau tanya untuk pembagian bandwidth per user email bagaimana caranya ya?

    Mohon bimbingan nya.

    Salam,

    Reply
  2. aldykustyandiJune 1, 2017 at 2:58 PM

    Kalo di saya , pembagian nya langsung di mikrotik nya mas , pake queue tree terus pake PCQ di marking per network , jadi di kasus ini saya cuma memanfaat kan fitur authentifikasi dan pencatatan history login nya , kalo BW nya langsung per user ldap saya belum faham ,… mohon maaf dan terimaksih sudah berkunjung

    Reply
    • Untuk PCQ di marking per network itu bagaimana ya gan?
      saya ada riset di kantor rencana pembagian bandwidth nya berdasarkan divisi masing-masing personil.

      Di mikrotik masih belum nemu cara membedakan blok IP untuk email tertentu.

      Bisa di share engk gan bagaimana setingan di mikrotik nya.

      Salam,

      Reply
  3. aldykustyandiJune 7, 2017 at 9:55 AM

    Membedakan perdivisi nya lewat ip nya saja mas , misal divisi keuangan 192.168.2.0/28 , IT 192.168.3.0/28 , HRD 192.168.4.0/28 , Hotspot tamu 192.168.5.0/24 nah marking nya per network ip tadi , kalo di saya misal contoh
    === mangle nya ===
    ;;; vlan 40 ix_conn
    chain=prerouting action=mark-connection
    new-connection-mark=vlan 40 ix_conn passthrough=yes
    src-address=192.168.40.0/24 dst-address-list=!nice,server,lokal

    ;;; vlan 40 ix_pack
    chain=prerouting action=mark-packet new-packet-mark=vlan 40 ix_pack
    passthrough=no connection-mark=vlan 40 ix_conn

    ===== Queue type ===
    name=”Download” kind=pcq pcq-rate=0 pcq-limit=50
    pcq-classifier=dst-address,dst-port pcq-total-limit=2000
    pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s
    pcq-src-address-mask=32 pcq-dst-address-mask=32 pcq-src-address6-mask=64
    pcq-dst-address6-mask=64

    === Queuetree nya ====
    name=”vlan 40 ix_down” parent=TB_down_ix packet-mark=vlan 40 ix_pack
    limit-at=681k queue=Download priority=7 max-limit=2M burst-limit=0
    burst-threshold=0 burst-time=0s

    Reply
    • Terimakasih untuk pencerahannya.

      Jadi di kasus agan ini per divisi di bedakan interface/ vlan nya ya?

      misal divisi keuangan 192.168.2.0/28 (Ether-2) , IT 192.168.3.0/28 (Ether-3), HRD 192.168.4.0/28 (Ether-4).

      Saya coba oprek di jaringan saya gan.

      Salam,

      Reply
  4. aldykustyandiJune 7, 2017 at 10:01 AM

    Jadi di kasus postingan ini email nya cuma untuk login ke mikrotik hotspot dengan perantara free radius yang support ldap , dan mikrotik yang menggunakan eksternal radius , untuk BW nya full dari ip address . semoga bermanfaat terimaksih

    Reply
    • Untuk Daloradius sendiri berfungsi sebagai managemen apa gan?

      di tempat saya daloradius hanya bisa menampilkan user hotspot yg aktif saja.

      untuk list user-user yg terdaftar di LDAP tidak bisa kebaca di daloradius nya.

      Salam,

      Reply
      • aldykustyandiJune 12, 2017 at 11:07 AM

        Dalorius nya , untuk pencatatan history login , Lama login(total waktu online) , total tarifk per user , aktif user , ranking user dengan konsumsi bw terbesar dan user tersering online , kurang lebih di saya segitu gan

        Reply
      • aldykustyandiJune 12, 2017 at 11:12 AM

        user ldap nya juga bisa gan , tutorial posting ini juga ngonekin ldap zimbra (mail account zimbra) ke freeradius , yang log auth user ldap nya di masukin ke mysql yang nanti nya bisa di olah sama daloradius nya , sehingga bisa munculin item item report yang saya sebutkan tadi

        Reply
  5. Mas ada no hp yg bisa saya hubungi

    Reply
  6. aldykustyandiApril 11, 2018 at 3:09 PM

    email saja mas ke aldykustyandi@gmail.com , kalo saya bisa bantu insyaallah saya coba bantu

    Reply

Leave a Reply to aldykustyandi Cancel reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.