I divide it
into 4 parts, to make it more easily understood.
- Install Apache, PHP and Mysql.
- Install Web Easyhotspot.
- Install Freeradius 2.1.12.
- Install Chillispot.
I assume the
PC is installed with centos 6.4. In my experiments, centos installed in a
minimalist package. Configure the network interface. (Watch carefully, I use 2
lan card, which happened to be detected as eth1 and eth2. Eth1 to use static
ip, and the ip dhcp eth2. So please do adjustments IP address, in accordance
with the conditions in your network, I know you can do it).
DEVICE=eth1TYPE=EthernetONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=staticIPADDR=192.168.10.1NETMASK=255.255.255.0
vi /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2TYPE=EthernetONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=dhcp
service
network restart
And should be connected to the internet. Continue with the order to install wget and install updates and other applications.
yum
install wget
wget
http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm
-ivh epel-release-6-8.noarch.rpm
yum
repolist.
yum
update
yum
install mc vim unzip gcc gcc-c++ make git svn nano
yum
install mysql-server php httpd php-mysql php-xml php-gd php-pear php-db
yum
install patch mod_ssl openssl dnsmasq
Check in / etc / php.ini, make sure several lines of configuration is suitable.
short_open_tag
= On
date.timezone
= Asia/Makassar
Service
httpd and mysqld must be running automatically, so
chkconfig
--level 235 httpd on
chkconfig
--level 235 mysqld on
chkconfig --level 235 dnsmasq on
chkconfig --level 235 dnsmasq on
2.
Install Web Easyhotspot
Download
easyhotspot web from https://github.com/rafeequl.
cd
/opt
git
clone https://github.com/rafeequl/EasyHotspot
ln
-s /opt/EasyHotspot/htdocs /var/www/html/easyhotspot
Create
database easyhotspot_opensource.
mysql
mysql>
create database easyhotspot_opensource;
mysql>
CREATE USER 'easyhotspot'@'localhost';
mysql>
SET PASSWORD FOR 'easyhotspot'@'localhost' = PASSWORD('easyhotspot');
mysql>
GRANT ALL ON easyhotspot_opensource.* to 'easyhotspot'@'localhost';
mysql>
quit
mysql
-u root easyhotspot_opensource <
/opt/EasyHotspot/install/database_with_sample.sql
Now open
browser and link to http://<ip address>/easyhotspot
There is no password for Mysql root, so if you want
to change the mysql root password, do this
Place the login file for client to /var/www/cgi-bin/
mysqladmin -u root password <new password>
Then edit
/var/www/html/easyhotspot/system/application/config/database.php
cp /opt/EasyHotspot/hotspot/hotspotlogin.cgi
/var/www/cgi-bin/
edit
hotspotlogin.cgi file and make sure uamsecret is correct.
uamsecret
= easyhotspot
3. Install Freeradius 2.1.12
yum
install freeradius freeradius-mysql freeradius-utils
chkconfig
--level 235 radiusd on
Edit /etc/raddb/clients.conf
and in the “client localhost“ section make sure you have,
ipaddr
= 127.0.0.1
secret
= easyhotspot
nastype
= other
Edit /etc/raddb/radiusd.conf
and in the “module” section, uncomment
$INCLUDE
sql.conf
$INCLUDE
sql/mysql/counter.conf
Then, in the
“instantiate“ section, add
chillispot_max_bytes
noresetcounter
Then in
/etc/raddb/sites-enabled/default in the “authorize” section, uncomment
“sql” and add the new counters so that
it is now,
sql
chillispot_max_bytes
noresetcounter
and then
later in /etc/raddb/sites-enabled/default in the “accounting” section uncomment
the sql
sql
and then
later in /etc/raddb/sites-enabled/default in the “session” section uncomment
the sql
sql
and then
finally in /etc/raddb/sites-enabled/default in the post-auth section uncomment
the sql,
sql
Edit the
/etc/raddb /sql/mysql/counter.conf file and in that at the end (unless the
counter is already defined in that), add the following,
sqlcounter
noresetcounter {
counter-name
= Session-Timeout
check-name
= Session-Timeout
reply-name
= Session-Timeout
sqlmod-inst
= sql
key
= User-Name
reset
= never
query
= "SELECT SUM(Acctsessiontime) FROM radacct WHERE UserName='%{%k}'"
}
sqlcounter
chillispot_max_bytes {
counter-name
= Max-All-MB
check-name
= Max-All-MB
reply-name
= ChilliSpot-Max-Total-Octets
sqlmod-inst
= sql
key
= User-Name
reset
= never
query
= "SELECT SUM(AcctInputOctets + AcctOutputOctets) / 1048576 FROM radacct WHERE
UserName='%{%k}'"
}
Edit
/etc/raddb/sql.conf file, at the sql section, make sure you have configuration,
database = "mysql"
driver =
"rlm_sql_${database}"
server = "localhost"
#port = 3306
login = "easyhotspot"
password = "easyhotspot"
radius_db =
"easyhotspot_opensource"
Run freeradius.
If there is no error, that’s mean freeradius is running normally.
Radiusd
-X
4.
Install
Chillispot
Download and
install chillispot.
cd
/usr/local
wget
http://www.chillispot.info/download/chillispot-1.1.0.tar.gz
tar
zxvf chillispot-1.1.0.tar.gz
wget
http://www.0xf8.org/wp-content/uploads/2011/09/chillispot-1.1.0-tun.c_defined.diff
wget
http://www.0xf8.org/wp-content/uploads/2011/09/chillispot-1.1.0-md5.c.diff
cd
chillispot-1.1.0
./configure
patch
-p1 < /usr/local/chillispot-1.1.0-tun.c_defined.diff
patch
-p1 < /usr/local/chillispot-1.1.0-md5.c.diff
make
make
install
Download and
install haserl
cd
/usr/local
wget
http://sourceforge.net/projects/haserl/files/haserl-devel/0.9.27/haserl-0.9.27.tar.gz/download
tar
zxvf haserl-0.9.27.tar.gz
cd
haserl-0.9.27
./configure;
make; make install
ln
-s /usr/local/bin/haserl /usr/sbin/
copy some important
chillispot file.
cp
/usr/local/chillispot-1.1.0/doc/firewall.iptables /etc/init.d/
cp
/usr/local/chillispot-1.1.0/doc/chilli.init /etc/init.d/chillispot
chmod
755 /etc/init.d/chillispot
cp
/usr/local/chillispot-1.1.0/doc/chilli.conf /etc/
ln
-s /usr/local/sbin/chilli /usr/sbin/
chkconfig
--add chillispot
chkconfig
--level 235 chillispot on
edit /etc/chilli.conf, uncomment and edit some line
important configuration.
vim
/etc/chilli.conf
net 192.168.182.0/24
dns1 192.168.182.1
dns2 8.8.8.8
radiusserver1 127.0.0.1
radiusserver2 127.0.0.1
radiussecret easyhotspot
radiusauthport 1812
radiusacctport 1813
dhcpif eth1
uamserver https://192.168.182.1/cgi-bin/hotspotlogin.cgi
uamhomepage http://192.168.182.1:3990/prelogin
uamsecret easyhotspot
uamlisten 192.168.182.1
uamport 3990
coaport 3799
dns1 192.168.182.1
dns2 8.8.8.8
radiusserver1 127.0.0.1
radiusserver2 127.0.0.1
radiussecret easyhotspot
radiusauthport 1812
radiusacctport 1813
dhcpif eth1
uamserver https://192.168.182.1/cgi-bin/hotspotlogin.cgi
uamhomepage http://192.168.182.1:3990/prelogin
uamsecret easyhotspot
uamlisten 192.168.182.1
uamport 3990
coaport 3799
Edit /etc/init.d/chillispot. Make sure a line below is
uncomment.
echo 1 > /proc/sys/net/ipv4/ip_forward
service chillispot restart
Now run the
chillispotservice chillispot restart
service
chillispot restart
Edit
firewall.iptables file. In my case external interface (connected internet) is
eth2. And then I add some line command iptables. You can modify this file
according your desire.
vim
/etc/init.d/firewall.iptables
#!/bin/sh
#
Firewall script for ChilliSpot
IPTABLES="/sbin/iptables"
EXTIF="eth2"
INTIF="eth1"
#Flush
all rules
$IPTABLES
-F
$IPTABLES
-F -t nat
$IPTABLES
-F -t mangle
#Set
default behaviour
$IPTABLES
-P INPUT DROP
$IPTABLES
-P FORWARD ACCEPT
$IPTABLES
-P OUTPUT ACCEPT
#Allow
related and established on all interfaces (input)
$IPTABLES
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
#Allow
releated, established and ssh on $EXTIF. Reject everything else.
$IPTABLES
-A INPUT -i $EXTIF -p tcp -m tcp --dport 22 --syn -j ACCEPT
$IPTABLES
-A INPUT -i $EXTIF -p tcp -m tcp --dport 80 --syn -j ACCEPT
$IPTABLES
-A INPUT -i $EXTIF -j REJECT
#Allow
related and established from $INTIF. Drop everything else.
$IPTABLES
-A INPUT -i $INTIF -p tcp -m tcp --dport 53 --syn -j ACCEPT
$IPTABLES
-A INPUT -i $INTIF -j DROP
#Allow
http and https on other interfaces (input).
#This
is only needed if authentication server is on same server as chilli
$IPTABLES
-A INPUT -p tcp -m tcp --dport 80 --syn -j ACCEPT
$IPTABLES
-A INPUT -p tcp -m tcp --dport 443 --syn -j ACCEPT
#Allow
3990 on other interfaces (input).
$IPTABLES
-A INPUT -p tcp -m tcp --dport 3990 --syn -j ACCEPT
#Allow
ICMP echo on other interfaces (input).
$IPTABLES
-A INPUT -p icmp --icmp-type echo-request -j ACCEPT
#Allow
everything on loopback interface.
$IPTABLES
-A INPUT -i lo -j ACCEPT
#
Drop everything to and from $INTIF (forward)
#
This means that access points can only be managed from ChilliSpot
$IPTABLES
-A FORWARD -i $INTIF -j DROP
$IPTABLES
-A FORWARD -o $INTIF -j DROP
#Enable
NAT on output device
$IPTABLES
-t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
Save. Now
add in /etc/rc.local, then when reboot,
will be running automatically.
vim /etc/rc.local
/etc/init.d/firewall.iptables
/etc/init.d/firewall.iptables
Reference : http://rafeequl.files.wordpress.com/2009/08/easyhotspot-install-guide-for-0-2.pdf.
Licence : EasyHotspot released under GPL, so that you can use it freedom.
Licence : EasyHotspot released under GPL, so that you can use it freedom.
When client is connect to redirection login page.
ReplyDeleteI found following error on my client
The requested URL /welcome.html was not found on this server.
Apache/2.2.15 (CentOS) Server at 192.168.182.1 Port 80
So how to fix this problem
Authentication failed problem how to fix pls
ReplyDeleteIt may be silly but I don't even get the EasyHotspot Web running.
ReplyDeleteAllthough all commands run without error there is no login screen
Pinging the IP is possible
make sure your service httpd running... and your firewall allow port 80... use firewall above ( /etc/init.d/firewall.iptables) or firewall default/etc/sysconfig/iptables
DeleteSorry too short for me
ReplyDeletehttpd is running
what do you mean by
firewall default/etc/sysconfig/iptables
/etc/init.d/firewall.iptables
is not there
1. make file /etc/init.d/firewall.iptables... (look at above)
DeleteOR...
2. if you wanna using default firewall. edit /etc/sysconfig/iptables. Add command to allow port 80. , like this
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
Hey this looks better I can Login
ReplyDeleteBut....
A PHP Error was encountered
Severity: Warning
Message: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead
Filename: models/usermodel.php
Line Number: 243
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /opt/EasyHotspot/htdocs/system/libraries/Exceptions.php:166)
Filename: helpers/url_helper.php
Line Number: 541
edit /etc/php.ini,
Deleteshort_open_tag = On
date.timezone = Asia/Makassar --->> change to your zone.
Both are correct in php.ini
ReplyDelete[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = Europe/Amsterdam
phpinfo gives the same error
Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /var/www/html/test.php on line 2
Forget this date problem
ReplyDeleteThere wan an extra space in the start of php.ini
That is why php did not load the php.ini file
Next thing is I installed FreeRadius and CoovaChilli
The client gets an IP 192.168.182.2And DNS and Gaterway are correct
So CoovaChilli seems to work
But the is no login page
When I open the admin page and look at the Chilli configuration it is empty
in this post using chillispot,
Deleteif you are using coovachillii, read at http://myconfigure.blogspot.com/2013/04/easyhotspot-in-centos-64-coovachilli-130.html
please read the post carefully, dont miss every steps... I tried several times, before I post it, and everything is fine.
I did follow the first 2 steps and then I went to the other post to proceed with installing FreeRadius and CoovaChilli
ReplyDeleteI will continue to check following the directions in the other post (I already did twice)
Thanks for your patience...
Hello mate,
ReplyDeleteGood guide to begin with! I have a problem for even loading the web gui for EasyHot Spot!
I get this message :
EasyHotSpot config->item('EASYHOTSPOT_VERSION');?>
load->view($this->config->item('FAL_template_dir').'template/menu');?>
EasyHotspot - Hotspot Management System
GNU Public License
do you know what this is about ?
I'm woring on config as I type.
DeleteI have the same issue ... :(
To fix the issue problem:
edit /etc/php.ini, find the the line set short_open_tag = Off and change it to short_open_tag = On
Then restart httpd.
That fixed it for me.
Thanks for answering the above question... :)
DeleteI have the same problem, setting short_open_tag to = on doesn't fix it.
DeleteNotice that there is 2 options with that name...so, you have to configure the one that says "short_open_tag = on" and not the other that says:
Delete;short_open_tag
;Default Value: On
This last one, will not be configured!
Try re-download easyhotspot web and install it.
ReplyDeletelook at https://github.com/rafeequl.
Hi i have this problem when trying to start the radius server.
ReplyDeleteradiusd: #### Opening IP addresses and Ports ####
listen {
type = "auth"
ipaddr = *
port = 0
Failed binding to authentication address * port 1812: Address already in use
/etc/raddb/radiusd.conf[240]: Error binding to port for 0.0.0.0 port 1812
"..... port 1812: Address already in use....."
Deletethat's mean radiusd have been running, previously...
check with command
netstat -tulan
or
ps ax | grep radiusd
you will find pid (process id) number on left side.
kill -9 (pid) ---> if you want to terminate process id
good luck... :)
Hi i configured the hotspot server as above....but when i open the client browser and open something like google.com it does not auto-redirect to the page: http://10.1.1.2:3990/prelogin
ReplyDeletei can only manual type that on the url-bar when there is no proxy. that way it opens i login
Problem 1: not auto redirection
when using auto-proxy/no-proxy, after successfully loging-in its fails to open the google page coz i use a proxy on the network
Problem 2: After login success no internet access
now, when i use the proxy i can login...fine. but the i can use the internet without login-in to the server. my iptables are jus as you wrote them above
Problem 3: using internet without login in
Make sure...
Delete1. hotspot server is connected to internet... you can check it from terminal, ping to some website.
2. user / computer client connected to hotspot server, and get the IP address and dns server.
3. from user /computer client, open terminal, and ping to any website... for example ping to google, and make sure, google.com translate to IP address (it's mean check dns).
4. firewall in hotspot server is running, and not blocking user to internet...
Thanks my brother
DeleteSorry i ddnt specify some stuff....i am using a cache hierarchy for my squid so that i dont disturb the main server that distributes internet and provides other services.
my network is structured like this:
(INTERNET)----->[ Proxy Server]---------------->[SWITCH]---------{10.0.1.0/8 clients}
10.0.1.110 |
|
| 10.0.1.111(eth0)
|
[ Hotspot Server ]
|
| 10.1.1.2(eth1)
|
|
| 10.1.1.1(router ip)
|
[LAN WIFI ROUTER]
~
~
~
{WIFI chillispot clients} with default ip(192.168.182.0/24)
PROXY SERVER: has company software that should not be disturded and squid for the internet (NOT TRANSPARENT)
Hotspot Server: has chillispot, radius, haserl, easyhotspot, httpd, openssl, and squid for the cache hierarchy(NOT TRANSPARENT) and iptables configured exactly as in your post
Chilli.conf":
============
dn1 10.1.1.2
radiusserver1 127.0.0.1
radiusserver2 127.0.0.1
radiusauthport 1812
radiusacctport 1813
radiussecret *******************
dhcpif eth1
uamserver https://10.1.1.2/cgi-bin/hotspotlogin.cgi
uamhomepage http://10.1.1.2:3990/prelogin
uamsecret ******************
uamlisten 10.1.1.2
uamallowed 10.1.1.2/easyhotspot
uamport 3990
coaport 3790
squid.conf
========
cache_peer 10.0.1.110 parent 3128 0 no-query default
never_direct allow all
# plus default configurations + no
Squid is working fine i.e the redirection to the parent squid.......OK
Squid tproxy.....NOT OK
Chillispot Login.....OK
Chillispot can't block access client who haven't logged-in
I still can use the internet without even login in to chillispot and that's via the proxy.
[Hotspot network]
eth0: IPADDR=10.0.1.111
NETMASK=255.0.0.0
GATEWAY=10.0.1.110
eth1: IPADDR=10.1.1.2
NETMASK=255.0.0.0
GATEWAY=10.0.1.110
tun0: inet addr: 192.168.182.1, p-t-p:192.168.182.1, Mask:255.255.255.0
The client ip allocation is OK...starting from 192.168.182.2 and so on...e.g
[client 1]
IP 192.168.182.2
Broadcast 192.168.182.255
Submask 255.255.255.0
Default router 192.168.182.1
Primary DNS 10.1.1.2
I need your help on this problem pliz.
... .
(INTERNET)----->[ Proxy Server]---------------->[SWITCH]---------{10.0.1.0/8 clients}
Delete..............................(eth0)......................10.0.1.110(eth1).......|
......................................................................................................|
......................................................................................................| 10.0.1.111(eth0)
......................................................................................................|
................................................................................... [ Hotspot Server ]
......................................................................................................|
......................................................................................................| 10.1.1.2(eth1)
......................................................................................................|
......................................................................................................|
......................................................................................................| 10.1.1.1(router ip)
......................................................................................................|
...................................................................................[LAN WIFI ROUTER]
......................................................................................................~
......................................................................................................~
......................................................................................................~
.....................................................{WIFI chillispot clients} with default ip(192.168.182.0/24)
are you sure hotspot server is dns server too, ??
Deletetry from client / users hotspot, configure manual ip dns to 8.8.8.8 (dns google)
Gud day
Deleteyep dnsmasq z running...
i add DNS2 8.8.8.8 on chilli.conf so that it distributes the dns via the dhcp
so my client settings are:
[client 1]
IP 192.168.182.2
Broadcast 192.168.182.255
Submask 255.255.255.0
Default router 192.168.182.1
Primary DNS 10.1.1.2
Secondary DNS 8.8.8.8
am still trying to find where i messed up coz the problem is still arnd.
thanx bro
switch--- hotspot server --- router (?)--- users
Deletedo you add router between hotspot server and users... ??
you shouldn't do that...
try this... change the network...
switch -- hotspot server -- hub/swith -- users
or
switch -- hotspot server -- users
the network setup you suggested is great. right now i think whats left is making the proxy (child cache) transparent while maintaining its connection to the parents cache.
Deletethe child proxy server is hosted in the hotspot server so if i configure a transparent proxy it seems chillispot doesnt work well since maybe i would have changed the iptable configurations.
is there any work around?
thanks
the important is your squid / proxy. Url hotspot should not be through squid. then,
Deletein configuration squid,
hierarchy_stoplist cgi-bin ? [your ip hotspot]
acl QUERY urlpath_regex cgi-bin \? [your ip hotspot]
for example
hierarchy_stoplist cgi-bin ? 192.168.182.1
acl QUERY urlpath_regex cgi-bin \? 192.168.182.1
In the parent proxy, the above configuration should be added too
next,
1. try from browser client, use manual proxy (not transparent)...
2. if step 1 success to browsing. try transparent proxy,
look at here...http://myconfigure.blogspot.com/2012/04/optimizing-and-security-hotspot-yfi_28.html
good luck...
Mr Roel Ngerii, thank you for your help. I managed to solved the problem by making changes to the network. let me explain a bit in case someone else fall into the same predicament:
ReplyDelete{INTERNET}----[Hotspot Server]----(Wifi router)~~~{Wifi Hotspot clients}
..............................................................................|
..............................................................................|
..............................................................................|
.............................................................[PROXY SERVER]
..............................................................................|
..............................................................................|
..............................................................................|
...................................................................(SWITCH)
..............................................................................|
..............................................................................|
..............................................................................|
....................................................................{10.0.1.0/8 CLIENTS}
The proxy server still works as in the previous network except that it now gets internet from
hotspot server, and ONLY after logining in. So i created a postpaid account (valid for a long time) that will be used by the server to access the internet which it then shares with the 10.0.1.0/8 clients.
I hope its clear, guys.
Thanks, again.
:)
Hi Roel,
ReplyDeleteI managed to setup everything.
However, when I see the EasyHotspot login page, after clicking login button without providing username nor password, another page pops up and says "Logging in to EasyHotspot, please wait...." and stays like this forever. No error, no internet access, just nothing.
What could have been wrong?
Thanks,
snlm95
I also tried perform login based on a user in the mysql.radcheck table. Radiusd -X shows that easyhotspot queries the radcheck table. The result however, is still the same. It doesn't redirect to the page the wifi client is trying to access. It just says "Logging in to EasyHotspot, please wait..."
DeleteHi,
ReplyDeleteIm not able to edit the chilli configuration by easyhotspot gui.But i can edit configration manually.
Hey one help for user : the epel for 32 bits :
ReplyDeleteyum install wget
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
remplace to :
yum install wget
wget http://mirror.sfo12.us.leaseweb.net/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
Nice one...
DeleteNice tutorial here!
ReplyDeleteCan I use LDAP authentication for my access point with the freeradius?
thanks ina dvance
I can not login to the management system with
ReplyDeleteuser name admin
password admin123
Thanks a lot for the manual...It's very helpful for me...One question: When you said "Now add in /etc/rc.local, then when reboot, will be running automatically." what do you mean? Thanks!!!
ReplyDeleteHaii...
ReplyDeletei have a problem, freeradius and coovachilli already running, but when i enter the username and password in coovachilli, coova chilli say "invalid username or password". but the password already generated voucher in easyhotspot. i am using ubuntu 10.04.04
could not restart Radiusd, but all services started successfully, i have centos 5.5
ReplyDeleteHi, i have followed the guide for installing freeradius, coovachilli and the EasyHotspot. i'm able to login to the EasyHotspot but when i connect clients on the network nothing happens and also freeradius runs without any error. I would like to know if freeradius can run on proxmox virtual machine using centos6.4?
ReplyDeleteHi I am trying to install free radius as per above post one of the step is to edit the file etc/raddb/sql/mysql/counter.conf but in the folder etc/raddb i cannot see any folder name called sql (FYI: i am installing it on centos7) do i need to any other configure settings to do it
ReplyDeleteradius server error find to sql module. and i have already uncomment the sql in default file of radius.
ReplyDelete