Tuesday, July 02, 2013

How to Fix Problems in Installing "YFI Hotspot Manager"

YFI hotspot manager error
What do you think about the picture above ?  Yes. The login administrator yfi hotspot manager but there's no box username and password. Did you ever get an error like the picture above?  For me, the error like picture above, appear many times. I have collected many kinds of errors of installing YFI Hotspot Manager and how to fix it. This is all I got when I tried YFI Hotspot manager installation in Ubuntu 12:10 / 13:04, fedora 18/19 and centos 6.4. Do not be afraid, because of these errors. At the time of installation you will not get this much errors, (probably only get 1 or 2 errors only). You even probably will not get an error, if you follow the tutorial how to installing yfi hotspot manager correctly, and carefully. Especially following the tutorial from me ... hahaha ...

Remember this.
Sometimes when you have run the command to correct the error,  nothing can change. Still error / problem. This is because the permission of the selinux.  Make sure, you have disable selinux.
Edit /etc/selinux/config
SELINUX=disabled
Let's look at a list of errors and how to fix it.

01. Error. No login and password box
Situation. When browse to http://<your-ip-address>/yfi
There’s logo yfi hotspot manager, but there’s no login and password box.
YFI hotspot manager error
And then when browse to http:// http://<your-ip-address>/c2/yfi_cake/users/login
Not Found
The requested URL /c2/yfi_cake/users/login was not found on this server.


Apache/2.2.22 (Ubuntu) Server at 10.1.1.242 Port 80


How to Fix
In Ubuntu, edit /etc/apache2/apache2.conf
vim  /etc/apache2/apache2.conf
        <Directory  /var/www/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/apache2/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
        #-----------------------------------------

And then make sure, you have running this command to load module for apache2
sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod headers

In Fedora/Centos
vim /etc/httpd/conf/httpd.conf
        ## -- 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

And run this command to load the modules
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so

02. Error. Couldn't open dictionary
Situation. When  running radiusd -X, then
Errors reading dictionary: dict_init: /etc/raddb/dictionary[14]: Couldn't open dictionary "/usr/local/share/freeradius/dictionary": No such file or directory

How to fix
Edit file /etc/raddb/dictionary. Find and change line, below
$INCLUDE  /usr/local/share/freeradius/dictionary
To
$INCLUDE  /usr/share/freeradius/dictionary

03. Error. No such server virtual.example.com
Situation. When running radiusd -X, then
/etc/raddb/proxy.conf[389]: No such server virtual.example.com

How to Fix
Edit /etc/raddb/proxy.conf
Find and remove or make comment some line below
#home_server virtual.example.com {
#           virtual_server = virtual.example.com
#}

04. Error. Missing database table.
Situation. When browse to http:// http://<your-ip-address>/c2/yfi_cake/users/login
Database table photos for model Photo was not found.
error database table photo

And then when you browse to http://<your-ip-address>/yfi
There’s logo yfi hotspot manager, but there’s no login and password box.
YFI hotspot manager error

How to fix
This error occurs because the database is damaged. redumping the database. Make sure the database (file yfi.sql) is correct. If you are using yfi-cake svn, use file yfi.sql from yfi-cake svn. If you are using yfi_cake-Beta-5, use file yfi.sql from yfi_cake-Beta-5. Then redump database.
mysql -u root -p yfi < /var/www/c2/yfi_cake/setup/db/yfi.sql

05. Error. Can't locate SQLConnector.pm in
Situation.  When you running command, radiusd  -X.
Can't locate SQLConnector.pm in @INC (@INC contains: /usr/local/etc/raddb/rlm_perl_modules /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /etc/raddb/rlm_perl_modules/rlm_perl.pm line 34.
BEGIN failed--compilation aborted at /etc/raddb/rlm_perl_modules/rlm_perl.pm line 34.
rlm_perl: perl_parse failed: /etc/raddb/rlm_perl_modules/rlm_perl.pm not found or has syntax errors.
/etc/raddb/modules/perl[7]: Instantiation failed for module "perl"
/etc/raddb/sites-enabled/default[250]: Failed to find "perl" in the "modules" section.
/etc/raddb/sites-enabled/default[250]: Failed to parse "perl" entry.

How to fix
This error happened because, you are using default freeradius. And the freeradius configuration is in /etc/raddb. Make link to /usr/local/etc/raddb, this folder is default freeradius configuration for YFI Hotspot Manager.
ln -s /etc/raddb /usr/local/etc/

06. Error. Can't locate XML/Simple.pm
Situation.  When you running command, radiusd  -X
Can't locate XML/Simple.pm in @INC (@INC contains: /usr/local/etc/raddb/rlm_perl_modules /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/etc/raddb/rlm_perl_modules/SQLConnector.pm line 6.
BEGIN failed--compilation aborted at /usr/local/etc/raddb/rlm_perl_modules/SQLConnector.pm line 6.
Compilation failed in require at /etc/raddb/rlm_perl_modules/rlm_perl.pm line 34.
BEGIN failed--compilation aborted at /etc/raddb/rlm_perl_modules/rlm_perl.pm line 34.
rlm_perl: perl_parse failed: /etc/raddb/rlm_perl_modules/rlm_perl.pm not found or has syntax errors.
/etc/raddb/modules/perl[7]: Instantiation failed for module "perl"
/etc/raddb/sites-enabled/default[250]: Failed to find "perl" in the "modules" section.
/etc/raddb/sites-enabled/default[250]: Failed to parse "perl" entry.

How to fix
yum install perl-XML-Simple

07. Error. cannot add vpn connected nas
Situation. In administrator yfi hotspot manager. Klik realms & providers – Nas Devices. And then clik “add vpn connected nas”, like picture below. Error. No respond, there’s no dialog box “add vpn connected nas”.
add vpn connected nas

How to fix
Install ppp and pptpd, and then edit permission /etc/ppp/chap-secrets
In Ubuntu
apt-get install ppp pptpd
In Fedora
yum install ppp
For 32bit:
rpm -Uvh http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.fc19.i686.rpm
or, for 64bit:
rpm -Uvh http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.fc19.x86_64.rpm
In centos
yum install ppp
For 32bit:
rpm -Uvh http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.el6.x86_64.rpm
or, for 64bit:
rpm -Uvh http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.el6.i686.rpm
then, for all OS, don’t forget the permission.
chown root.apache /etc/ppp/chap-secrets
chmod 664 /etc/ppp/chap-secrets

08. Error. Can't locate Time/HiRes.pm
Situation. In Centos, when you running radiusd -X
Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/etc/raddb/rlm_perl_modules /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/etc/raddb/rlm_perl_modules/User.pm line 11.
BEGIN failed--compilation aborted at /usr/local/etc/raddb/rlm_perl_modules/User.pm line 11.
Compilation failed in require at /etc/raddb/rlm_perl_modules/rlm_perl.pm line 50.
BEGIN failed--compilation aborted at /etc/raddb/rlm_perl_modules/rlm_perl.pm line 50.
rlm_perl: perl_parse failed: /etc/raddb/rlm_perl_modules/rlm_perl.pm not found or has syntax errors.
/etc/raddb/modules/perl[7]: Instantiation failed for module "perl"
/etc/raddb/sites-enabled/default[250]: Failed to load module "perl".
/etc/raddb/sites-enabled/default[250]: Failed to parse "perl" entry.

How to fix
yum install perl-Time-HiRes

09. Error. ippool-dhcp.conf": No such file or directory
Situation. When you running radiusd -X
Unable to open file "/etc/raddb/sql/mysql/ippool-dhcp.conf": No such file or directory
Errors reading /etc/raddb/radiusd.conf

How to fix
rm /etc/raddb/modules/dhcp_sqlippool

10. Error. Couldn't open encmap iso-8859-15.enc
Situation. When you running radiusd -X
Couldn't open encmap iso-8859-15.enc:
No such file or directory
 at /usr/lib64/perl5/XML/Parser.pm line 187

How to fix
yum install perl-XML-LibXML

11. Error. Fail test radius a voucher.
Situation. When you select an username ( for example, voucher ) and then click test radius. Then you will find error.
test radius voucher

And when you running the bug with command radiusd -X, you find error.
rlm_sql: Failed to create the pair: Unknown attribute "Yfi-Data" requires a hex string, not "262144000"
rlm_sql (sql): Error getting data from database
[sql] Error retrieving check pairs for group Permanent 250M CAP
[sql] Error processing groups; rejecting user

Or, this error.
rlm_sql: Failed to create the pair: Unknown attribute "Yfi-Voucher" requires a hex string, not "1-00-00-00"
rlm_sql (sql): Error getting data from database
[sql] SQL query error; rejecting user
rlm_sql (sql): Released sql socket id: 3
++[sql] returns fail
Using Post-Auth-Type REJECT

How to fix
Edit /usr/local/etc/raddb/site-available/default.   In authorize section, make sure comment perl and sql, like below
        Authorize {
        # perl
        # sql

12.Error. Sorry an error occurred
Situation. When click Realm & Providers – Nas Devices, error “sorry an error occurred”
error nas devices

And then when clik Permanent Users – User Management, the result is the same, “sorry an error occurred”

How to fix
Check again your php version. What version YFI hotspot manager did you install ? make sure you installed the correct version according php version. Look at the table.
PHP version
YFI hotspot manager
explanation
5.3
yfi_cake-Beta-5 + yfi-viewer-5
Success to install
5.3
yfi_cake-svn + yfi-viewer-svn 
Success to install
5.4 or latest
yfi_cake-Beta-5 + yfi-viewer-5
Not success
5.4 or latest
yfi_cake-svn + yfi-viewer-svn 
Success to install
Note.
  • Check your php version. If you have php version 5.4, don’t ever think to use yfi_cake-Beta-5.
  • Success in the table, not mean, there’s no error.
  • Below link download yfi_cake-Beta-5, and yfi_cake-svn (include yfi viewer).
wget http://sourceforge.net/projects/hotcakes/files/YFi%20CakePHP%20Application/Beta-5/yfi_cake-Beta-5.tar.gz
wget http://nchc.dl.sourceforge.net/project/hotcakes/YFi%20Viewer%20Component/Beta-5/yfi-Beta-5.tar.gz 
svn checkout svn://svn.code.sf.net/p/hotcakes/code/trunk/yfi yfi
svn checkout svn://svn.code.sf.net/p/hotcakes/code/trunk/yfi_cake yfi_cake

13. Error. cakephp-1.2.12/yfi_cake/tmp cache/ is not writable
Situation. When browse to http://<your-ip-address>/c2/yfi_cake/users/login
Warning (512): /var/www/html/cakephp-1.2.12/yfi_cake/tmp/cache/ is not writable [CORE/cake/libs/cache/file.php, line 275]
And then when browse to http://<your-ip-address>/yfi
YFI hotspot manager error

How to fix
chown -R apache. /var/www/c2/yfi_cake/tmp
chown -R apache. /var/www/c2/yfi_cake/webroot/img/graphics

14. Error. Failed to link to module 'rlm_perl'
Situation. when you running radiusd -X
Module: Creating Post-Auth-Type = REJECT
 Module: Checking authenticate {...} for more modules to load
/usr/local/etc/raddb/modules/perl[7]: Failed to link to module 'rlm_perl': rlm_perl.so: cannot open shared object file: No such file or directory
/usr/local/etc/raddb/sites-enabled/default[250]: Failed to find "perl" in the "modules" section.
/usr/local/etc/raddb/sites-enabled/default[250]: Failed to parse "perl" entry.

How to fix
This errors happened because there’s no module perl. you must to reinstall freeradius-server-2.0. Before that, install the supporting files.
yum install libtool-ltdl-devel mysql-devel perl-XML-Simple perl-XML-LibXML perl-suidperl perl-libxml-perl   perl-ExtUtils-Embed perl-Time-HiRes
Then reinstall freeradius-server-2.2.0
cd freeradius-server-2.2.0
./configure; make; make install
ldconfig

15. Error. Service radiusd failed
Situation.  When you running command, service radiusd restart
service radiusd restart
Redirecting to /bin/systemctl restart  radiusd.service
Job for radiusd.service failed. See 'systemctl status radiusd.service' and 'jour
nalctl -xn' for details.
# systemctl status radiusd.service
radiusd.service - FreeRADIUS high performance RADIUS server.
   Loaded: loaded (/usr/lib/systemd/system/radiusd.service; enabled)
   Active: failed (Result: exit-code) since Mon 2013-06-24 18:43:30 CIT; 12s ago
  Process: 799 ExecStartPre=/usr/sbin/radiusd -C (code=exited, status=1/FAILURE)
  Process: 797 ExecStartPre=/bin/chown -R radiusd.radiusd /var/run/radiusd (code=exited, status=0/SUCCESS)

Jun 24 18:43:30 NGERI-YFI radiusd[799]: radiusd: Failed to open log file /usr/local/var/log/radius/radius.log: No such file or directory
Jun 24 18:43:30 NGERI-YFI systemd[1]: radiusd.service: control process exited, code=exited status=1
Jun 24 18:43:30 NGERI-YFI systemd[1]: Failed to start FreeRADIUS high performance RADIUS server..
Jun 24 18:43:30 NGERI-YFI systemd[1]: Unit radiusd.service entered failed state.
Or. When you running command radiusd –X.
Radius -X
Failed binding to /usr/local/var/run/radiusd/radiusd.sock: No such file or directory

How to fix
This error happened because you are using default freeradius of OS Linux. And the freeradius configuration is in /etc/raddb. Edit /etc/raddb/radiusd.conf
sysconfdir = /etc
localstatedir = /var
sbindir = /sbin
special for Ubuntu, there’s a little different. Make link freeradius to radiusd.
ln -s /var/run/freeradius /var/run/radiusd

Ok. I hope this post is useful. If you find the same error as above, you will be easy to fix it. But if you find a new error that is not here, please send it to me, or you can comment here. It would be better if you send the error and how to fix it. So, I will update this post again.

No comments:

Post a Comment