install yfi hotspot di ClearOS 5.2

requirement :
pc dengan 3 LAN Card
1 untuk external access (internet) (eth0)
1 untuk lan (eth1) 192.168.1.1
1 untuk hotspot (eth2)

installasi ClearOS
– gateway mode
– modules :
– DHCP and LOcal DNS Servers
– VPN – PPTP Server
– Bandwidth Manager
– Protocol Filter
– Web Proxy
– Content Filter
– Mail Server
– Web Server
– Database Server / MySQL

yum update
yum install gcc gcc-c++ kernel-devel
rpm --import ftp://timburgess.net/RPM-GPG-KEY-TimB.txt
wget ftp://timburgess.net/repo/clearos/5.2/os/timb-release-1-0.noarch.rpm
rpm -Kv timb-release-1-0.noarch.rpm
rpm -Uvh timb-release-1-0.noarch.rpm
yum --enablerepo=timb-testing upgrade php
yum --enablerepo=timb-testing install ImageMagick php-mysql
yum --enablerepo=timb-testing install php-devel php-pear php-common
yum --enablerepo=timb install webconfig-php-eaccelerator
echo "extension=json.so" >> /etc/php.d/json.ini
service httpd restart
service webconfig restart
wget https://github.com/cakephp/cakephp/tarball/1.2 -O cake_1.2.11.tar.gz
cp cake_1.2.11.tar.gz /opt/
cd /opt/
tar -zxf cake_1.2.11.tar.gz
mv cakephp-cakephp-784e017 cakephp
cd /var/www/html/
ln -s /opt/cakephp ./c2

cek module berikut ini enabled di Apache file /etc/httpd/conf/httpd.conf :

LoadModule rewrite_module modules/mod_rewrite.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so

jalankan perintah

egrep "mod_rewrite|mod_deflate|mod_headers" /etc/httpd/conf/httpd.conf

edit /etc/php.ini
cek opsi beirkut :
allow_call_time_pass_reference = On
output_buffering = 4096
short_open_tag = On
date.timezone = Asia/Jakarta ;; Change this to your timezone

vi /etc/php.ini

edit /etc/httpd/conf.d/default.conf
tambahkan baris berikut di bagian bawah

## -- YFi begin
<Directory  /var/www/html/c2>
AllowOverride All
</Directory>
#-------COMPRESS CONTENT-----------
# place filter 'DEFLATE' on all outgoing content
SetOutputFilter DEFLATE
# exclude uncompressible content via file type
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|jpg|png|pdf|zip|bz2|sit|rar)$ no-gzip
#dont-vary
# Keep a log of compression ratio on each request
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog /var/log/httpd/deflate.log deflate
# Properly handle old browsers that do not support compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
#----------------------------------

#------ADD EXPIRY DATE-------------
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"
</FilesMatch>
#----------------------------------

#--------Remove ETags --------------------
FileETag none
#-----------------------------------------
## -- YFi end

vi /etc/httpd/conf.d/default.conf
service httpd restart

Download dan install yfi

cd
wget http://sourceforge.net/projects/hotcakes/files/YFi%20CakePHP%20Application/Beta-5/yfi_cake-Beta-5.tar.gz/download -O yfi_cake-Beta-5.tar.gz
wget http://sourceforge.net/projects/hotcakes/files/YFi%20Viewer%20Component/Beta-5/yfi-Beta-5.tar.gz/download -O yfi-Beta-5.tar.gz
tar -zxf yfi_cake-Beta-5.tar.gz
tar -zxf yfi-Beta-5.tar.gz
mv yfi_cake/ /var/www/html/c2/
mv yfi/ /var/www/html/
chown -R apache. /var/www/html/c2/yfi_cake/tmp
chown -R apache. /var/www/html/c2/yfi_cake/webroot/img/graphics
ln -s /var/www/html/c2 /var/www/c2

Configure database
jalan dan set auto mysql server di https://ip-address-clearos:81/admin/mysql.php
jangan lupa set passwordnya juga

mysql -u root -p

create database yfi;
GRANT ALL PRIVILEGES ON yfi.* to ‘yfi’@’127.0.0.1’ IDENTIFIED BY ‘yfi’;
GRANT ALL PRIVILEGES ON yfi.* to ‘yfi’@’localhost’ IDENTIFIED BY ‘yfi’;
exit;

jika merubah password yfi jangan lupa edit /var/www/html/c2/yfi_cake/config/database.php

vi /var/www/html/c2/yfi_cake/config/database.php

mysql -u root -p yfi < /var/www/html/c2/yfi_cake/setup/db/yfi.sql

Test the CakePHP application
http://ip-address-clearos/c2/yfi_cake/users/

Configuring FreeRADIUS

yum install libtool-ltdl-devel mysql-devel perl-XML-Simple perl-XML-LibXML perl-suidperl perl-libxml-perl
yum install gdbm-devel pam-devel net-snmp-devel net-snmp-utils readline-devel libpcap-devel python-devel postgresql-devel unixODBC-devel perl-ExtUtils-Embed
cd
wget ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-2.1.12.tar.gz
tar -zxf freeradius-server-2.1.12.tar.gz
cd freeradius-server-2.1.12
./configure | tee config_out.txt
make
make install
ldconfig
useradd -r radiusd
chown -R radiusd. /usr/local/etc/raddb/
ln -s /usr/local/etc/raddb /etc/raddb
cd
radiusd -X

Setup FreeRADIUS

cd /usr/local/etc/
mv raddb raddb.orig
cp /var/www/html/c2/yfi_cake/setup/radius/raddb.tar.gz .
tar -xzvf raddb.tar.gz
chown -R radiusd. raddb
chown radiusd.apache raddb/proxy.conf
chmod 664 raddb/proxy.conf
chmod 644 raddb/dictionary
ldconfig

CentOS specific tweaks

cp raddb.orig/radiusd.conf raddb/

edit raddb/radiusd.conf uncoment baris $INCLUDE sql.conf

vi raddb/radiusd.conf
cd
vi yfi_ubuntu_to_centos.sh

#!/bin/bash

#-------------------------------------------
#---- Script to change Ubuntu specifics ----
#---- to CentOS specifics ------------------
#-------------------------------------------

function usr_local_etc_to_etc(){
echo "Change /usr/local/etc to /etc for" $1
sed 's|/usr/local/etc|/etc|g' $1 > $1.tmp;mv $1.tmp $1;
}

function usr_local_share_to_usr_share(){
echo "Change /usr/local/share to /usr/share for" $1
sed 's|/usr/local/share|/usr/share|g' $1 > $1.tmp;mv $1.tmp $1;

}

function var_www_c2_to_var_www_html_c2(){
echo "Change /var/www/c2 to /var/www/html for" $1
sed 's|/var/www/c2|/var/www/html/c2|g' $1 > $1.tmp;mv $1.tmp $1;
}

function radclient_fix(){
echo "Change /usr/local/bin/radclient to /usr/bin/radclient for" $1
sed 's|/usr/local/bin/radclient|/usr/bin/radclient|g' $1 > $1.tmp;mv $1.tmp $1;
}

file_list[0]="/var/www/html/c2/yfi_cake/config/yfi.php"
file_list[1]="/etc/raddb/rlm_perl_modules/conf/settings.conf"
file_list[2]="/etc/raddb/rlm_perl_modules/Attributes.pm"
file_list[3]="/etc/raddb/rlm_perl_modules/rlm_perl.pm"
file_list[4]="/etc/raddb/rlm_perl_modules/sqlcounter.conf"
file_list[5]="/etc/raddb/rlm_perl_modules/SQLCounter.pm"
file_list[6]="/etc/raddb/rlm_perl_modules/Telkom.pm"
file_list[7]="/etc/raddb/rlm_perl_modules/User.pm"
file_list[8]="/etc/raddb/rlm_perl_modules/Voucher.pm"
file_list[9]="/etc/raddb/rlm_perl_modules/Devices.pm"
file_list[10]="/etc/raddb/rlm_perl_modules/Nas.pm"
file_list[11]="/etc/raddb/dictionary"
file_list[12]="/var/www/html/c2/yfi_cake/webroot/files/radscenario.pl"

for i in  ${file_list[@]}
do
usr_local_etc_to_etc $i
usr_local_share_to_usr_share $i
var_www_c2_to_var_www_html_c2 $i
radclient_fix $i
done

chmod +x yfi_ubuntu_to_centos.sh
./yfi_ubuntu_to_centos.sh

vi /usr/local/share/freeradius/dictionary.chillispot
ATTRIBUTE ChilliSpot-Version 8 string
ATTRIBUTE ChilliSpot-OriginalURL 9 string

#YFi Specific Attributes
ATTRIBUTE Yfi-Voucher 40 string
ATTRIBUTE Yfi-MAC-Reset 41 string
ATTRIBUTE Yfi-Data 42 string
ATTRIBUTE Yfi-Time 43 string

#YFi Various Counters
ATTRIBUTE Max-Daily-Session 50 integer
ATTRIBUTE Max-Monthly-Session 51 integer
ATTRIBUTE Max-Weekly-Session 52 integer
ATTRIBUTE Max-All-Session 53 integer

ATTRIBUTE ChilliSpot-Max-Daily-Octets 60 integer
ATTRIBUTE ChilliSpot-Max-Monthly-Octets 61 integer
ATTRIBUTE ChilliSpot-Max-Weekly-Octets 62 integer
ATTRIBUTE ChilliSpot-Max-All-Octets 63 integer

# Configuration management parameters (ChilliSpot Only)
ATTRIBUTE ChilliSpot-UAM-Allowed 100 string

cek passsword yfi

vi /etc/raddb/sql.conf
vi /etc/raddb/rlm_perl_modules/conf/settings.conf

Edit /etc/raddb/dictionary dan replace

$INCLUDE /usr/share/freeradius/dictionary

dengan

$INCLUDE /usr/local/share/freeradius/dictionary

vi /etc/raddb/dictionary

Edit /usr/local/etc/raddb/proxy.conf:
cari baris berikut:

home_server virtual.example.com {
virtual_server = virtual.example.com
}

dan beri tanda # 3 baris tersebut.
#home_server virtual.example.com {
# virtual_server = virtual.example.com
#}

vi /usr/local/etc/raddb/proxy.conf

radiusd -X

start at system startup:

echo "/usr/local/sbin/radiusd" >> /etc/rc.local

2 baris penting yang harus diganti di /var/www/html/c2/yfi_cake/config/yfi.php. ganti dari:

$config[‘freeradius’][‘path_to_dictionary_files’] = ‘/usr/share /freeradius/’;
$config[‘freeradius’][‘radclient’] = ‘/usr/bin/radclient’;

menjadi

$config[‘freeradius’][‘path_to_dictionary_files’] = ‘/usr/local/share/freeradius/’;
$config[‘freeradius’][‘radclient’] = ‘/usr/local/bin/radclient’;

vi /var/www/html/c2/yfi_cake/config/yfi.php

Cron Scripts – RHEL/CentOS

cp /var/www/html/c2/yfi_cake/setup/cron/yfi /etc/cron.d/
cd /etc/cron.d
sed 's|www-data|apache|g' yfi > yfi.tmp;mv yfi.tmp yfi;
sed 's|/var/www/c2|/var/www/html/c2|g' yfi > yfi.tmp;mv yfi.tmp yfi;

install coova chilli

wget www.clearcenter.com/media/dev/coova-chilli-1.2.5-1.i386.rpm
wget www.clearcenter.com/media/dev/haserl
cp haserl /usr/sbin/
chmod +x /usr/sbin/haserl
rpm -Uvh coova-chilli-1.2.5-1.i386.rpm

cp /etc/chilli/defaults /etc/chilli/defaults.orig
echo "" > /etc/chilli/defaults
vi /etc/chilli/defaults
HS_LANIF=eth2 # Subscriber Interface for client devices
HS_NETWORK=192.168.182.0 # HotSpot Network (must include HS_UAMLISTEN)
HS_NETMASK=255.255.255.0 # HotSpot Network Netmask
HS_UAMLISTEN=192.168.182.1 # HotSpot IP Address (on subscriber network)
HS_UAMPORT=3990 # HotSpot Port (on subscriber network)
HS_DNS1=192.168.1.1
HS_DNS2=192.168.1.1
HS_NASID=localhost
HS_UAMSECRET=greatsecret
HS_RADIUS=127.0.0.1
HS_RADIUS2=127.0.0.1
HS_RADSECRET=testing123
HS_NASIP=127.0.0.1 # NB!!! To explicitly set NAS-IP-Address
HS_UAMFORMAT=http://192.168.182.1/yfi/uam_json.html
HS_UAMHOMEPAGE=http://192.168.182.1/coova_json/splash.php
HS_MODE=hotspot
HS_TYPE=chillispot
HS_WWWDIR=/etc/chilli/www
HS_WWWBIN=/etc/chilli/wwwsh
HS_PROVIDER=kstv
HS_PROVIDER_LINK=http://kstv.co.id/
HS_LOC_NAME="kstv hotspot" # WISPr Location Name and used in portal

ln -s /opt/cakephp/yfi_cake/setup/coova_json /var/www/html/coova_json

edit /etc/init.d/chilli
tambahkan opsi –coaport 3799 seperti berikut/

vi /etc/init.d/chilli

ifconfig $HS_LANIF 0.0.0.0
if [ “$(which start-stop-daemon)” = “” ]; then
/usr/sbin/chilli -c $CONFIG –pidfile=$pidfile –coaport 3799 &
else
start-stop-daemon -S –pidfile=$pidfile –coaport 3799 –user=chilli \
–exec /usr/sbin/chilli — -c $CONFIG &
fi

vi /var/www/html/yfi/js/dojo/chilli/Setting.js

cs.uam_jsonp = ‘http://192.168.182.1/coova_json/uam.php&#8217;; //URL of the uam YFi Web service – Change to suit your install
cs.usage_jsonp = ‘http://192.168.182.1/c2/yfi_cake/third_parties/json_usage_check&#8217;; //URL of the usage YFi Web service – Change to suit your install
cs.url_default = ‘http://google.com&#8217;; //URL that user will be redirected to by default – use instead of originalURL

Bugs and Fixes yfi beta 5

vi /var/www/html/yfi/js/dojo/translations/UserViewDevices.js

Missing comma
Change the following:

‘pt_BR’ : ‘Salvar’
‘da_DK’ : ‘Gem’

To

‘pt_BR’ : ‘Salvar’,
‘da_DK’ : ‘Gem’

vi /var/www/html/yfi/js/dojo/translations
/PermanentGeneralActivity.js

Missing quote
Change the following:

‘pt_BR’ : ‘Recarregar Dados,
‘da_DK’ : ‘Genindlæs data’

To

‘pt_BR’ : ‘Recarregar Dados’,
‘da_DK’ : ‘Genindlæs data’

vi /var/www/html/yfi/js/dojo/chilli/Chilli.js

cari kata change_me. dan ganti dengan 192.168.182.1

restart clearos

reboot

test yfi hotspot.

Iklan
By iwansetiawan Posted in Linux

7 comments on “install yfi hotspot di ClearOS 5.2

  1. iku enek sing kliru mas..
    ndek baris :
    vi /var/www/yfi/js/dojo/chilli/Setting.js
    kudune :
    vi /var/www/html/yfi/js/dojo/chilli/Setting.js
    gonaku saiki wes kenek… 😀

  2. Nanya gan, itu providernya kstv bisa diganti gak ?
    Instalasi cos tempat sy pake ip 172.16.10.xx
    Bisa dirubah configurasinya dng ip itu ?
    Suwun sak durung e..

  3. makasih tutorialnya..
    tapi punya ane,user hotspot kok g bisa redirect ke login page?
    mohon penjecarahan 🙂

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s